mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 00:21:15 +03:00
Bugfixes
This commit is contained in:
parent
fe6182b4a3
commit
67bb96ea06
@ -706,6 +706,8 @@ def expand_font(name, values):
|
|||||||
|
|
||||||
# Then line-height is optional, but font-family is not so the list
|
# Then line-height is optional, but font-family is not so the list
|
||||||
# must not be empty yet
|
# must not be empty yet
|
||||||
|
if not values:
|
||||||
|
raise InvalidValues
|
||||||
|
|
||||||
value = values.pop()
|
value = values.pop()
|
||||||
if line_height([value]) is not None:
|
if line_height([value]) is not None:
|
||||||
|
@ -79,6 +79,8 @@ def skip_first_whitespace(box, skip_stack):
|
|||||||
return index, None
|
return index, None
|
||||||
|
|
||||||
if isinstance(box, (boxes.LineBox, boxes.InlineBox)):
|
if isinstance(box, (boxes.LineBox, boxes.InlineBox)):
|
||||||
|
if index == 0 and not box.children:
|
||||||
|
return None
|
||||||
result = skip_first_whitespace(box.children[index], next_skip_stack)
|
result = skip_first_whitespace(box.children[index], next_skip_stack)
|
||||||
if result == 'continue':
|
if result == 'continue':
|
||||||
index += 1
|
index += 1
|
||||||
|
@ -722,7 +722,9 @@ def test_page_and_linebox_breaking():
|
|||||||
@page { size: 100px; margin:2px; border:1px solid }
|
@page { size: 100px; margin:2px; border:1px solid }
|
||||||
body { margin: 0 }
|
body { margin: 0 }
|
||||||
</style>
|
</style>
|
||||||
<div>%(content)s</div>'''
|
<div><span/>%(content)s</div>'''
|
||||||
|
# The empty <span/> above tests a corner case
|
||||||
|
# in skip_first_whitespace()
|
||||||
page = page % {'fonts': FONTS, 'content': content}
|
page = page % {'fonts': FONTS, 'content': content}
|
||||||
return parse(page)
|
return parse(page)
|
||||||
|
|
||||||
|
@ -43,8 +43,12 @@ class TextFragment(object):
|
|||||||
attributes = dict(
|
attributes = dict(
|
||||||
# TODO: somehow handle color.alpha
|
# TODO: somehow handle color.alpha
|
||||||
color='#%02x%02x%02x' % (color.red, color.green, color.blue),
|
color='#%02x%02x%02x' % (color.red, color.green, color.blue),
|
||||||
face=', '.join(style.font_family),
|
# Other than 'face', values are numbers or known keyword and don’t
|
||||||
variant=style.font_variant,
|
# need escaping.
|
||||||
|
face=', '.join(style.font_family)
|
||||||
|
.replace('&', '&').replace('"', '"'),
|
||||||
|
# CSS: small-caps, Pango: smallcaps
|
||||||
|
variant=style.font_variant.replace('-', ''),
|
||||||
style=style.font_style,
|
style=style.font_style,
|
||||||
size=Pango.units_from_double(style.font_size),
|
size=Pango.units_from_double(style.font_size),
|
||||||
weight=int(style.font_weight),
|
weight=int(style.font_weight),
|
||||||
|
Loading…
Reference in New Issue
Block a user