mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-04 07:57:52 +03:00
parent
5ebb9db93f
commit
80b88db154
@ -99,6 +99,23 @@ def test_text_font_size_zero():
|
||||
assert paragraph.height == 0
|
||||
|
||||
|
||||
@assert_no_logs
|
||||
def test_text_font_size_very_small():
|
||||
# Test regression: https://github.com/Kozea/WeasyPrint/issues/1499
|
||||
page, = render_pages('''
|
||||
<style>
|
||||
p { font-size: 0.00000001px }
|
||||
</style>
|
||||
<p>test font size zero</p>
|
||||
''')
|
||||
html, = page.children
|
||||
body, = html.children
|
||||
paragraph, = body.children
|
||||
line, = paragraph.children
|
||||
assert line.height < 0.001
|
||||
assert paragraph.height < 0.001
|
||||
|
||||
|
||||
@assert_no_logs
|
||||
def test_text_spaced_inlines():
|
||||
page, = render_pages('''
|
||||
|
@ -91,12 +91,15 @@ class Font:
|
||||
b'/' + self.hash.encode('ascii') + b'+' +
|
||||
self.family.replace(b' ', b''))
|
||||
self.italic_angle = 0 # TODO: this should be different
|
||||
self.ascent = int(
|
||||
pango.pango_font_metrics_get_ascent(pango_metrics) /
|
||||
font_size * 1000)
|
||||
self.descent = -int(
|
||||
pango.pango_font_metrics_get_descent(pango_metrics) /
|
||||
font_size * 1000)
|
||||
if font_size:
|
||||
self.ascent = int(
|
||||
pango.pango_font_metrics_get_ascent(pango_metrics) /
|
||||
font_size * 1000)
|
||||
self.descent = -int(
|
||||
pango.pango_font_metrics_get_descent(pango_metrics) /
|
||||
font_size * 1000)
|
||||
else:
|
||||
self.ascent = self.descent = 0
|
||||
self.upem = harfbuzz.hb_face_get_upem(hb_face)
|
||||
self.png = harfbuzz.hb_ot_color_has_png(hb_face)
|
||||
self.svg = harfbuzz.hb_ot_color_has_svg(hb_face)
|
||||
|
Loading…
Reference in New Issue
Block a user