-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text shaping #820
Text shaping #820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @andersonhc! 👏
This looks very promising, I'm eager to see the final version of this work to be release 😊
In the GitHub Actions pipeline, Pylint raises a few issues:
|
Regenerate reference PDFs
and word spacing
I that see you have been working hard on this PR! The VeraPDF checker complains about this reference PDF file:
This is the rule that applies:
Do you see why glyph widths could be inconsistent? |
I was storing the glyph advance harfbuzz returns (x_advance) as the glyph width, but it's not working because the same glyph was returning different widths, that's why Vera is complaining. I did some digging and turns out the x_advance can be different because of different factors like kerning. I'm working on storing the width from fonttools as glyph width and create a new "force positioning" tag to force the text matrix to be manually set if the x_advance is not equal the glyph width, it should be fixed soon. My next challenge now is working on "right-to-left" texts like Arabic. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #820 +/- ##
==========================================
- Coverage 93.39% 93.21% -0.19%
==========================================
Files 27 27
Lines 7407 7576 +169
Branches 1335 1375 +40
==========================================
+ Hits 6918 7062 +144
- Misses 307 326 +19
- Partials 182 188 +6
☔ View full report in Codecov by Sentry. |
VeraPDF is complaining of the following non-whitelisted errors: 6.2.3.2-1 - All ICCBased colour spaces shall be embedded as ICC profile streams as described in PDF Reference 4.5 |
@Lucas-C It was downloading VeraPDF 1.22.3 This one right now is downloading VeraPDF 1.24.1 See the errors we are getting on my post above. Should I whitelist these errors on verapdf-ignore.json or do you want to look at these files first? |
Hi @andersonhc! Sorry for the delay. I finally took the time to review this PR. I made a few comments, but I'm mostly curious to know what you think about this PR status: |
Co-authored-by: Lucas Cimon <925560+Lucas-C@users.noreply.github.com>
Co-authored-by: Lucas Cimon <925560+Lucas-C@users.noreply.github.com>
Co-authored-by: Lucas Cimon <925560+Lucas-C@users.noreply.github.com>
I believe I implemented all I had planned for this PR and I'm happy with the result. |
Merged! Thank you for this excellent contribution @andersonhc 👍 |
@allcontributors please add @andersonhc for doc, ideas |
I've put up a pull request to add @andersonhc! 🎉 |
Very cool addition, which will increase fpdf2s potential target audience significantly! I'll just update "Text.md", so you'll want to wait for another quick PR before sending the next release |
Alright! |
New feature: use Harfbuzz to perform text shaping allowing fpdf2 to produce files using complex font features like ligatures, kerning, character replacement and positioning.
Fixes #365 #540 #549 #679 #700 #812
Checklist:
CHANGELOG.md
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.