MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / addGlyphNames

Function addGlyphNames

libraries/p5.js:1510–1530  ·  view source on GitHub ↗
(font)

Source from the content-addressed store, hash-verified

1508};
1509
1510function addGlyphNames(font) {
1511 var glyph;
1512 var glyphIndexMap = font.tables.cmap.glyphIndexMap;
1513 var charCodes = Object.keys(glyphIndexMap);
1514
1515 for (var i = 0; i < charCodes.length; i += 1) {
1516 var c = charCodes[i];
1517 var glyphIndex = glyphIndexMap[c];
1518 glyph = font.glyphs.get(glyphIndex);
1519 glyph.addUnicode(parseInt(c));
1520 }
1521
1522 for (i = 0; i < font.glyphs.length; i += 1) {
1523 glyph = font.glyphs.get(i);
1524 if (font.cffEncoding) {
1525 glyph.name = font.cffEncoding.charset[i];
1526 } else {
1527 glyph.name = font.glyphNames.glyphIndexToName(i);
1528 }
1529 }
1530}
1531
1532exports.cffStandardStrings = cffStandardStrings;
1533exports.cffStandardEncoding = cffStandardEncoding;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected