emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: x-font-family-list gives incomplete results]


From: Jan D.
Subject: Re: address@hidden: x-font-family-list gives incomplete results]
Date: Sun, 16 Feb 2003 19:39:22 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2a) Gecko/20020910

Richard Stallman wrote:
This seems like an important issue, so I am forwarding the message here.

------- Start of forwarded message -------
To: address@hidden
From: Dave Love <address@hidden>
Date: 20 Jan 2003 18:32:46 +0000
Subject: x-font-family-list gives incomplete results
Sender: address@hidden

`x-font-family-list' misses a lot, specifically fonts which are
suitable for offering the user as the default.  E.g. on a Debian
stable system I have this:

(x-font-family-list)
  => (("clean" . t) ("clearlyu") ("clearlyu alternate glyphs") ("clearlyu arabic extra") ("clearlyu ligature") ("clearlyu pua") ("fangsong ti" . t) ("fixed" . 
t) ("gothic" . t) ("mincho" . t) ("newspaper") ("nil" . t) ("open look cursor") ("open look glyph") ("song ti" . t) ("unifont" . t))

(face-font 'default)
  => "-B&H-LucidaTypewriter-Medium-R-Normal-Sans-12-120-75-75-M-70-ISO8859-1"

Note that the lucidatypewriter I'm actually using isn't listed and I
have 64 families according to xfontsel.

The code implementing this looks superficially correct to me.  Am I
missing something?

There is a bug here.  x-font-family-list does this:

  for (limit = 500;;)
    {
      specbind (intern ("font-list-limit"), make_number (limit));
      nfonts = font_list (f, Qnil, Qnil, Qnil, &fonts);

      if (nfonts == limit)
        {
          free_font_names (fonts, nfonts);
          limit *= 2;
        }
      else
        break;
    }

The problem is that font_list return a filtered list. For instance, duplicates are removed, and scalable fonts may also be removed (see variable scalable-fonts-allowed). If I do

% xlsfonts | wc

I get 9568, but if I do

% xlsfonts | sort -u | wc

I get 5690.

So if there is just one duplicate or if scalable fonts are filtered, x-font-family-list stops increasing limit and stops reading font names.

One alternative solution would be to make maxnames passed to x_list_fonts (xterm.c) mean "get all font names" if it is less than zero. This also affects w32 and mac, since those ports also have a function with this name.

Making maxnames < 0 mean "all font names" should perhaps be propagated into Fx_list_fonts? Now it uses an arbitrary limit of 2000 if maximum is not given, which is too few on many machines.


        Jan D.





reply via email to

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