diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-22 11:53:15 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-22 11:53:15 +0100 |
commit | 98330dc9464729ea29d7e3624f1247094ca24de8 (patch) | |
tree | 3eed40435787df689ba25d1e89376783e2b428fd /src/styleengine.cc | |
parent | ce65f174e3569b35f09ea475f9ddad2aa8ebd360 (diff) |
improve font handling
The vw_fontname and fw_fontname preferences are now used to define the
CSS fontanmes "sans" and "monospace".
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r-- | src/styleengine.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc index fbf9c8ee..d5089d71 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -30,7 +30,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) { Node *n = stack->getRef (stack->size () - 1); /* Create a dummy font, attribute, and tag for the bottom of the stack. */ - font_attrs.name = "helvetica"; + font_attrs.name = prefs.vw_fontname; font_attrs.size = (int) (14 * prefs.font_factor + 0.5); font_attrs.weight = CssProperty::CSS_FONT_WEIGHT_NORMAL; font_attrs.style = FONT_STYLE_NORMAL; @@ -170,7 +170,15 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { switch (p->name) { case CssProperty::CSS_PROPERTY_FONT_FAMILY: - fontAttrs.name = p->value.strVal; + // \todo memory management of font name strings + // \todo handle comma separated lists of font names + // \todo handle sans-serif, cursive, fantasy + if (strcmp (p->value.strVal, "sans") == 0) + fontAttrs.name = prefs.vw_fontname; + else if (strcmp (p->value.strVal, "monospace") == 0) + fontAttrs.name = prefs.fw_fontname; + else + fontAttrs.name = p->value.strVal; break; case CssProperty::CSS_PROPERTY_FONT_SIZE: parentFont = stack->get (stack->size () - 2).style->font; |