freetype/truetype: recalculate 'phantom point 1' after rounding.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/19090043
This commit is contained in:
Nigel Tao 2013-10-30 07:50:48 +11:00
parent e849ac9382
commit 1f81822fe1
2 changed files with 5 additions and 4 deletions

View File

@ -167,16 +167,17 @@ func (g *GlyphBuf) load(recursion int32, i Index, useMyMetrics bool) (err error)
}
// Drop the four phantom points.
pp1x = g.Point[len(g.Point)-4].X
g.Point = g.Point[:len(g.Point)-4]
if g.hinter != nil {
g.InFontUnits = g.InFontUnits[:len(g.InFontUnits)-4]
g.Unhinted = g.Unhinted[:len(g.Unhinted)-4]
if dx := ((pp1x + 32) &^ 63) - pp1x; dx != 0 {
for i := np0; i < len(g.Point); i++ {
g.Point[i].X += dx
}
pp1x = g.Point[len(g.Point)-4].X
}
g.InFontUnits = g.InFontUnits[:len(g.InFontUnits)-4]
g.Unhinted = g.Unhinted[:len(g.Unhinted)-4]
}
g.Point = g.Point[:len(g.Point)-4]
if np0 != 0 {
// The hinting program expects the []End values to be indexed relative
// to the inner glyph, not the outer glyph, so we delay adding np0 until

View File

@ -253,7 +253,7 @@ var scalingTestCases = []struct {
}{
{"luxisr", 12, -1},
{"x-arial-bold", 11, 0},
{"x-deja-vu-sans-oblique", 17, 229},
{"x-deja-vu-sans-oblique", 17, 513},
{"x-droid-sans-japanese", 9, 0},
{"x-times-new-roman", 13, 0},
}