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: Fri, 09 Nov 2012 23:07:44 +0900

In article <jwvpq3p78ch.fsf@iro.umontreal.ca>, Stefan Monnier 
<monnier@iro.umontreal.ca> writes:

> Now, this invalid name was built by Emacs, probably in
> font_unparse_xlfd.  The appended patch fixes my problem.

> So now the question is: should we reorder all the entries in the
> width_table, slant_table, and weight_table so that the first entry of
> every line is a non-dashed name?  Or could this have undesirable effects?

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?

---
Kenichi Handa
handa@gnu.org


=== modified file 'src/font.c'
--- src/font.c  2012-11-03 05:11:34 +0000
+++ src/font.c  2012-11-09 14:05:15 +0000
@@ -1234,8 +1234,19 @@
        f[j] = "*";
       else
        {
+         int c, k, l;
+
          val = SYMBOL_NAME (val);
-         f[j] = SSDATA (val);
+         len = SBYTES (val);
+         f[j] = alloca (len + 1);
+         /* Copy the name while excluding '-', '?', ',', and '"'.  */
+         for (k = l = 0; k < len; k++)
+           {
+             c = SREF (val, k);
+             if (c != '-' && c != '?' && c != ',' && c != '"')
+               f[l++] = c;
+           }
+         f[l] = '\0';
        }
     }
 






reply via email to

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