You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ weasyprint test.html test.pdf
Traceback (most recent call last):
File "/home/anti/.pyenv/versions/crg/bin/weasyprint", line 8, in<module>sys.exit(main())
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/__main__.py", line 214, in main
html.write_pdf(output, **kwargs)
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/__init__.py", line 180, in write_pdf
self.render(
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/document.py", line 1160, in write_pdf
page.paint(stream, scale=scale)
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/document.py", line 769, in paint
draw_page(self._page_box, stream)
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/draw.py", line 69, in draw_page
draw_stacking_context(stream, stacking_context)
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/draw.py", line 182, in draw_stacking_context
draw_stacking_context(stream, child_context)
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/draw.py", line 177, in draw_stacking_context
draw_inline_level(
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/draw.py", line 960, in draw_inline_level
draw_inline_level(
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/draw.py", line 957, in draw_inline_level
draw_text(
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/draw.py", line 985, in draw_text
draw_first_line(stream, textbox, text_overflow, block_ellipsis, x, y)
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/draw.py", line 1090, in draw_first_line
font = stream.add_font(font_hash, file_content, pango_font, index)
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/document.py", line 217, in add_font
self._document.fonts[font_hash] = Font(
File "/home/anti/.pyenv/versions/crg/lib/python3.9/site-packages/weasyprint/document.py", line 92, in __init__
pango.pango_font_metrics_get_ascent(pango_metrics) /
ZeroDivisionError: division by zero
This problem shouldn’t happen, unless you use a very small font size (< 1 / 1024 px), or there’s a problem with the font used (probably the default monospace font in your case).
At least, now, we don’t crash.
But… Your text will probably not be displayed. Maybe installing monospace fonts will help. If you can’t find a solution, don’t hesitate to add a comment here.
liZe
added
bug
Existing features not working as expected
crash
Problems preventing documents from being rendered
and removed
bug
Existing features not working as expected
labels
Nov 29, 2021
WeasyPrint fails to render following document:
poc
version info
$ weasyprint -i System: Linux Machine: x86_64 Version: #1 SMP Fri, 12 Nov 2021 19:04:00 +0000 Release: 5.10.79-1-lts WeasyPrint version: 53.4 Python version: 3.9.7 Pydyf version: 0.1.2 Pango version: 14810
Works fine with 52.5 version:
$ weasyprint -i System: Linux Machine: x86_64 Version: #1 SMP Fri, 12 Nov 2021 19:04:00 +0000 Release: 5.10.79-1-lts WeasyPrint version: 52.5 Python version: 3.9.7 Cairo version: 11704 Pango version: 14810 CairoSVG version: 2.5.2
The text was updated successfully, but these errors were encountered: