From 2c50caf6a4b3cf627c41ee1ec9e121e9c71b4da5 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Sun, 18 Nov 2018 11:13:53 +0200 Subject: [PATCH] Remove unnecessary util function --- pdf/creator/list.go | 2 +- pdf/creator/utils.go | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) 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 -}