addGlyphNamesAll top-level property

Function addGlyphNamesAll
getter/setter pair

Implementation

Function addGlyphNamesAll = (font) {
  var glyph;
  var glyphIndexMap = font.tables["cmap"]["glyphIndexMap"];
  var charCodes = glyphIndexMap.keys.toList();

  for (var i = 0; i < charCodes.length; i += 1) {
    var c = charCodes[i];
    var glyphIndex = glyphIndexMap[c];
    glyph = font.glyphs.get(glyphIndex);
    glyph.addUnicode(int.parse(c.toString()));
  }

  for (var i = 0; i < font.glyphs.length; i += 1) {
    glyph = font.glyphs.get(i);
    if (font.cffEncoding != null) {
      if (font.isCIDFont) {
        glyph.name = 'gid${i}';
      } else {
        glyph.name = font.cffEncoding.charset[i];
      }
    } else if (font.glyphNames.names != null) {
      glyph.name = font.glyphNames.glyphIndexToName(i);
    }

  }


};