Fonts not embedded in PDF
See original GitHub issueHi, i was using weasyprint 52.2 with python 3.8 on fedora32. After upgrading to fedora33, my fonts are not embedded into the resulting pdf any more. fedora33 uses python 3.9, i also upgraded to weasyprint 52.4… no change to the result.
What i did so far:
- using weasyprint standalone (this is my main usage)
weasyprint in.html out.pdf
A pdf is generated, embedded fonts missing
- using weasyprint as python script
from weasyprint import HTML, CSS
from weasyprint.fonts import FontConfiguration
font_config = FontConfiguration()
html=HTML('in.md.html')
html.write_pdf('out.pdf',font_config=font_config)
same result, no fonts in pdf
My Html uses an external css with @font-face e.g.
@font-face {
font-family: mySerif;
font-weight: normal;
font-style: normal;
font-stretch: normal;
src: local('Liberation Serif'),
url(file:///usr/share/fonts/liberation-serif/LiberationSerif-Regular.ttf) format('truetype');
}
The browser has no problems rendering my embedded fonts, neither did weasyprint on fedora32/py3.8 (if that matters at all…) So, my old working pdf output had these fonts (successfully embedded)
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
AOAFFM+LiberationSerif TrueType WinAnsi yes yes yes 36 0
VZUWYF+LiberationSerif CID TrueType Identity-H yes yes yes 37 0
DIVSUD+RobotoMono-Regular TrueType WinAnsi yes yes yes 84 0
JPSGLH+CairoFont-2-0 Type 1C WinAnsi yes yes yes 85 0
HNYAUK+RobotoMono-Bold TrueType WinAnsi yes yes yes 112 0
IQFZUN+RobotoMono-Regular TrueType WinAnsi yes yes yes 113 0
The new one has only these default fonts:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
ANQKNJ+BitstreamVeraSans-Roman TrueType WinAnsi yes yes yes 37 0
JBCTMJ+DejaVuSans CID TrueType Identity-H yes yes yes 38 0
XMKNHA+BitstreamVeraSans-Roman CID TrueType Identity-H yes yes yes 83 0
YNMLOL+BitstreamVeraSans-Bold TrueType WinAnsi yes yes yes 84 0
EZEEOY+BitstreamVeraSans-Oblique TrueType WinAnsi yes yes yes 122 0
I had a (one!) font embedded into my pdf when using
weasyprint -v ${filename}.md.html ${filename}.md.pdf -s <(echo 'body { font-family: 'Liberation Serif' !important }')
with this font list:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
MNDGRP+LiberationSerif TrueType WinAnsi yes yes yes 37 0
RLFUEA+LiberationSerif CID TrueType Identity-H yes yes yes 38 0
AFSQCL+BitstreamVeraSans-Roman TrueType WinAnsi yes yes yes 39 0
WKPJBS+LiberationSerif-Bold TrueType WinAnsi yes yes yes 87 0
YTXGBQ+BitstreamVeraSans-Bold TrueType WinAnsi yes yes yes 114 0
EZEEOY+BitstreamVeraSans-Oblique TrueType WinAnsi yes yes yes 115 0
Overriding with user styelsheets and !important
cannot be the solution…
I’m running out of ideas for now, any help?
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (7 by maintainers)
you’re my hero!!! Thanks for pointing to the patch, appllied it and we’re back to ‘normal’ again!!
@liZe Thanks for bringing this to my attention. I recently got an automated notification that WeasyPrint’s test suite has even more test failures in Fedora but I did not have time to debug this.