back

by raphlinus·7y ago·view on hn ↗
This is actually a super-interesting problem. The complex scripts require "shaping", which increasingly is done by HarfBuzz. Companies used to maintain their own proprietary implementations, but that's increasingly not a good idea. A problem is that HarfBuzz is a large, complex piece of software, entirely because OpenType is complex and not well specified (there are a ton of edge cases).

I did some research a few years ago on defining shaping by composing several simple finite state machines together, and am confident it could be made to work. The problem is, it doesn't work with existing fonts, the rules for shaping would have to be redone. But for fonts shipping in an embedded device, this would be entirely practical, and would be a lot faster and a lot less code than a solution based on HarfBuzz.

I'd need some incentive to complete this research. If someone wants to pay for it, please get in touch.

1 comments
What about compiling existing OpenType fonts to state machines in combination with the shaping rules? That's something we're thinking about for our Rust implementation :)
It's not as easy as it looks, but probably can be done. The research I was doing was very much pure transducers, but with a couple of twists (the one I'm proudest of is alternating between forward and backward passes, which makes certain things like matra reordering much easier). There is some work in this space by Monotype as well.