@@ -139,11 +139,12 @@ func (o *Options) subPixelsY() (value uint32, halfQuantum, mask fixed.Int26_6) {
139
139
//
140
140
// For example, q == 4 leads to a bias of 8 and a mask of 0xfffffff0, or -16,
141
141
// because we want to round fractions of fixed.Int26_6 as:
142
- // - 0 to 7 rounds to 0.
143
- // - 8 to 23 rounds to 16.
144
- // - 24 to 39 rounds to 32.
145
- // - 40 to 55 rounds to 48.
146
- // - 56 to 63 rounds to 64.
142
+ // - 0 to 7 rounds to 0.
143
+ // - 8 to 23 rounds to 16.
144
+ // - 24 to 39 rounds to 32.
145
+ // - 40 to 55 rounds to 48.
146
+ // - 56 to 63 rounds to 64.
147
+ //
147
148
// which means to add 8 and then bitwise-and with -16, in two's complement
148
149
// representation.
149
150
//
@@ -205,6 +206,7 @@ func NewFace(f *Font, opts *Options) IndexableFace {
205
206
glyphCache : make ([]glyphCacheEntry , opts .glyphCacheEntries ()),
206
207
stroke : fixed .I (opts .Stroke * 2 ),
207
208
}
209
+ a .r .UseNonZeroWinding = true // key for fonts
208
210
a .subPixelX , a .subPixelBiasX , a .subPixelMaskX = opts .subPixelsX ()
209
211
a .subPixelY , a .subPixelBiasY , a .subPixelMaskY = opts .subPixelsY ()
210
212
@@ -388,13 +390,15 @@ func (a *face) GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool) {
388
390
}
389
391
advance , ok = a .advanceCache [r ]
390
392
if ok {
391
- return
393
+ idx := a .index (r )
394
+ return advance , (idx != 0 )
392
395
}
393
- if err := a .glyphBuf .Load (a .f , a .scale , a .index (r ), a .hinting ); err != nil {
396
+ idx := a .index (r )
397
+ if err := a .glyphBuf .Load (a .f , a .scale , idx , a .hinting ); err != nil {
394
398
return 0 , false
395
399
}
396
400
a .advanceCache [r ] = a .glyphBuf .AdvanceWidth
397
- return a .glyphBuf .AdvanceWidth , true
401
+ return a .glyphBuf .AdvanceWidth , ( idx != 0 )
398
402
}
399
403
400
404
// rasterize returns the advance width, integer-pixel offset to render at, and
0 commit comments