Open funkypenguin opened 2 years ago
FWIW I captured the following output..
INFO:weasyprint.progress:Step 2 - Fetching and parsing CSS - https://fonts.googleapis.com/css?family=Ubuntu:3
00,300i,400,400i,700,700i%7CUbuntu+Mono:400,400i,700,700i&display=fallback
WARNING:weasyprint:Ignored `font-display: fallback` at 5:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 12:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 19:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 26:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 33:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 40:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 47:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 54:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 61:3, descriptor not supported.
WARNING:weasyprint:Ignored `font-display: fallback` at 68:3, descriptor not supported.
INFO:weasyprint.progress:Step 2 - Fetching and parsing CSS - CSS string
INFO:weasyprint.progress:Step 2 - Fetching and parsing CSS - file:///docs/site/extras/css/icons.css
INFO:weasyprint.progress:Step 2 - Fetching and parsing CSS - file:///docs/site/assets/stylesheets/extra-style
.o7nwb7x_.min.css
Suspecting my Docker image to be to blame, I setup the toolset on my Mac, and tried again.. the result is the same.. even with the sample material-mkdocs structure from https://github.com/orzih/mkdocs-with-pdf/tree/master/samples/mkdocs-material (I just had to disable the google_analytics config to avoid an error), I get no Roboto font...
@funkypenguin
After running into the same issue, I managed to find part of the problem. Essentially, the font-family
property is not following the nested variables material-mkdocs
uses in their CSS. I've opened an issue with WeasyPrint and you can track the issue's progress here.
Although I've changed the font-family
property to be hard-coded instead of a nested variable, it still only works when using WeasyPrint directly. That is to say, there are still further issues with mkdocs-with-pdf
when generating the PDF for whatever reason.
I'll update this issue if I find the second problem in the meantime.
@Avlyssna can you provide some more details about the workaround you applied? I have exactly the same issue as @funkypenguin - missing text in code blocks.
Btw, I just tried to install the missing font via brew
:
brew install font-roboto
but unfortunately still no success...
This is quite a big issue. Did anyone has a way to mitigate the problem ? This happens only on Windows for me, not Linux.
Here is a workaround. Add a custom style to with_pdf in your ./with_pdf_template/styles.scss
file :
* {
font-family: Verdana, Geneva, Tahoma, sans-serif !important;
}
The important part is !important
:)
@flavienbwk confirm it works, thanks!
@flavienbwk thanks for your workaround. I was a few days going around the same problem. Also for who might end up here looking for answers, when running in a Windows - conda environment. DO NOT install the weasyprint from conda, rather from pip and the required binaries as described in weasyprint installation steps.
Thank you for this amazing plugin! I've been trying to get a good-looking PDF of my mkdocs site working, but I'm struggling with the rendered font.. I've created a Docker image to do the build (below), but TL;DR, when I use your material-mkdocs sample which generates this pdf, and I try to reproduce it with my build image, but I don't seem to have been able to change the font used.
I've had a look at https://github.com/orzih/mkdocs-with-pdf/issues/50, and I've tried manually coping over the Roboto fonts, or installing the Ubuntu font using apk, but in all cases, my PDFs render with the same less-than-attractive font..
What am I missing? :)
Here's the Dockerfile I'm using, BTW: