Skip to content

Commit

Permalink
freetype/truetype: apply the pp1x adjustment to the unhinted points
Browse files Browse the repository at this point in the history
*before* hinting.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/35070044
  • Loading branch information
nigeltao committed Nov 29, 2013
1 parent 114d43e commit 1f97ea5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion freetype/truetype/glyph.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ func (g *GlyphBuf) addPhantomsAndScale(b Bounds, uhm HMetric, i Index, np0 int,
p.Y = g.font.scale(g.scale * p.Y)
}
if simple && g.hinter != nil {
g.Unhinted = append(g.Unhinted, g.Point[np0:]...)
// Round the 1st phantom point to the grid, shifting all other points equally.
pp1x := g.Point[len(g.Point)-4].X
if dx := ((pp1x + 32) &^ 63) - pp1x; dx != 0 {
for i := np0; i < len(g.Point); i++ {
g.Point[i].X += dx
}
}
g.Unhinted = append(g.Unhinted, g.Point[np0:]...)
}
// Round the 2nd and 4th phantom point to the grid.
p := &g.Point[len(g.Point)-3]
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 @@ -255,7 +255,7 @@ var scalingTestCases = []struct {
hintingBrokenAt int
}{
{"luxisr", 12, -1},
{"x-arial-bold", 11, 130},
{"x-arial-bold", 11, 238},
{"x-deja-vu-sans-oblique", 17, -1},
{"x-droid-sans-japanese", 9, 0},
{"x-times-new-roman", 13, 0},
Expand Down

0 comments on commit 1f97ea5

Please sign in to comment.