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
|
||||
# must not be empty yet
|
||||
if not values:
|
||||
raise InvalidValues
|
||||
|
||||
value = values.pop()
|
||||
if line_height([value]) is not None:
|
||||
|
@ -79,6 +79,8 @@ def skip_first_whitespace(box, skip_stack):
|
||||
return index, None
|
||||
|
||||
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)
|
||||
if result == 'continue':
|
||||
index += 1
|
||||
|
@ -722,7 +722,9 @@ def test_page_and_linebox_breaking():
|
||||
@page { size: 100px; margin:2px; border:1px solid }
|
||||
body { margin: 0 }
|
||||
</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}
|
||||
return parse(page)
|
||||
|
||||
|
@ -43,8 +43,12 @@ class TextFragment(object):
|
||||
attributes = dict(
|
||||
# TODO: somehow handle color.alpha
|
||||
color='#%02x%02x%02x' % (color.red, color.green, color.blue),
|
||||
face=', '.join(style.font_family),
|
||||
variant=style.font_variant,
|
||||
# Other than 'face', values are numbers or known keyword and don’t
|
||||
# need escaping.
|
||||
face=', '.join(style.font_family)
|
||||
.replace('&', '&').replace('"', '"'),
|
||||
# CSS: small-caps, Pango: smallcaps
|
||||
variant=style.font_variant.replace('-', ''),
|
||||
style=style.font_style,
|
||||
size=Pango.units_from_double(style.font_size),
|
||||
weight=int(style.font_weight),
|
||||
|
Loading…
Reference in New Issue
Block a user