diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index c2ad810..e2db59f 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -354,20 +354,19 @@ class Bureau(object): # TODO: make paper size a config variable pdfpath = tempfile.mkstemp(".pdf")[1] self.log.debug("rendering to: " + pdfpath) + + # manually add local fonts fontconfig = FontConfiguration() fontsdir = os.path.join(self.mdir, "fonts") - self.log.debug(fontsdir) + fontlist = [] for font in glob.glob(fontsdir + "/*.otf"): - fdict = {} - fdict["src"] = ("local", "file://" + font) + fontlist.append(("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"): - fdict = {} - fdict["src"] = ("local", "file://" + font) + fontlist.append(("local", "file://" + font)) self.log.debug("adding font " + str(fdict)) - fontconfig.add_font_face(fdict, + fdict["src"] = fontlist + 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)