Closed oliverbienert closed 2 years ago
Thank you for your pull-request! I agree with @foarsitter and prefer keeping the get_font_config
method.
Please check out the solution in the develop branch. Does this work for you?
Sorry for my late response. I checked it out, but now I've the problem that Weasyprint requires pango >= 1.44. I still run Buster, so I am going to dist-upgrade, then come back here.
Bullseye will indeed solve the pango issue.
Now running Bullseye and everything looks great so far. Your solution works for me, my fonts are now correctly embedded as shown below:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
IUFVIR+FiraSans CID Type 0C (OT) Identity-H yes yes yes 22 0
DYGETD+FiraSans CID Type 0C (OT) Identity-H yes yes yes 26 0
BKZRLP+FiraSans CID Type 0C (OT) Identity-H yes yes yes 30 0
The pdffonts output looks a bit different to the one shown above in my first post, though, as it does not show the font-weight anymore in the name column and the type and encoding columns also differ. But my PDF looks nice, so I don't care. Thank you for your work! Regards Oliver
thank you for verifying! fix released...
Hello, I recently started using django-weasyprint in a project to produce nice pdf-reports. However, the fonts I declared in my css using
@font-face
rules were not embedded in the final pdf. This is probably due to a missingfont_config
attribute when django-weasyprint instanciates css objects. According to weasyprint docs, you should declare thefont-config
attribute also on css instance when using font-face rules. I tested it by writing a function view that directly uses weasyprint. So I downloaded the latest stable version of django-weasyprint and fixed it locally. I'll create a pull request.The output of
pdffonts
command before the fix:and after the fix:
Regards Oliver