diff --git a/pdf/creator/list.go b/pdf/creator/list.go index 8df28990..2c4bb9a4 100644 --- a/pdf/creator/list.go +++ b/pdf/creator/list.go @@ -189,7 +189,7 @@ func (l *List) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error marker.SetTextAlignment(TextAlignmentRight) marker.Append(item.marker.Text).Style = item.marker.Style - width := round((marker.getTextWidth()/1000.0)/ctx.Width, 0.001, 3) + width := marker.getTextWidth() / 1000.0 / ctx.Width if markerWidth < width { markerWidth = width } diff --git a/pdf/creator/utils.go b/pdf/creator/utils.go index 7a9e58f3..51c619e5 100644 --- a/pdf/creator/utils.go +++ b/pdf/creator/utils.go @@ -6,7 +6,6 @@ package creator import ( - "math" "os" "github.com/unidoc/unidoc/pdf/model" @@ -44,21 +43,3 @@ func loadPagesFromFile(path string) ([]*model.PdfPage, error) { return pages, nil } - -func round(val float64, roundOn float64, places int) float64 { - var round float64 - - pow := math.Pow(10, float64(places)) - digit := pow * val - _, div := math.Modf(digit) - div = math.Copysign(div, val) - - roundOn = math.Copysign(roundOn, val) - if div >= roundOn { - round = math.Ceil(digit) - } else { - round = math.Floor(digit) - } - - return round / pow -}