luapower / tr0

Unicode text rendering engine in Lua
http://luapower.com/tr0
0 stars 1 forks source link

Letter-spacing #20

Open capr opened 6 years ago

capr commented 6 years ago
khaledhosny commented 6 years ago

I don’t think HB_GLYPH_FLAG_UNSAFE_TO_BREAK is meant for this. It only tells whether breaking at this point require re-shaping the text on both sides or not.

capr commented 6 years ago

I was assuming that harfbuzz would report unsafe-to-break between any two graphemes for which ligated glyphs were chosen since breaking at that point would require choosing different glyphs. Any idea on how to reliably identify breaking points for this purpose? Thanks.

khaledhosny commented 6 years ago

HB_GLYPH_FLAG_UNSAFE_TO_BREAK would be set only between glyphs involved in contextual substitution (even just as context) but I think you would still want to letter-space these. I think you should just letter-space grapheme clusters and disable common ligatures when letter-spacing is on (some applications use a threshold before disabling ligatures), and for disable letter-spacing for cursive scrips like Arabic or Syriac (or just leave it to the user not not letter-space such scripts).