From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Implementing charset-aware X font names Date: Thu, 1 May 2003 20:13:34 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305011113.UAA15169@etlken.m17n.org> References: <87ist17vzu.fsf_-_@tleepslib.sk.tsukuba.ac.jp> <200304281109.UAA10876@etlken.m17n.org> <87fzo24xj4.fsf@tleepslib.sk.tsukuba.ac.jp> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1051788306 10467 80.91.224.249 (1 May 2003 11:25:06 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 1 May 2003 11:25:06 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 01 13:25:05 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19BCBV-0002ic-00 for ; Thu, 01 May 2003 13:25:05 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19BCL6-00046O-00 for ; Thu, 01 May 2003 13:35:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19BC5P-0007Gl-06 for emacs-devel@quimby.gnus.org; Thu, 01 May 2003 07:18:47 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19BC2V-0005jI-00 for emacs-devel@gnu.org; Thu, 01 May 2003 07:15:47 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19BC1i-0005Iv-00 for emacs-devel@gnu.org; Thu, 01 May 2003 07:14:59 -0400 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19BC0V-0004lh-00 for emacs-devel@gnu.org; Thu, 01 May 2003 07:13:43 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h41BDZo00901; Thu, 1 May 2003 20:13:35 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h41BDYA06326; Thu, 1 May 2003 20:13:34 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id UAA15169; Thu, 1 May 2003 20:13:34 +0900 (JST) Original-To: stephen@xemacs.org In-reply-to: <87fzo24xj4.fsf@tleepslib.sk.tsukuba.ac.jp> (stephen@xemacs.org) 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) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13588 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13588 In article <87fzo24xj4.fsf@tleepslib.sk.tsukuba.ac.jp>, "Stephen J. Turnbull" writes: >>>>>> "Kenichi" == Kenichi Handa 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 handa@m17n.org ---------------------------------------------------------------------- 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 charset. FONT-SPEC may be: * A vector [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ]. 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.