You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.
Unfortunately, gofpdf (like FPDF from which it is derived) does not currently support font kerning. This feature would be valuable so I will tag this as an enhancement. I imagine a solution would involve a font-specific table that associates letter pairs with spacing amount. Thanks for your post.
I had some experiments and below is what I've got with gofpdf and my simple implementation of font kerning.
It's not completely implemented (only applied when using AddUTF8Font() and Text()), but it can meet my need now. I will continue to work on this when I have time.
I have added this feature to another PDF generator library in the past, so I may be able to provide some insight. Basically, you just need to parse the kern move amount for each letter pair from the font file. Then, when writing text, if there is a kern move amount defined for a letter pair, you embed that amount in between parentheses.
For example, within a TJ operation (show one or more text strings), if the kern move amount is 120 between the letters "T" and "o", then the PDF content would be: [(T)120(ourist)] TJ
More information is in the PDF specification under "Text-Showing Operators".
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It seems gofpdf does not support font kerning at the moment. For example, when outputting "Tourist" with Arial font:
Result of gofpdf:
Expected:
Note the difference of the spacing between "T" and "o". Is there any way to apply font kerning?
The text was updated successfully, but these errors were encountered: