Skip to content

Commit

Permalink
freetype/truetype: recalculate 'phantom point 1' after rounding.
Browse files Browse the repository at this point in the history
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/19090043
  • Loading branch information
nigeltao committed Oct 29, 2013
1 parent e849ac9 commit 1f81822
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions freetype/truetype/glyph.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion freetype/truetype/truetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}
Expand Down

0 comments on commit 1f81822

Please sign in to comment.