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: Jan Djärv
Subject: bug#12823: Invalid font name
Date: Wed, 7 Nov 2012 17:52:41 +0100

Hello.

From the XLFD-specification 1.5 (http://www.xfree86.org/current/xlfd.pdf):

"Field values are constructed as strings of ISO 8859-1 graphic characters, 
excluding the following:

        • ‘‘−’’ (HYPHEN), the XLFD font name delimiter character

        • ‘‘?’’ (QUESTION MARK) and ‘‘*’’ (ASTERISK), the X protocol font name 
wildcard characters

        • ‘‘,’’ (COMMA), used by Xlib to separate XLFD font names in a font set.

        • ‘‘"’’ (QUOTATION MARK), used by some commercial products to quote a 
font name.

Alphabetic case distinctions are allowed but are for human readability concerns 
only. Conforming X servers will perform matching on font name query or open 
requests independent of case. The entire font name string must have no more 
than 255 characters."

So the use of semi-condensed (for example) is invalid, so we should simply 
remove all entries with "-" in them.

        Jan D.

7 nov 2012 kl. 16:15 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

> Package: Emacs
> Version: 24.3.50
> 
> After letting xft use bitmap fonts on my system, Emacs started to crash,
> which was tracked to an invalid font name that was used
> without checking.
> So I added
> 
>         if (NILP (spec))
>           signal_error ("Invalid font name", ascii_font);
> 
> to x_set_font in revno 110704, but this only prevents the crash,
> replacing it with an error.  Basically the error is that ascii_font is
> not a valid XLFD font name because one of its fields has a "-" in its
> name, and since fields are separated by "-", this leads to a misparse.
> 
> 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?
> 
> 
>        Stefan
> 
> 
> === modified file 'src/font.c'
> --- src/font.c        2012-11-06 03:17:56 +0000
> +++ src/font.c        2012-11-07 15:04:24 +0000
> @@ -102,7 +102,7 @@
>   { 50, { "ultra-condensed", "ultracondensed" }},
>   { 63, { "extra-condensed", "extracondensed" }},
>   { 75, { "condensed", "compressed", "narrow" }},
> -  { 87, { "semi-condensed", "semicondensed", "demicondensed" }},
> +  { 87, { "semicondensed", "semi-condensed", "demicondensed" }},
>   { 100, { "normal", "medium", "regular", "unspecified" }},
>   { 113, { "semi-expanded", "semiexpanded", "demiexpanded" }},
>   { 125, { "expanded" }},
> 
> 
> 






reply via email to

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