Having an absolutely wild Saturday evening investigating Unicode combining characters. Lagrange currently utterly fails to render these. A special layout algorithm that adapts to any number of combined extra glyphs is needed.
I haven't thrown in the towel yet, but falling back to using an existing library is always an option...
After a while it became evident that trying to write my own text shaping engine would be a monumental project of its own. And since HarfBuzz already exists, quite a waste a time...
So I've gradually been integrating HarfBuzz into Lagrange's text renderer. There are still a few issues with the current set of fonts not containing all combining glyphs.
Next step: FriBidi for dealing with RTL scripts.
Looks like FriBidi is doing its thing!
(i.e., applying the Unicode Bidirectional Algorithm)
Still need to optimize the text handling a bit to avoid repeated processing of static strings, e.g., UI labels. Text selection is also a bit wonky over RTL runs...
HarfBuzz & FriBidi mean a big step forward in supporting complex scripts. The final big issue remaining is expanding the collection of available fonts.
It's a bit of a challenge to call FriBidi at the right time. I'll need to refactor the document layout somewhat so the text renderer has visibility to the full paragraph and can process it in one go. At the moment it's more of a line-based operation, which makes it more challenging to apply alignment (and justification).
The BiDi quest continues.
I now have the ability to wrap an entire paragraph in one go while also having FriBidi tell me the directions.
My initial attempt is going badly. Wrapping the entire paragraph in visual order means that the first wrapped line covers the end of the paragraph.
Back to the drawing board… Seems like wrapping needs to be done in logical order and only the drawing in visual order.
Polyglot City is the right instance for you, if you're interested in linguistics, languages, language learning and translating, or if you are multilingual or polyglot. All languages are allowed to flourish on our timelines. And of course you're free to talk about anything else besides languages, too. Make this your personal home!