changeset 96016:c1105df0f9c8

(font_parse_fcname): Fix handling of unknown-spec string.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 16 Jun 2008 14:35:24 +0000
parents 045ef67cb49e
children 54d310663505
files src/font.c
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/font.c	Mon Jun 16 14:35:02 2008 +0000
+++ b/src/font.c	Mon Jun 16 14:35:24 2008 +0000
@@ -1407,9 +1407,9 @@
 	  /* 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;
-
-	  name = copy = alloca (name + len - props_beg);
+	  char *copy_start, *copy;
+
+	  copy_start = copy = alloca (name + len - props_beg);
 	  if (! copy)
 	    return -1;
 
@@ -1467,10 +1467,11 @@
 		      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 @@
 		      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