From 7e905297037cc21fc13ce80f594347ef99487f61 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 3 Oct 2013 21:32:43 +1000 Subject: [PATCH] freetype/truetype: fix the SSW instruction to scale the single-width value and the MDRP instruction's use of the single-width value. R=bsiegert CC=golang-dev https://codereview.appspot.com/14273043 --- freetype/truetype/hint.go | 6 +++--- freetype/truetype/truetype_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/freetype/truetype/hint.go b/freetype/truetype/hint.go index 60a74ff..d4ea9b8 100644 --- a/freetype/truetype/hint.go +++ b/freetype/truetype/hint.go @@ -307,7 +307,7 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, case opSSW: top-- - h.gs.singleWidth = f26dot6(h.stack[top]) + h.gs.singleWidth = f26dot6(h.font.scale(h.scale * h.stack[top])) case opDUP: if top >= len(h.stack) { @@ -821,9 +821,9 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, // Single-width cut-in test. if x := (oldDist - h.gs.singleWidth).abs(); x < h.gs.singleWidthCutIn { if oldDist >= 0 { - oldDist = h.gs.singleWidthCutIn + oldDist = +h.gs.singleWidth } else { - oldDist = -h.gs.singleWidthCutIn + oldDist = -h.gs.singleWidth } } diff --git a/freetype/truetype/truetype_test.go b/freetype/truetype/truetype_test.go index 11d5571..f784fce 100644 --- a/freetype/truetype/truetype_test.go +++ b/freetype/truetype/truetype_test.go @@ -116,7 +116,7 @@ func testScaling(t *testing.T, filename string, hinter *Hinter) { for i, want := range wants { // TODO: completely implement hinting. For now, only the first N glyphs // of luxisr.ttf are correctly hinted. - const N = 106 + const N = 136 if hinter != nil && i == N { break }