1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00

Add 'font-stretch' in the 'font' shorthand.

This commit is contained in:
Simon Sapin 2013-09-09 21:14:30 +01:00
parent f7c363e546
commit 75cdc9baef
2 changed files with 5 additions and 2 deletions

View File

@ -1542,7 +1542,7 @@ def expand_background(base_url, name, tokens):
@expander('font')
@generic_expander('-style', '-variant', '-weight', '-size',
@generic_expander('-style', '-variant', '-weight', '-stretch', '-size',
'line-height', '-family') # line-height is not a suffix
def expand_font(name, tokens):
"""Expand the ``font`` shorthand property.
@ -1572,6 +1572,8 @@ def expand_font(name, tokens):
suffix = '-variant'
elif font_weight([token]) is not None:
suffix = '-weight'
elif font_stretch([token]) is not None:
suffix = '-stretch'
else:
# Were done with these three, continue with font-size
break

View File

@ -475,8 +475,9 @@ def test_font():
'font_size': 'large',
'font_family': ['serif'],
}
assert expand_to_dict('font: small-caps normal 700 large serif') == {
assert expand_to_dict('font: small-caps condensed normal 700 large serif') == {
#'font_style': 'normal', XXX shouldnt this be here?
'font_stretch': 'condensed',
'font_variant': 'small-caps',
'font_weight': 700,
'font_size': 'large',