From 75cdc9baef37775ac124a0b17082c1dcaa87a58f Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 9 Sep 2013 21:14:30 +0100 Subject: [PATCH] Add 'font-stretch' in the 'font' shorthand. --- weasyprint/css/validation.py | 4 +++- weasyprint/tests/test_css_validation.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/weasyprint/css/validation.py b/weasyprint/css/validation.py index 1d7ba76a..1e3a8aa6 100644 --- a/weasyprint/css/validation.py +++ b/weasyprint/css/validation.py @@ -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: # We’re done with these three, continue with font-size break diff --git a/weasyprint/tests/test_css_validation.py b/weasyprint/tests/test_css_validation.py index 49c15570..9392c32f 100644 --- a/weasyprint/tests/test_css_validation.py +++ b/weasyprint/tests/test_css_validation.py @@ -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 shouldn’t this be here? + 'font_stretch': 'condensed', 'font_variant': 'small-caps', 'font_weight': 700, 'font_size': 'large',