diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-11-08 15:23:21 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-11-08 15:23:21 +0100 |
commit | 79a3a198352597ceda154ce3a5c93373967ab5bf (patch) | |
tree | 09a307efda9ae672f0336b17caff4fe7892bbd96 /src/styleengine.cc | |
parent | 8ab7dd2af3b0230112fbdd552f9461dda6371cea (diff) |
support CSS_FONT_WEIGHT_LIGHTER and CSS_FONT_WEIGHT_BOLDER
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r-- | src/styleengine.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc index 9123007e..c1b4f718 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -120,7 +120,20 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { fontAttrs.style = (FontStyle) p->value.intVal; break; case CssProperty::CSS_PROPERTY_FONT_WEIGHT: - fontAttrs.weight = p->value.intVal; + switch (p->value.intVal) { + case CssProperty::CSS_FONT_WEIGHT_LIGHTER: + fontAttrs.weight -= CssProperty::CSS_FONT_WEIGHT_STEP; + break; + case CssProperty::CSS_FONT_WEIGHT_BOLDER: + fontAttrs.weight += CssProperty::CSS_FONT_WEIGHT_STEP; + break; + default: + fontAttrs.weight = p->value.intVal; + } + if (fontAttrs.weight < CssProperty::CSS_FONT_WEIGHT_MIN) + fontAttrs.weight = CssProperty::CSS_FONT_WEIGHT_MIN; + if (fontAttrs.weight > CssProperty::CSS_FONT_WEIGHT_MAX) + fontAttrs.weight = CssProperty::CSS_FONT_WEIGHT_MAX; break; case CssProperty::CSS_PROPERTY_LIST_STYLE_TYPE: attrs->listStyleType = (ListStyleType) p->value.intVal; |