The most painful issues I encountered when building out a text layout engine for my JS 2D canvas library were:
- Vertical text - in particular when it comes to how CJK punctuation differs in horizontal and vertical environments (not yet solved)
- Staying on CJK, making sure the punctuation marks that follow a character don't break and remain with their preceding characters at all times. (I expect the same holds for opening quotes etc but haven't experimented).
- Highly ligatured fonts - Devangari, Arabic, etc - there's no solution to styling individual characters within a word that I could find.
- Talking of styling ... underlining text is a nightmare - especially if you want to get the little gap between hanging characters and the underline that HTML/CSS browsers do out of the box
- Formatting Thai fonts ... is another World of Hurt[1]
- Vertical text - in particular when it comes to how CJK punctuation differs in horizontal and vertical environments (not yet solved)
- Staying on CJK, making sure the punctuation marks that follow a character don't break and remain with their preceding characters at all times. (I expect the same holds for opening quotes etc but haven't experimented).
- Highly ligatured fonts - Devangari, Arabic, etc - there's no solution to styling individual characters within a word that I could find.
- Talking of styling ... underlining text is a nightmare - especially if you want to get the little gap between hanging characters and the underline that HTML/CSS browsers do out of the box
- Formatting Thai fonts ... is another World of Hurt[1]
[1] - https://w3c.github.io/sealreq/thai/