unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan D." <jan.h.d@swipnet.se>
Cc: rms@gnu.org
Subject: Re: [d.love@dl.ac.uk: x-font-family-list gives incomplete results]
Date: Sun, 16 Feb 2003 19:39:22 +0100	[thread overview]
Message-ID: <3E4FDADA.3040105@swipnet.se> (raw)
In-Reply-To: E18bHfR-0002Pm-00@fencepost.gnu.org

Richard Stallman wrote:
> This seems like an important issue, so I am forwarding the message here.
> 
> ------- Start of forwarded message -------
> To: bug-gnu-emacs@gnu.org
> From: Dave Love <d.love@dl.ac.uk>
> Date: 20 Jan 2003 18:32:46 +0000
> Subject: x-font-family-list gives incomplete results
> Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
> 
> `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	other threads:[~2003-02-16 18:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-22  9:59 [d.love@dl.ac.uk: x-font-family-list gives incomplete results] Richard Stallman
2003-02-16 18:39 ` Jan D. [this message]
2003-02-16 19:20   ` Jan D.
2003-02-16 22:30     ` Jason Rumney
2003-02-18 21:30       ` Jan D.
2003-02-18 16:49     ` Dave Love
2003-02-18 21:31       ` Jan D.
2003-02-19  2:35     ` Kenichi Handa
2003-02-19  5:58       ` Jan D.
2003-02-19  6:15         ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E4FDADA.3040105@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).