rinohtype icon indicating copy to clipboard operation
rinohtype copied to clipboard

Consider using harfbuzz/uharfbuzz for line layout

Open justvanrossum opened this issue 6 years ago • 2 comments

harfbuzz is the de-facto standard for opentype line layout processing, supporting all features of opentype including complex scripts. There's a lovely new Python interface for it on pypi:

https://pypi.org/project/uharfbuzz/ https://github.com/trufont/uharfbuzz

It's fast, relatively easy to use, and incredibly complete and versatile.

justvanrossum avatar Feb 06 '19 16:02 justvanrossum

An important design choice for rinohtype was for it to be implemented in pure Python and have as little dependencies as possible. A dependency on a package that requires a C library is therefore problematic.

However, looking at Text Layout Requirements for the Arabic Script, it is obvious that adding support for Arabic alone is already a whole lot of work. Therefore, I would not be opposed to adding support for Harfbuzz in addition to the (very basic) built-in text shaping engine.

brechtm avatar Feb 09 '19 23:02 brechtm

Thank you, that is great to know. I don't think there's another choice if rich typographic quality is a priority.

Practically, adopting harfbuzz would mean to enhance the styling infrastructure to allow passing arbitrary opentype feature tags down to the shaper, and to allow more sophisticated glyph placement. Right now, there's only kerning, but every single glyph can have an x/y positioning offset, and a vertical advance in addition to the horizontal advance.

justvanrossum avatar Feb 10 '19 08:02 justvanrossum