Support WOFF and WOFF2 fonts#1660
Conversation
|
inform me if there is any problem |
andersonhc
left a comment
There was a problem hiding this comment.
Thanks for opening this PR.
I like the solution you found for harfbuzz.
Did you try producing a PDF with a WOFF font? Does the subset at output already decompress the font without any additional parameter?
Please create some tests on test/fonts/test_add_fonts.py. You can use WOFF and WOFF2 fonts, with and without text shaping.
Let us know if you have any question.
BharathPESU
left a comment
There was a problem hiding this comment.
i have changed some part of code,review it and inform me ,if any changes required
Can you please create some tests on
Look the |
|
Hey @BharathPESU |
- fpdf/fonts.py: * Added explanatory comment for TYPE_CHECKING block clarifying it's for static type checkers only * Optimized hbfont property to avoid performance hit for non-WOFF fonts by checking file extension * For WOFF/WOFF2: uses byte buffer decompression (required for HarfBuzz) * For TTF/OTF: loads directly from file path (faster, no extra serialization) * Removed invalid fallback for WOFF/WOFF2 that would fail anyway * Added logging for failed temp file cleanup to track orphaned files - fpdf/fpdf.py: * Removed unnecessary TYPE_CHECKING block for optional dependencies * Fixed table() method return type from Iterator[Table] to ContextManager[Table]
db7c521 to
3a187ee
Compare
|
I didn't have an answer in over 3 months, so I am completing the necessary changes to merge this PR. |
e.g. Fixes #0
Checklist:
A unit test is covering the code added / modified by this PR
In case of a new feature, docstrings have been added, with also some documentation in the
docs/folderA mention of the change is present in
CHANGELOG.mdThis PR is ready to be merged
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.