[reportlab-users] Kerning support (was: Character placement off - bug or am I using it wrong?)

25 views
Skip to first unread message

Henning von Bargen

unread,
Aug 25, 2022, 4:10:15 AM8/25/22
to reportl...@lists2.reportlab.com
Ellie wrote:

> Summed up, I'm hoping TTF kerning will be added one day and I find this limitation somewhat notable.

For anyone who would like to add kerning support to RL:

In my old project "wordaxe" (see https://pypi.org/project/wordaxe/) I created an alternative implementation of the Paragraph class.

The main goal of this project was to support automatic hyphenation with ReportLab, But this also enabled me to add (optional) kerning support for TrueType fonts.

Actually, I doubt that the release that can be downloaded from sourceforge is the most current.
Note that the software was developed with Python 2.

Roberto Alsina has a newer fork at https://github.com/ralsina/wordaxe which was used by his project rst2pdf and which works with Python 3 AFAIK.

For kerning, see the test code at https://github.com/ralsina/wordaxe/blob/master/tests/test_truetype.py

For performance reasons, kerning suport has to be enabled explicitly in the ParagraphStyle.

The code for extraction of the kerning info from a TTF file can be found in https://github.com/ralsina/wordaxe/blob/master/wordaxe/rl/kerning_info.py

I am not using ReportLab anymore, I'm only benevolently stalking the mailing list.
Thus I cannot help more than with this message, but for anyone who is going to add kerning support to ReportLab, I hope my old code can give some pointers.

Henning


_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
https://pairlist2.pair.net/mailman/listinfo/reportlab-users
Reply all
Reply to author
Forward
0 new messages