aboutsummaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-11-15 12:38:41 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-11-15 12:38:41 +0100
commitb657f3dc1619014e78d245f92cb5fa665fde2644 (patch)
tree465a567ef1b4fc0bc7a93f3311b6d3d6b71f05ba /src/styleengine.cc
parentc1faf29565bf21537e06dc02a6c7370b8f67a567 (diff)
use first font name in comma separated list in StyleEngine
This is just a bandaid until we find a way to test whether a given font exists on the system.
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r--src/styleengine.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc
index 8636a8a0..b1bddcec 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -204,6 +204,7 @@ void StyleEngine::endElement (int element) {
void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) {
FontAttrs fontAttrs = *attrs->font;
Font *parentFont = stack->get (stack->size () - 2).style->font;
+ char *c;
/* Determine font first so it can be used to resolve relative lenths.
* \todo Things should be rearranged so that just one pass is necessary.
@@ -214,6 +215,11 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) {
switch (p->name) {
case CSS_PROPERTY_FONT_FAMILY:
// \todo handle comma separated lists of font names
+ // for now simply use the first name in the list
+ if ((c = strchr(p->value.strVal, ',')))
+ *c = '\0';
+ p->value.strVal = dStrstrip(p->value.strVal);
+
if (strcmp (p->value.strVal, "serif") == 0)
fontAttrs.name = prefs.font_serif;
else if (strcmp (p->value.strVal, "sans-serif") == 0)