Open shuding opened 2 years ago
Looks like the correct way to go in the future:
@shuding how would you workaround the limitations of Harfbuzz, such as line breaking?
You could also try fontkit, which is a pure JS implementation supporting complex scripts. It powers pdfkit.
There's also textkit for handling higher level text layout (eg line wrapping, font substitution, etc.). That's used by react-pdf.
I'd highly recommend looking into some of these libraries and how they do text layout, because it is extremely complicated (especially with non-English text). Back when react-pdf was investigating this, I wrote this comment explaining the whole text layout process - maybe it's helpful to you. https://github.com/foliojs/pdfkit/issues/783#issuecomment-366893412
Thanks again for the pointers @devongovett! I actually looked into fontkit before picking opentype.js (because it's smaller, seems like a wrong choice lol), and actually read a lot of your comments from everywhere (thank you again!), and I understand the complexibility of this. Hence the first phase of this project is to support only basic text layout and font features.
Anyways, this is definitely our top priority!
@shuding how would you workaround the limitations of Harfbuzz, such as line breaking?
Thank you for sharing this!
Satori currently relies on OpenType.js to parse font tables and generate the glyphs. I’m considering switching to Harfbuzz in the future because it supports a couple of more complex scripts and OpenType features. It can also improve the performance a bit as it’s a WASM port.
Pretty low priority at the moment as we need to improve the typography algorithm first.