nameToGlyphIndex method
dynamic
nameToGlyphIndex(
- dynamic name
Convert the given text to a list of Glyph objects. Note that there is no strict one-to-one mapping between characters and glyphs, so the list of returned glyphs can be larger or smaller than the length of the given string. @param {string} @param {GlyphRenderOptions} options @return {opentype.Glyph[]}
Implementation
// stringToGlyphs(s, options) {
// var bidi = new Bidi();
// // Create and register 'glyphIndex' state modifier
// var charToGlyphIndexMod = token => this.charToGlyphIndex(token.char);
// bidi.registerModifier('glyphIndex', null, charToGlyphIndexMod);
// // roll-back to default features
// var features = options ?
// this.updateFeatures(options.features) :
// this.defaultRenderOptions.features;
// bidi.applyFeatures(this, features);
// var indexes = bidi.getTextGlyphs(s);
// var length = indexes.length;
// // convert glyph indexes to glyph objects
// var glyphs = new Array(length);
// var notdef = this.glyphs.get(0);
// for (var i = 0; i < length; i += 1) {
// glyphs[i] = this.glyphs.get(indexes[i]) || notdef;
// }
// return glyphs;
// }
nameToGlyphIndex(name) {
return this.glyphNames.nameToGlyphIndex(name);
}