changeset 95104:ae4280e6a166

(font_list_entities): Fix handling of cache. (font_matching_entity): Likewise.
author Kenichi Handa <handa@m17n.org>
date Mon, 19 May 2008 07:22:45 +0000
parents 974543f59c33
children 599666b2ea00
files src/font.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/font.c	Mon May 19 07:21:25 2008 +0000
+++ b/src/font.c	Mon May 19 07:22:45 2008 +0000
@@ -2352,7 +2352,7 @@
     size = 0;
 
   ftype = AREF (spec, FONT_TYPE_INDEX);
-  for (i = 0; i <= FONT_REGISTRY_INDEX; i++)
+  for (i = 1; i <= FONT_REGISTRY_INDEX; i++)
     ASET (scratch_font_spec, i, AREF (spec, i));
   for (; i < FONT_EXTRA_INDEX; i++)
     {
@@ -2377,7 +2377,7 @@
 	  {
 	    Lisp_Object val = assoc_no_quit (scratch_font_spec, XCDR (cache));
 
-	    if (CONSP (val) && VECTORP (XCDR (val)))
+	    if (CONSP (val))
 	      val = XCDR (val);
 	    else
 	      {
@@ -2430,16 +2430,18 @@
 	&& (NILP (ftype) || EQ (driver_list->driver->type, ftype)))
       {
 	Lisp_Object cache = font_get_cache (f, driver_list->driver);
+	Lisp_Object copy;
 
 	ASET (spec, FONT_TYPE_INDEX, driver_list->driver->type);
 	entity = assoc_no_quit (spec, XCDR (cache));
-	if (CONSP (entity) && ! VECTORP (XCDR (entity)))
+	if (CONSP (entity))
 	  entity = XCDR (entity);
 	else
 	  {
 	    entity = driver_list->driver->match (frame, spec);
-	    XSETCDR (cache, Fcons (Fcons (Fcopy_font_spec (spec), entity),
-				   XCDR (cache)));
+	    copy = Fcopy_font_spec (spec);
+	    ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
+	    XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
 	  }
 	if (! NILP (entity))
 	  break;