diff --git a/weblate_web/pdf.py b/weblate_web/pdf.py index d791d7a5f8..244bea121d 100644 --- a/weblate_web/pdf.py +++ b/weblate_web/pdf.py @@ -59,19 +59,11 @@ def render_pdf(*, html: str, output: Path) -> None: string=html, url_fetcher=url_fetcher, ) + fonts_css = finders.find("pdf/fonts.css") + if fonts_css is None: + raise ValueError("Could not load fonts CSS") font_style = CSS( - string=""" - @font-face { - font-family: Source Sans Pro; - font-weight: 400; - src: url("static:vendor/font-source/TTF/SourceSans3-Regular.ttf"); - } - @font-face { - font-family: Source Sans Pro; - font-weight: 700; - src: url("static:vendor/font-source/TTF/SourceSans3-Bold.ttf"); - } - """, + filename=fonts_css, font_config=font_config, url_fetcher=url_fetcher, ) diff --git a/weblate_web/static/pdf/fonts.css b/weblate_web/static/pdf/fonts.css new file mode 100644 index 0000000000..2c68cfd68c --- /dev/null +++ b/weblate_web/static/pdf/fonts.css @@ -0,0 +1,10 @@ +@font-face { + font-family: Source Sans Pro; + font-weight: 400; + src: url("static:vendor/font-source/TTF/SourceSans3-Regular.ttf"); +} +@font-face { + font-family: Source Sans Pro; + font-weight: 700; + src: url("static:vendor/font-source/TTF/SourceSans3-Bold.ttf"); +}