all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 3081@emacsbugs.donarmstrong.com
Subject: bug#3081: 23.0.92; x-list-fonts no longer gives correct result - substitutes * forfixed font size
Date: Thu, 23 Apr 2009 20:26:21 +0900	[thread overview]
Message-ID: <E1Lwx4P-0005v2-Sc@etlken> (raw)
In-Reply-To: <003001c9c3d0$9a15bea0$0200a8c0@us.oracle.com> (drew.adams@oracle.com)

In article <003001c9c3d0$9a15bea0$0200a8c0@us.oracle.com>, "Drew Adams" <drew.adams@oracle.com> writes:

> > > I have this defcustom, which I use to choose a small font:
> > > (defcustom palette-font
> > >   (and window-system
> > >        (or (car (x-list-fonts
> > >   "-*-Courier-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1)) ; 1
> > >            (car (x-list-fonts 
> > "-*-fixed-*-*-*-*-5-*-*-*-*-*-iso8859-1"
> > >   nil nil 1)) ; 2
> > >            (car (x-list-fonts
> > >   "-*-Terminal-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1)) ; 3
> > >            (car (x-list-fonts 
> > "-*-*-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil
> > >   nil 1)))) ;4
> > >   "...")
> > [...]
> > > In Emacs 23, these are the values:
> >  
> > > 1. 
> > ("-outline-Courier-bold-normal-normal-mono-*-*-*-*-c-*-iso8859-1")
> > > 2. nil
> > > 3. nil
> > > 4. ("-outline-Lucida Sans
> > > Typewriter-bold-normal-normal-sans-*-*-*-*-c-*-iso8859-1")
> >  
> > > The first difference to notice is #4: a completely different font
> > > family is used. Why should this be? Anyway, I don't really have a
> > > problem with this.
> >  
> > If you don't specify a family, which family is selected is
> > completely arbitrary.

> I guess you're speaking about #2 and #3 - the nil values. That's OK. (And thanks
> for the explanation.)

No, I'm speaking about #4.  In #2 and #3 you specify family
name ("fixed" and "terminal" respectively).

> > > The problem is that the font size is not correct: * instead 
> > > of a real font size.  The whole point of this defcustom is to try to find a
> > > default value for the option that provides a tiny font that the user
> > > has available. It tries to match various fonts of size 5, until it
> > > finds a match.
> >  
> > I installed a fix.  Please try again.

> Thanks for the quick fix.

> What do I need to pick up, to try it? Is this a Lisp fix (which library)? 

No, the change was in src/xfaces.c.

2009-04-23  Kenichi Handa  <handa@m17n.org>

	* xfaces.c (Fx_list_fonts): If a font size is specified in
	PATTERN, set it in returned scalable fonts.

Index: xfaces.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfaces.c,v
retrieving revision 1.432
retrieving revision 1.433
diff -u -r1.432 -r1.433
--- xfaces.c	16 Apr 2009 01:08:24 -0000	1.432
+++ xfaces.c	23 Apr 2009 01:33:33 -0000	1.433
@@ -1904,7 +1904,22 @@
       }
     args[0] = Flist_fonts (font_spec, frame, maximum, font_spec);
     for (tail = args[0]; CONSP (tail); tail = XCDR (tail))
-      XSETCAR (tail, Ffont_xlfd_name (XCAR (tail), Qnil));
+      {
+	Lisp_Object font_entity;
+
+	font_entity = XCAR (tail);
+	if ((NILP (AREF (font_entity, FONT_SIZE_INDEX))
+	     || XINT (AREF (font_entity, FONT_SIZE_INDEX)) == 0)
+	    && ! NILP (AREF (font_spec, FONT_SIZE_INDEX)))
+	  {
+	    /* This is a scalable font.  For backward compatibility,
+	       we set the specified size. */
+	    font_entity = Fcopy_font_spec (font_entity);
+	    ASET (font_entity, FONT_SIZE_INDEX,
+		  AREF (font_spec, FONT_SIZE_INDEX));
+	  }
+	XSETCAR (tail, Ffont_xlfd_name (font_entity, Qnil));
+      }
     if (NILP (frame))
       /* We don't have to check fontsets.  */
       return args[0];


---
Kenichi Handa
handa@m17n.org






  reply	other threads:[~2009-04-23 11:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-22 17:03 bug#3081: 23.0.92; x-list-fonts no longer gives correct result - substitutes * for fixed font size Drew Adams
2009-04-22 17:36 ` bug#3081: 23.0.92; x-list-fonts no longer gives correct result - substitutes * forfixed " Drew Adams
2009-04-23  2:07 ` bug#3081: 23.0.92; x-list-fonts no longer gives correct result - substitutes * for fixed " Kenichi Handa
2009-04-23  5:01   ` bug#3081: 23.0.92; x-list-fonts no longer gives correct result - substitutes * forfixed " Drew Adams
2009-04-23 11:26     ` Kenichi Handa [this message]
2009-04-23 13:58       ` Drew Adams

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

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

  git send-email \
    --in-reply-to=E1Lwx4P-0005v2-Sc@etlken \
    --to=handa@m17n.org \
    --cc=3081@emacsbugs.donarmstrong.com \
    --cc=drew.adams@oracle.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.