aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong <[email protected]>2008-06-16 14:35:24 +0000
committerChong Yidong <[email protected]>2008-06-16 14:35:24 +0000
commit77989187bfa399f1300260893767ee6ed91e02d6 (patch)
tree53430335382a46e1522ab7d2e5827210b0161e85 /src
parentd756bcd0476d1a538681bd6d4839cb7ded9b86e9 (diff)
(font_parse_fcname): Fix handling of unknown-spec string.
Diffstat (limited to 'src')
-rw-r--r--src/font.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/font.c b/src/font.c
index 5ee4d3a7e8..420548171e 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1407,9 +1407,9 @@ font_parse_fcname (name, font)
/* Now parse ":KEY=VAL" patterns. Store known keys and values in
extra, copy unknown ones to COPY. It is stored in extra slot by
the key QCfc_unknown_spec. */
- char *copy;
+ char *copy_start, *copy;
- name = copy = alloca (name + len - props_beg);
+ copy_start = copy = alloca (name + len - props_beg);
if (! copy)
return -1;
@@ -1467,10 +1467,11 @@ font_parse_fcname (name, font)
key = font_intern_prop (p, q - p, 1);
prop = get_font_prop_index (key);
}
+
p = q + 1;
for (q = p; *q && *q != ':'; q++);
-
val = font_intern_prop (p, q - p, 0);
+
if (! NILP (val))
{
if (prop >= FONT_FOUNDRY_INDEX
@@ -1480,15 +1481,19 @@ font_parse_fcname (name, font)
else if (prop >= 0)
Ffont_put (font, key, val);
else
- bcopy (keyhead, copy, q - keyhead);
- copy += q - keyhead;
+ {
+ if (copy_start != copy)
+ *copy++ = ':';
+ bcopy (keyhead, copy, q - keyhead);
+ copy += q - keyhead;
+ }
}
}
p = *q ? q + 1 : q;
}
- if (name != copy)
+ if (copy_start != copy)
font_put_extra (font, QCfc_unknown_spec,
- make_unibyte_string (name, copy - name));
+ make_unibyte_string (copy_start, copy - copy_start));
}
}
else