changeset 104107:6a6fc6d5dad8

* nsfont.m (ns_findfonts): Fix 2009-07-24 change to return only one element, not a list, for match case.
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Wed, 29 Jul 2009 16:03:12 +0000
parents a08492c7c062
children 77ca9099315d
files src/ChangeLog src/nsfont.m
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Jul 29 15:26:21 2009 +0000
+++ b/src/ChangeLog	Wed Jul 29 16:03:12 2009 +0000
@@ -1,3 +1,8 @@
+2009-07-29  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+	* nsfont.m (ns_findfonts): Fix 2009-07-24 change to return only one
+	element, not a list, for match case.
+
 2009-07-28  Kenichi Handa  <handa@m17n.org>
 
 	* font.c (font_parse_xlfd): Check DPI and AVGWIDTH properties more
--- a/src/nsfont.m	Wed Jul 29 15:26:21 2009 +0000
+++ b/src/nsfont.m	Wed Jul 29 16:03:12 2009 +0000
@@ -464,7 +464,7 @@
     /* If has non-unicode registry, give up. */
     tem = AREF (font_spec, FONT_REGISTRY_INDEX);
     if (! NILP (tem) && !EQ (tem, Qiso10646_1) && !EQ (tem, Qunicode_bmp))
-	return isMatch ? Fcons (ns_fallback_entity (), list) : Qnil;
+	return isMatch ? ns_fallback_entity () : Qnil;
 
     cFamilies = ns_get_covering_families (ns_get_req_script (font_spec), 0.90);
 
@@ -483,9 +483,12 @@
 	if (![cFamilies containsObject:
 	         [desc objectForKey: NSFontFamilyAttribute]])
 	    continue;
-	list = Fcons (ns_descriptor_to_entity (desc,
+        tem = ns_descriptor_to_entity (desc,
 					 AREF (font_spec, FONT_EXTRA_INDEX),
-					 NULL), list);
+                                       NULL);
+        if (isMatch)
+          return tem;
+	list = Fcons (tem, list);
 	if (fabs (ns_attribute_fvalue (desc, NSFontSlantTrait)) > 0.05)
 	    foundItal = YES;
       }
@@ -503,8 +506,8 @@
       }
 
     /* Return something if was a match and nothing found. */
-    if (isMatch && XINT (Flength (list)) == 0)
-      list = Fcons (ns_fallback_entity (), Qnil);
+    if (isMatch)
+      return ns_fallback_entity ();
 
     if (NSFONT_TRACE)
 	fprintf (stderr, "    Returning %d entities.\n", XINT (Flength (list)));