add support for ttf fonts

workspace
Brendan Howell 5 years ago
parent 15639c7aa5
commit 508ef56899

@ -359,6 +359,10 @@ class Bureau(object):
for font in glob.glob(fontsdir + ".otf"):
fontconfig.add_font_face("file://" + font,
weasyprint.default_url_fetcher)
for font in glob.glob(fontsdir + ".ttf"):
self.log.debug("adding font " + "file://" + font)
fontconfig.add_font_face("file://" + font,
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