From a0977f28b9163b0a186e8f3b9d2e9a13982942f9 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Thu, 19 Dec 2019 15:47:06 +0100 Subject: [PATCH] fix font dict formatting --- screenless/bureau/bureau.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index 492a1ed..c2ad810 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -358,12 +358,16 @@ class Bureau(object): fontsdir = os.path.join(self.mdir, "fonts") self.log.debug(fontsdir) for font in glob.glob(fontsdir + "/*.otf"): - self.log.debug("adding font " + "file://" + font) - fontconfig.add_font_face("file://" + font, + fdict = {} + fdict["src"] = ("local", "file://" + font) + self.log.debug("adding font " + str(fdict)) + fontconfig.add_font_face(fdict, weasyprint.default_url_fetcher) for font in glob.glob(fontsdir + "/*.ttf"): - self.log.debug("adding font " + "file://" + font) - fontconfig.add_font_face("file://" + font, + fdict = {} + fdict["src"] = ("local", "file://" + font) + self.log.debug("adding font " + str(fdict)) + fontconfig.add_font_face(fdict, weasyprint.default_url_fetcher) weasyprint.HTML(string=templ.render_unicode(**kwargs)).write_pdf(pdfpath, font_config=fontconfig) subprocess.call("lpr -o sides=two-sided-long-edge -o InputSlot=Upper " + pdfpath, shell=True)