charToGlyphIndex method

dynamic charToGlyphIndex(
  1. dynamic c
)

Implementation

charToGlyphIndex(c) {
  var code = c.codePointAt(0);
  var glyphs = this.font.glyphs;
  if (glyphs != null) {
    for (var i = 0; i < glyphs.length; i += 1) {
      var glyph = glyphs.get(i);
      for (var j = 0; j < glyph.unicodes.length; j += 1) {
        if (glyph.unicodes[j] == code) {
          return i;
        }
      }
    }
  }
  return null;
}