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

Henning von Bargen H.vonBargen at t-p.com
Thu Aug 25 04:10:07 EDT 2022


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




More information about the reportlab-users mailing list