glyphToPath static method
Implementation
static Map<String, dynamic> glyphToPath(Font font, gid) {
Map<String, dynamic> path = {"cmds": [], "crds": []};
if (font.SVG != null && font.SVG["entries"][gid] != null) {
var p = font.SVG["entries"][gid];
if (p == null) return path;
if (p is String) {
p = Typr_SVG.toPath(p);
font.SVG["entries"][gid] = p;
}
return p;
} else if (font.CFF != null) {
final Map<String,dynamic> state = {
"x": 0,
"y": 0,
"stack": [],
"nStems": 0,
"haveWidth": false,
"width":
font.CFF["Private"] != null ? font.CFF["Private"].defaultWidthX : 0,
"open": false
};
var cff = font.CFF, pdct = font.CFF["Private"];
if (cff["ROS"] != null) {
int gi = 0;
while (cff["FDSelect"][gi + 2] <= gid) gi += 2;
pdct = cff["FDArray"][cff["FDSelect"][gi + 1]]["Private"];
}
_drawCFF(font.CFF["CharStrings"][gid], state, cff, pdct, path);
} else if (font.glyf != null) {
_drawGlyf(gid, font, path);
}
return path;
}