changeset 91943:c5e5ad126614

(font_unparse_xlfd): Don't ignore integer pixel size specs.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 18 Feb 2008 18:38:49 +0000
parents 1d9856ff9201
children 81d2b4150534
files src/ChangeLog src/font.c
diffstat 2 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Feb 18 15:46:50 2008 +0000
+++ b/src/ChangeLog	Mon Feb 18 18:38:49 2008 +0000
@@ -1,3 +1,7 @@
+2008-02-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font.c (font_unparse_xlfd): Don't ignore integer pixel size specs.
+
 2008-02-18  Jan Dj$(Q)Z(Brv  <jan.h.d@swipnet.se>
 
 	* xfns.c (Fx_show_tip): Set string to " " if empty.
--- a/src/font.c	Mon Feb 18 15:46:50 2008 +0000
+++ b/src/font.c	Mon Feb 18 18:38:49 2008 +0000
@@ -75,7 +75,7 @@
 
 #define CHECK_VALIDATE_FONT_SPEC(x)				\
   do {								\
-    if (! FONT_SPEC_P (x)) x = wrong_type_argument (Qfont, x);	\
+    if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont, x);	\
     x = font_prop_validate (x);					\
   } while (0)
 
@@ -1161,18 +1161,21 @@
   xassert (NUMBERP (val) || NILP (val));
   if (INTEGERP (val))
     {
-      f[XLFD_PIXEL_INDEX] = alloca (22);
-      i = XINT (val);
+      int i = XINT (val);
+      if (i <= 0)
+	i = pixel_size;
       if (i > 0)
-	len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", i) + 1;
-      else if (pixel_size > 0)
-	len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", pixel_size) + 1;
-      f[XLFD_PIXEL_INDEX] = "*-*", len += 4;
+	{
+	  f[XLFD_PIXEL_INDEX] = alloca (22);
+	  len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", i) + 1;
+	}
+      else
+	f[XLFD_PIXEL_INDEX] = "*-*", len += 4;
     }
   else if (FLOATP (val))
     {
+      int i = XFLOAT_DATA (val) * 10;
       f[XLFD_PIXEL_INDEX] = alloca (12);
-      i = XFLOAT_DATA (val) * 10;
       len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1;
     }
   else