opentypejs / opentype.js

Read and write OpenType fonts using JavaScript.
https://opentype.js.org/
MIT License
4.36k stars 467 forks source link

Font.prototype.charToGlyph behaviour is incomplete for complex scripts #153

Open felipesanches opened 8 years ago

felipesanches commented 8 years ago

// 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. Font.prototype.charToGlyph = function(c) { ...

felipesanches commented 8 years ago

Same issue with:

fpirsch commented 7 years ago

Hi, I'm implementing basic ligature support. I plan to keep the current behavior of Font.prototype.charToGlyph and Font.prototype.charToGlyphIndex (1:1 mapping), and to make glyph substitutions in Font.prototype.stringToGlyphs. What do you think ?

brawer commented 7 years ago

If it helps, here’s a test suite; feel free to use it: https://github.com/unicode-org/text-rendering-tests

devongovett commented 7 years ago

You can also try fontkit, which has OpenType/AAT layout engines for complex scripts.

fdb commented 7 years ago

I think it's a good idea to keep charToGlyph and charToGlyphIndex, and add "plural" variants for complex scripts. (We have a similar approach with Glyph.unicode and Glyph.unicodes)

fpirsch commented 7 years ago

@brawer It'd be great to use your test suite with opentype.js . Are there any GSUB tests planned ?