mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-03 23:48:07 +03:00
Don’t generate PDF with 0-scale transformation matrices for text
This commit is contained in:
parent
ac176a8fd4
commit
2e726a3965
@ -715,6 +715,29 @@ def test_zero_width_character():
|
||||
<div>a‌b</div>''')
|
||||
|
||||
|
||||
def test_font_size_very_small():
|
||||
assert_pixels('font_size_very_small', 10, 4, '''
|
||||
__________
|
||||
__________
|
||||
__________
|
||||
__________
|
||||
''', '''
|
||||
<style>
|
||||
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
|
||||
@page {
|
||||
size: 10px 4px;
|
||||
background: white;
|
||||
margin: 1px;
|
||||
}
|
||||
body {
|
||||
font-family: weasyprint;
|
||||
font-size: 0.00000001px;
|
||||
}
|
||||
</style>
|
||||
test font size zero
|
||||
''')
|
||||
|
||||
|
||||
def test_tabulation_character():
|
||||
# Test regression: https://github.com/Kozea/WeasyPrint/issues/1515
|
||||
assert_pixels('zero_width_character', 10, 4, '''
|
||||
|
@ -1030,6 +1030,10 @@ def draw_emojis(stream, font_size, x, y, emojis):
|
||||
def draw_first_line(stream, textbox, text_overflow, block_ellipsis, x, y,
|
||||
angle=0):
|
||||
"""Draw the given ``textbox`` line to the document ``stream``."""
|
||||
font_size = textbox.style['font_size']
|
||||
if font_size < 1e-6: # Default float precision used by pydyf
|
||||
return []
|
||||
|
||||
pango.pango_layout_set_single_paragraph_mode(
|
||||
textbox.pango_layout.layout, True)
|
||||
|
||||
@ -1072,7 +1076,6 @@ def draw_first_line(stream, textbox, text_overflow, block_ellipsis, x, y,
|
||||
textbox.pango_layout.set_text(new_text + ellipsis)
|
||||
first_line, index = textbox.pango_layout.get_first_line()
|
||||
|
||||
font_size = textbox.style['font_size']
|
||||
utf8_text = textbox.pango_layout.text.encode()
|
||||
previous_utf8_position = 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user