bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12823: Invalid font name


From: Kenichi Handa
Subject: bug#12823: Invalid font name
Date: Tue, 13 Nov 2012 20:55:10 +0900

In article <87ip9euaxb.fsf@gnu.org>, Kenichi Handa <handa@gnu.org> writes:
> Yes.  The first elements in those table should match the
> face attribute values for :weight, :width, and :slant (see
> set-face-attribute).  I should have wrote that in the
> comment.

> Could you please try this patch instead?

Oops, sorry, I've sent the wrong version.  Here's the
correct patch.

=== modified file 'src/font.c'
--- src/font.c  2012-11-03 05:11:34 +0000
+++ src/font.c  2012-11-13 11:50:50 +0000
@@ -1185,7 +1185,7 @@
 font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
 {
   char *p;
-  const char *f[XLFD_REGISTRY_INDEX + 1];
+  char *f[XLFD_REGISTRY_INDEX + 1];
   Lisp_Object val;
   int i, j, len;
 
@@ -1234,8 +1234,21 @@
        f[j] = "*";
       else
        {
+         int c, k, l;
+         ptrdiff_t alloc;
+
          val = SYMBOL_NAME (val);
-         f[j] = SSDATA (val);
+         alloc = SBYTES (val) + 1;
+         if (nbytes <= alloc)
+           return -1;
+         f[j] = alloca (alloc);
+         /* Copy the name while excluding '-', '?', ',', and '"'.  */
+         for (k = l = 0; k < alloc; k++)
+           {
+             c = SREF (val, k);
+             if (c != '-' && c != '?' && c != ',' && c != '"')
+               f[j][l++] = c;
+           }
        }
     }
 

---
Kenichi Handa
handa@gnu.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]