GenericGlyph.fromSimpleTrueTypeGlyph constructor
GenericGlyph.fromSimpleTrueTypeGlyph(
- SimpleGlyph glyph
Implementation
factory GenericGlyph.fromSimpleTrueTypeGlyph(SimpleGlyph glyph) {
final isOnCurveList = glyph.flags.map((e) => e.onCurvePoint).toList();
final endPoints = [-1, ...glyph.endPtsOfContours];
final outlines = [
for (var i = 1; i < endPoints.length; i++)
Outline(
glyph.pointList.sublist(endPoints[i - 1] + 1, endPoints[i] + 1),
isOnCurveList.sublist(endPoints[i - 1] + 1, endPoints[i] + 1),
true,
true,
FillRule.nonzero)
];
final bounds = math.Rectangle(
glyph.header.xMin,
glyph.header.yMin,
glyph.header.xMax - glyph.header.xMin,
glyph.header.yMax - glyph.header.yMin,
);
return GenericGlyph(outlines, bounds);
}