From 8f0751f743bb44d7b7bea333ae2bdc4b1c97e8c6 Mon Sep 17 00:00:00 2001 From: Will Charczuk Date: Sun, 10 Jul 2016 23:42:58 -0700 Subject: [PATCH] tweaks. --- drawing/raster_graphic_context.go | 2 +- drawing_helpers.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drawing/raster_graphic_context.go b/drawing/raster_graphic_context.go index 33f11dc..32d6ad8 100644 --- a/drawing/raster_graphic_context.go +++ b/drawing/raster_graphic_context.go @@ -191,7 +191,7 @@ func (rgc *RasterGraphicContext) GetStringBounds(s string) (left, top, right, bo // recalc recalculates scale and bounds values from the font size, screen // resolution and font metrics, and invalidates the glyph cache. func (rgc *RasterGraphicContext) recalc() { - rgc.current.Scale = rgc.current.FontSizePoints * float64(rgc.DPI) + rgc.current.Scale = rgc.current.FontSizePoints * float64(rgc.DPI) * 64.0 / 72.0 } // SetFont sets the font used to draw text. diff --git a/drawing_helpers.go b/drawing_helpers.go index f0ed697..7687b43 100644 --- a/drawing_helpers.go +++ b/drawing_helpers.go @@ -80,8 +80,7 @@ func MeasureAnnotation(r Renderer, canvasBox Box, xrange, yrange Range, s Style, func DrawAnnotation(r Renderer, canvasBox Box, xrange, yrange Range, s Style, lx, ly int, label string) { r.SetFont(s.GetFont()) r.SetFontSize(s.GetFontSize(DefaultAnnotationFontSize)) - textWidth, _ := r.MeasureText(label) - textHeight := int(math.Floor(DefaultAnnotationFontSize)) + textWidth, textHeight := r.MeasureText(label) halfTextHeight := textHeight >> 1 pt := s.Padding.GetTop(DefaultAnnotationPadding.Top)