charToGlyph method

dynamic charToGlyph(
  1. dynamic c
)

Convert the given character to a single Glyph object. Note that this function assumes that there is a one-to-one mapping between the given character and a glyph; for complex scripts this might not be the case. @param {string} @return {opentype.Glyph}

Implementation

charToGlyph(c) {
  var glyphIndex = this.charToGlyphIndex(c);
  var glyph = this.glyphs.get(glyphIndex);
  if (!glyph) {
      // .notdef
      glyph = this.glyphs.get(0);
  }

  return glyph;
}