forked from googlefonts/sfntly
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
First, the cast to SimpleGlyph in the following rendering codes is not correct, throwing exceptions for nested composite glyphs. Try rendering Glyph ID 126 in the font NotoSerif-Thin.ttf.
private void paintCompositeGlyph(Graphics2D g, CompositeGlyph composite) {
for (int i = 0; i < composite.numGlyphs(); i++) {
int glyphIndex = composite.glyphIndex(i);
int offset = loca.glyphOffset(glyphIndex);
int length = loca.glyphLength(glyphIndex);
if (length != 0) {
SimpleGlyph simple = (SimpleGlyph) glyf.glyph(offset, length); // <--- Here
int deltaX = composite.argument1(i);
int deltaY = composite.argument2(i);
paintSimpleGlyph(g, simple, deltaX, deltaY);
}
}
}
Next, checking for the nested composite glyph and calling the paintCompositeGlyph(...) recursively seems to work but rendering is incomplete and will not render the denominator in some fractional representations like 1/4 (where the 4 is not rendered in fonts like NotoSerif-Thin.ttf).
The denominator is actually rendered but clipped off the screen (it seems deltaY is very large).
What is the best way to fix the nested rendering of composite glyphs?
Metadata
Metadata
Assignees
Labels
No labels