unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: Miles Bader <miles@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: set-fontset-font
Date: Wed, 16 Jul 2008 15:55:27 +0900	[thread overview]
Message-ID: <E1KJ0v9-0007DI-19@etlken.m17n.org> (raw)
In-Reply-To: <buoprpegxdx.fsf@dhapc248.dev.necel.com> (message from Miles Bader on Wed, 16 Jul 2008 15:23:54 +0900)

In article <buoprpegxdx.fsf@dhapc248.dev.necel.com>, Miles Bader <miles.bader@necel.com> writes:

> In a fresh emacs, started with "emacs -Q", I can change the font used
> for e.g. japanese characters by doing:

>    (set-fontset-font "fontset-default" 'kana "メイリオ")
>    (set-fontset-font "fontset-default" 'han "メイリオ")

> where "メイリオ" is the name of the font.  This works fine.

> However in my normal emacs, it _doesn't_ work -- the font emacs uses for
> Japanse character doesn't change.

I have not yet decided how to manage non-ASCII
family/foundry/adstyle names.  Currently, perhaps this will
work:

   (set-fontset-font "fontset-default" 'kana
      (encode-coding-string "メイリオ" 'utf-8))
   (set-fontset-font "fontset-default" 'ha
      (encode-coding-string "メイリオ" 'utf-8))

In the future, of course, I'll fix the code so that your
original setting work.

> What does "fontset-default" really mean, anyway?

A fontset maps a non-ASCII character to a group of fonts
(font-group).

Usually, two fontsets "fontset-startup" and
"fontset-default" are active.  "fontset-startup" is made
automatically and it maps Latin characters to the default
font and set the fallback font to the default font.  The
mapping of both fonts may be modified by a user.

To decide a font for a non-ASCII character CH, Emacs does
this:

(1) Check "fontset-startup".  If CH is mapped to a
    font-gourp and one of the font supports CH, that font is
    used.  Otherwise...

(2) Check "fontset-default".  If CH is mapped to a
    font-gourp and one of the font supports CH, that font is
    used.  Otherwise...

(3) Check the fallback font-group of "fontset-startup".  If
    CH is mapped....   Otherwise...

(4) Check the fallback font-group of "fontset-default".  If
    CH is mapped....   Otherwise...

(5) Give up finding a font for CH.

So, in short, "fontset-default" gives the default
information about fonts to support each character
(e.g. Devanagari fonts requires this and that OTF features).


---
Kenichi Handa
handa@ni.aist.go.jp




  reply	other threads:[~2008-07-16  6:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16  6:23 set-fontset-font Miles Bader
2008-07-16  6:55 ` Kenichi Handa [this message]
2008-07-16 14:08   ` set-fontset-font Miles Bader
2008-07-17  0:29     ` set-fontset-font 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=E1KJ0v9-0007DI-19@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    --cc=miles@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).