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
This commit is contained in:
Nigel Tao 2013-10-03 21:32:43 +10:00
parent 7505dadf20
commit 7e90529703
2 changed files with 4 additions and 4 deletions

View File

@ -307,7 +307,7 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point,
case opSSW: case opSSW:
top-- top--
h.gs.singleWidth = f26dot6(h.stack[top]) h.gs.singleWidth = f26dot6(h.font.scale(h.scale * h.stack[top]))
case opDUP: case opDUP:
if top >= len(h.stack) { if top >= len(h.stack) {
@ -821,9 +821,9 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point,
// Single-width cut-in test. // Single-width cut-in test.
if x := (oldDist - h.gs.singleWidth).abs(); x < h.gs.singleWidthCutIn { if x := (oldDist - h.gs.singleWidth).abs(); x < h.gs.singleWidthCutIn {
if oldDist >= 0 { if oldDist >= 0 {
oldDist = h.gs.singleWidthCutIn oldDist = +h.gs.singleWidth
} else { } else {
oldDist = -h.gs.singleWidthCutIn oldDist = -h.gs.singleWidth
} }
} }

View File

@ -116,7 +116,7 @@ func testScaling(t *testing.T, filename string, hinter *Hinter) {
for i, want := range wants { for i, want := range wants {
// TODO: completely implement hinting. For now, only the first N glyphs // TODO: completely implement hinting. For now, only the first N glyphs
// of luxisr.ttf are correctly hinted. // of luxisr.ttf are correctly hinted.
const N = 106 const N = 136
if hinter != nil && i == N { if hinter != nil && i == N {
break break
} }