[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing charset-aware X font names

From: Kenichi Handa
Subject: Re: Implementing charset-aware X font names
Date: Thu, 1 May 2003 20:13:34 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, "Stephen J. Turnbull" <address@hidden> writes:
>>>>>>  "Kenichi" == Kenichi Handa <address@hidden> writes:
Kenichi>  We connect charsets to font registries vis fontset.  And
Kenichi>  in the emacs-unicode version, we have enhanced it so that
Kenichi>  we can connect scripts, charsets, range of characters to
Kenichi>  multiple font specs.

> Is this documented outside of source code?

It is documented as the docstring of set-fontset-font (as
attached at the tail).  Internally, a fontset is implemented
by a char-table of a special format.

> How does it compare to the specifier interface used by XEmacs?  XEmacs
> specifiers allow a face to automatically select the correct font by
> X11 font registry, but there must also be a similer mechanism for
> Windows, so this must be somewhat more general than "font registry".
> Also, specifiers implement both inheritance and repeated queries (eg,
> you can have both "arial" and "helvetica" fonts for ascii/latin-1, and
> they will be tried in a specified order, usually "last added first",
> until the face can be displayed).

I don't know about "the specifiers interface of XEmacs".  In
Emacs, a face can have an attribute `fontset'.  In that
case, for displaying a non-ASCII character CHAR by that
face, the fontset is looked up.  If a face doesn't have
`fontset' attribute, the default fontset is looked up.  If a
multiple font specs are found for CHAR, one font spec is
selected as below:

(1) For each font spec, find the encoding charset (a charset
    that maps a character code to a glyph code).

(2) Sort the font specs by using that encoding charset as a
    key according to the charset priority of the current
    language environment.  So, for instance, in Japanese
    lang. env., most Han characters are displayed by a
    Japanese font.

(3) Select the first font spec whose repertory contains CHAR.

The font spec is merged with font related attributes of the
face, then the best matching font is selected.

Kenichi>  In addtion, in emacs-unicode, we separate the concept of
Kenichi>  font encoding and font repertory, and for *-iso10646-1
Kenichi>  fonts, we checks the font contents to get the true
Kenichi>  repertory as a char table.

> Ah, I'll have to ask Ben if he's handled that in the devel branch.
> That sounds like a very good interface, and if possible I'd like to
> use it in XEmacs too.  I assume it is exported so Lisp programs can
> find out the repertoire?

Currently no.  As the repertoire is checked automatically in
a fontset handler, for the moment, I see no necessity in
exporting that to Lisp.

Ken'ichi HANDA

set-fontset-font is a built-in function.
(set-fontset-font NAME CHARACTER FONT-SPEC &optional FRAME ADD)

Modify fontset NAME to use FONT-SPEC for CHARACTER.

CHARACTER may be a cons; (FROM . TO), where FROM and TO are
characters.  In that case, use FONT-SPEC for all characters in the
range FROM and TO (inclusive).

CHARACTER may be a script name symbol.  In that case, use FONT-SPEC
for all characters that belong to the script.

CHARACTER may be a charset which has a :code-offset attribute and the
attribute value is greater than the maximum Unicode character
(#x10FFFF).  In that case, use FONT-SPEC for all characters in the

FONT-SPEC may be:
   See the documentation of `set-face-attribute' for the detail of
   these vector elements;
 * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and
   REGISTRY is a font registry name;
 * A font name string.

Optional 4th argument FRAME, if non-nil, is a frame.  This argument is
kept for backward compatibility and has no meaning.

Optional 5th argument ADD, if non-nil, specifies how to add FONT-SPEC
to the font specifications for RANGE previously set.  If it is
`prepend', FONT-SPEC is prepended.  If it is `append', FONT-SPEC is
appended.  By default, FONT-SPEC overrides the previous settings.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]