unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Mauger <mmaug@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: char-displayable-p issue
Date: Wed, 22 Oct 2003 12:09:50 -0700 (PDT)	[thread overview]
Message-ID: <20031022190950.32420.qmail@web60304.mail.yahoo.com> (raw)

--- Michael Mauger <mmaug@yahoo.com> wrote:
> --- Kenichi Handa <handa@m17n.org> wrote:
> > --- Michael Mauger <mmaug@yahoo.com> wrote:
> > 
> > > I can't reproduce that bug. When I turned on ruler-mode, I
> > > see both characters in the ruler head. Isn't it a bug
> > > specific to Windows?
> > 
> > > Yes, it seems the problem is specific to Windows. Work
> > > well on my GNU/Linux box.
> > 
> > > The problem seems
> > > to be that the wildcard pattern generated in
> > > `char-displayable-p' is not matching multiple hyphen
> > > separated portions of the font name.  That is,
> > > '-*-*-iso8859-1' doesn't match any fonts while
> > > '-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1' does.
> > 
> > How about
> > '-*-iso8859-1'?  Doest it match all iso8859-1 fonts?  If so,
> > instead of just changing "-*-" to "-*-*-*-*-*-*-*-*-*-*-*-",
> > generating the most compact font-pattern (i.e. no succeeding
> > wildcards) will solve the problem without making Windows
> > version slow.
> > 
> > Even if that doesn't work, your patch is not enough.  I
> > think we must change the length of "-*-..-*-" according to
> > the form of car of font-pattern ("FOUNDRY-FAMILY",
> > "*FAMILY", or "FOUNDRY*")
> 
> I tried '-*-iso8859-1' and it also failed.  The problem appears to be
> in the Windows implementation of x-list-fonts (w32_list_fonts in
> src/w32fns.c).  The wildcarding is obviously not working as intended.
> 

Okay, I think I've isolated the font matching problem down to its
source.  The issue arises in the routine `x_to_w32_font' in
src/w32fns.c.  This routine translates a XLFD string into a Windows
LOGFONT structure.  The problem is that this routine only handles the
following formats:

[fully qualified]
-FOUNDRY-FAMILY-WEIGHT-SLANT-WIDTH-STYLE-PIXELSIZE-POINTSIZE-RESX-RESY
    -SPACING-AVGWIDTH-REGISTRY-ENCODING

[special case generated by font_list_1 invoked by try_font_list]
-FOUNDRY-FAMILY-*-REGISTRY-ENCODING

[Windows-specific formats]
FAMILY:PIXELHEIGHT:PIXELWIDTH:WEIGHT
FAMILY:PIXELHEIGHT:PIXELWIDTH
FAMILY:PIXELHEIGHT
FAMILY

Thus, the strings '-*-iso8859-1' and '-*-*-iso8859-1' are not being
parsed properly.

I see several possible solutions to this specific (char-displayable-p
failing) problem (somewhat in the order of complexity):

1. Alter `char-displayable-p' to generate a string of the form
   '-FOUNDRY-FAMILY-*-REGISTRY-ENCODING' in all cases.  Requires
   parsing the car of the result from fontset-font to ensure
   sufficient hyphens/wildcards have been inserted for it to be
   properly parsed on Windows.

2. Same as above but conditional on (eq window-system 'w32).

3. Modify `x_to_w32_font' to handle the forms:
   -FOUNDRY-*-REGISTRY-ENCODING
   -*-REGISTRY-ENCODING

   The code in this routine is a little fragile.  There are many
   special cases handled implicitly without explicit acknowledgement
   that they are there.  

4. Rewrite the parser in `x_to_w32_font' to more properly handle
   wildcards.  I'm not sure that this can even be done and it is
   probably unnecessary given the limited number of font patterns
   likely to be encountered.

I see option 3 as the ideal, and I will start to work on it. 

One other issue: Kenichi Handa said that the car of font-pattern
could be one of "FOUNDRY-FAMILY", "*FAMILY", or "FOUNDRY*", in
addition to nil.  My solution would not handle the "*FAMILY" form
unless it is really sent as "*-FAMILY".  The Windows code does
not handle partial wildcards in the font pattern.  Will these forms
ever be generated by the Windows code?

If the car of the font-pattern does not have the hyphens with the
wildcard then we need to handle these cases specially.  I would
propose handling them in `char-displayable-p' because their meaning
is clear at that point.  Trying to accommodate the partial wildcards
in `x_to_w32_font' may break other usages.

The internals of Emacs and Windows are by no means my strength, so
if you have comments please send them along.  Thanks.

-- Michael

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

             reply	other threads:[~2003-10-22 19:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-22 19:09 Michael Mauger [this message]
2003-10-22 19:53 ` char-displayable-p issue Jason Rumney
2003-10-23 20:21   ` Michael Mauger
  -- strict thread matches above, loose matches on Subject: below --
2003-10-27 23:48 Michael Mauger
2003-10-28  8:21 ` Jason Rumney
2003-10-28 15:12   ` Michael Mauger
2003-10-21 23:22 Michael Mauger
2003-10-22  5:51 ` Kenichi Handa
2003-10-22 16:00   ` Michael Mauger
2003-10-08  7:04 David PONCE
2003-10-13 23:40 ` Kenichi Handa
2003-10-14  5:56   ` David Ponce

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=20031022190950.32420.qmail@web60304.mail.yahoo.com \
    --to=mmaug@yahoo.com \
    --cc=emacs-devel@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).