This commit is contained in:
Will Charczuk 2016-07-10 23:42:58 -07:00
parent 3fe53d76d8
commit 8f0751f743
2 changed files with 2 additions and 3 deletions

View File

@ -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.

View File

@ -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)