opentypejs / opentype.js

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

Glyphs for complex-character string #191

Open kotpal opened 8 years ago

kotpal commented 8 years ago

On Windows 10, Nirmala.ttf has the glyphs for almost all the languages (complex-scripts) from India.

If you load nirmala.ttf at http://opentype.js.org/ and try to render కృష్ణ, it is not rendered properly.

font.stringToGlyphs is also returning the glyphs that won't render the complex-string as కృష్ణ, but instead it renders it incorrectly.

font.stringToGlyphs('కృష్ణ') returns 5 glyphs with indices:1681, 2282, 2225, 2293 and 1919. But instead the actual glyphs should be: 1687, 2225 and 2346

My question is how can we get the proper glyphs along with the necessary x/y offsets for complex scripts?

sriharshachilakapati commented 8 years ago

I think these complex scripts are positioned with kerning, for vattulu etc., since the glyph needs to be rendered at the previous glyph. I'm not sure, I'll test it to with my name today.

On Mon, 30 May 2016 10:10 am Krishna Kotipalli, notifications@github.com wrote:

On Windows 10, Nirmala.ttf has the glyphs for almost all the languages (complex-scripts) from India.

If you load nirmala.ttf at http://opentype.js.org/ and try to render కృష్ణ, it is not rendered properly.

font.stringToGlyphs is also returning the glyphs that won't render the complex-string as కృష్ణ, but instead it renders it incorrectly.

My question is how can we get the proper glyphs along with the necessary x/y offsets for complex scripts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nodebox/opentype.js/issues/191, or mute the thread https://github.com/notifications/unsubscribe/AEYWNKFly134zr17HbXOlUrFasOIhiO-ks5qGmpJgaJpZM4Ipe-H .

sriharshachilakapati commented 8 years ago

I've verified and indeed this is true, even kerning is not able to solve this issue.

Display in Glyph viewer

This needs to be that we have to ignore adding the advance if the character is ్. I'll try with a test case. In my opinion, this has nothing to do with opentype.js.

Harbs commented 8 years ago

FWIW: Indian scripts require support for many OpenType features including various GPOS and GSUB tables which interact with each other in intricate ways. The order of the tables is very important as well. These scripts are easily the most complex ones in the world. I'm first getting acquainted with opentype.js now. I'm not sure if it takes table ordering into account. I'm also pretty sure there's no support for language-specific features which is important for Indian scripts as well. (not to mention minimal OT feature implementation)

To me, it makes sense to solve RTL and CJK languages before Indian ones. RTL and CJK would get you part of the way there.