fix font dict formatting

workspace
Brendan Howell 5 years ago
parent ab019f6377
commit a0977f28b9

@ -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)

Loading…
Cancel
Save