unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adrian Robert <adrian.b.robert@gmail.com>
To: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Font back end font selection process
Date: Sun, 7 Jun 2009 10:54:09 +0700	[thread overview]
Message-ID: <8BA022EF-AACD-495A-ABBB-24B230475217@gmail.com> (raw)

I am working on updating the NS font driver to work with script and  
friends so that correct nonASCII fonts can be chosen using the  
default fontset skeleton mechanism.  The back end seems to use these  
methods to request a font from the list() method:

- registry in the font spec proper
- :script property in "extra" properties
- :lang property in "extra"
- part of the :otf property bundle in "extra"

I haven't found a way to respond to the first type of query using  
Cocoa APIs yet.  The others that get requested, and the order, seems  
to depend on the language in question.  In particular, for some  
languages like Thai, only OTF requests ever seem to get made.  It  
seems like this class might be the scripts requiring compositional  
rendering, but why, since emacs used to be able to handle  
compositional rendering without making use of any OTF-specific  
properties provided by a font driver?

Also, often I have noticed that when given a Chinese text file  
(encoded in UTF-8), the only request that comes through is :lang=ja.   
How should the font driver know to return a kanji font instead of  
hiragana / katakana?.  Wouldn't it would be better to  
request :script=han, adding :lang=ja or :lang=zh only if emacs has  
some knowledge that the file IS actually in one of these languages?   
The file encoding might be one piece of information to take into  
account, but when it is UTF-8 it would need to run some kind of  
lexical analysis, or query the user.

I also noticed that if no entities are returned from a list() request  
with a family and a script specified, it next makes a list() request  
with no family specified.  Instead of this it would be good to  
request a match() with the family still specified, as this gives the  
driver the opportunity to find a font that "looks like" the family  
(e.g. presence of serifs, etc.), instead of just a random font  
covering the needed characters.  Indeed, I have not noticed match()  
being called at all when searching for a font for a script -- instead  
the back end just goes with the ascii font (and rendering boxes)  
before ever making such a request.





             reply	other threads:[~2009-06-07  3:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-07  3:54 Adrian Robert [this message]
2009-06-07  5:59 ` Font back end font selection process Stephen J. Turnbull
2009-06-08  2:49 ` Kenichi Handa
2009-06-10  7:27   ` Adrian Robert
2009-06-10 11:04     ` 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=8BA022EF-AACD-495A-ABBB-24B230475217@gmail.com \
    --to=adrian.b.robert@gmail.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).