googlefonts / fontations

Reading and writing font files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`AdjustedMetrics` from `OutlineGlyph::draw` returns 0 adjusted metrics for contourless glyph

drott opened this issue · comments

While testing with Skia, and running SkParagraph_* and testing with DroidSerif.ttf, executing OutlineGlyph::draw returns a Some(AdjustedMetrics) return value for the space glyph (gid 3) which contains an adjusted advance set to 0.

In the context of using hinted metrics in Skia, this leads to missing space glyphs. I am not quite sure what the right behavior is here, but we need some form of preserving spaces.

I tend to think returning None would be the right call here? Can a glyph that has no contour have phantom points?

In other words:
If hinting metrics is requested, we ask the scaler to provide such. I can fall back to using the unhinted value if the hinted value comes back as 0 while the unhinted value is actually a larger number, but perhaps that is less reliable than indicated through a None return value that no hinting adjustment was made on this glyph?

This looks like an oversight on my part. If FT_Load_Glyph is generating advances for empty glyphs then we should do the same.