Mercurial > emacs
annotate src/font.c @ 105362:bf853820f6f9
*** empty log message ***
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Thu, 01 Oct 2009 15:51:43 +0000 |
parents | 00973a055b5e |
children | 9e1a1361da63 |
rev | line source |
---|---|
90400 | 1 /* font.c -- "Font" primitives. |
100951 | 2 Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008, 2009 | |
90400 | 4 National Institute of Advanced Industrial Science and Technology (AIST) |
5 Registration Number H13PRO009 | |
6 | |
7 This file is part of GNU Emacs. | |
8 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94926
diff
changeset
|
9 GNU Emacs is free software: you can redistribute it and/or modify |
90400 | 10 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94926
diff
changeset
|
11 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94926
diff
changeset
|
12 (at your option) any later version. |
90400 | 13 |
14 GNU Emacs is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94926
diff
changeset
|
20 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
90400 | 21 |
22 #include <config.h> | |
23 #include <stdio.h> | |
24 #include <stdlib.h> | |
25 #include <ctype.h> | |
26 | |
27 #include "lisp.h" | |
28 #include "buffer.h" | |
29 #include "frame.h" | |
90541 | 30 #include "window.h" |
90400 | 31 #include "dispextern.h" |
32 #include "charset.h" | |
33 #include "character.h" | |
34 #include "composite.h" | |
35 #include "fontset.h" | |
36 #include "font.h" | |
37 | |
91909 | 38 #ifdef HAVE_X_WINDOWS |
39 #include "xterm.h" | |
40 #endif /* HAVE_X_WINDOWS */ | |
41 | |
42 #ifdef HAVE_NTGUI | |
43 #include "w32term.h" | |
44 #endif /* HAVE_NTGUI */ | |
45 | |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
46 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
47 #include "nsterm.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
48 #endif /* HAVE_NS */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
49 |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
50 #ifdef HAVE_NS |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
51 extern Lisp_Object Qfontsize; |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
52 #endif |
90400 | 53 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
54 Lisp_Object Qopentype; |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
55 |
94926 | 56 /* Important character set strings. */ |
95699 | 57 Lisp_Object Qascii_0, Qiso8859_1, Qiso10646_1, Qunicode_bmp, Qunicode_sip; |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
58 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
59 #define DEFAULT_ENCODING Qiso8859_1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
60 |
97822 | 61 /* Unicode category `Cf'. */ |
62 static Lisp_Object QCf; | |
63 | |
90400 | 64 /* Special vector of zero length. This is repeatedly used by (struct |
65 font_driver *)->list when a specified font is not found. */ | |
94926 | 66 static Lisp_Object null_vector; |
67 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
68 static Lisp_Object Vfont_weight_table, Vfont_slant_table, Vfont_width_table; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
69 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
70 /* Vector of Vfont_weight_table, Vfont_slant_table, and Vfont_width_table. */ |
90400 | 71 static Lisp_Object font_style_table; |
72 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
73 /* Structure used for tables mapping weight, slant, and width numeric |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
74 values and their names. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
75 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
76 struct table_entry |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
77 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
78 int numeric; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
79 /* The first one is a valid name as a face attribute. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
80 The second one (if any) is a typical name in XLFD field. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
81 char *names[5]; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
82 Lisp_Object *symbols; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
83 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
84 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
85 /* Table of weight numeric values and their names. This table must be |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
86 sorted by numeric values in ascending order. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
87 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
88 static struct table_entry weight_table[] = |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
89 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
90 { 0, { "thin" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
91 { 20, { "ultra-light", "ultralight" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
92 { 40, { "extra-light", "extralight" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
93 { 50, { "light" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
94 { 75, { "semi-light", "semilight", "demilight", "book" }}, |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
95 { 100, { "normal", "medium", "regular", "unspecified" }}, |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
96 { 180, { "semi-bold", "semibold", "demibold", "demi" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
97 { 200, { "bold" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
98 { 205, { "extra-bold", "extrabold" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
99 { 210, { "ultra-bold", "ultrabold", "black" }} |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
100 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
101 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
102 /* Table of slant numeric values and their names. This table must be |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
103 sorted by numeric values in ascending order. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
104 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
105 static struct table_entry slant_table[] = |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
106 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
107 { 0, { "reverse-oblique", "ro" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
108 { 10, { "reverse-italic", "ri" }}, |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
109 { 100, { "normal", "r", "unspecified" }}, |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
110 { 200, { "italic" ,"i", "ot" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
111 { 210, { "oblique", "o" }} |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
112 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
113 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
114 /* Table of width numeric values and their names. This table must be |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
115 sorted by numeric values in ascending order. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
116 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
117 static struct table_entry width_table[] = |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
118 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
119 { 50, { "ultra-condensed", "ultracondensed" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
120 { 63, { "extra-condensed", "extracondensed" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
121 { 75, { "condensed", "compressed", "narrow" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
122 { 87, { "semi-condensed", "semicondensed", "demicondensed" }}, |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
123 { 100, { "normal", "medium", "regular", "unspecified" }}, |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
124 { 113, { "semi-expanded", "semiexpanded", "demiexpanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
125 { 125, { "expanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
126 { 150, { "extra-expanded", "extraexpanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
127 { 200, { "ultra-expanded", "ultraexpanded", "wide" }} |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
128 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
129 |
94926 | 130 extern Lisp_Object Qnormal; |
90400 | 131 |
132 /* Symbols representing keys of normal font properties. */ | |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
133 extern Lisp_Object QCtype, QCfamily, QCweight, QCslant, QCwidth; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
134 extern Lisp_Object QCheight, QCsize, QCname; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
135 |
94926 | 136 Lisp_Object QCfoundry, QCadstyle, QCregistry; |
90400 | 137 /* Symbols representing keys of font extra info. */ |
94926 | 138 Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript, QCavgwidth; |
139 Lisp_Object QCantialias, QCfont_entity, QCfc_unknown_spec; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
140 /* Symbols representing values of font spacing property. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
141 Lisp_Object Qc, Qm, Qp, Qd; |
103011
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
142 /* Special ADSTYLE properties to avoid fonts used for Latin |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
143 characters; used in xfont.c and ftfont.c. */ |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
144 Lisp_Object Qja, Qko; |
90400 | 145 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
146 Lisp_Object Vfont_encoding_alist; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
147 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
148 /* Alist of font registry symbol and the corresponding charsets |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
149 information. The information is retrieved from |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
150 Vfont_encoding_alist on demand. |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
151 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
152 Eash element has the form: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
153 (REGISTRY . (ENCODING-CHARSET-ID . REPERTORY-CHARSET-ID)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
154 or |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
155 (REGISTRY . nil) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
156 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
157 In the former form, ENCODING-CHARSET-ID is an ID of a charset that |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
158 encodes a character code to a glyph code of a font, and |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
159 REPERTORY-CHARSET-ID is an ID of a charset that tells if a |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
160 character is supported by a font. |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
161 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
162 The latter form means that the information for REGISTRY couldn't be |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
163 retrieved. */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
164 static Lisp_Object font_charset_alist; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
165 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
166 /* List of all font drivers. Each font-backend (XXXfont.c) calls |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
167 register_font_driver in syms_of_XXXfont to register its font-driver |
90400 | 168 here. */ |
169 static struct font_driver_list *font_driver_list; | |
170 | |
94926 | 171 |
172 | |
173 /* Creaters of font-related Lisp object. */ | |
174 | |
175 Lisp_Object | |
176 font_make_spec () | |
177 { | |
178 Lisp_Object font_spec; | |
179 struct font_spec *spec | |
180 = ((struct font_spec *) | |
181 allocate_pseudovector (VECSIZE (struct font_spec), | |
182 FONT_SPEC_MAX, PVEC_FONT)); | |
183 XSETFONT (font_spec, spec); | |
184 return font_spec; | |
185 } | |
186 | |
187 Lisp_Object | |
188 font_make_entity () | |
189 { | |
190 Lisp_Object font_entity; | |
191 struct font_entity *entity | |
192 = ((struct font_entity *) | |
193 allocate_pseudovector (VECSIZE (struct font_entity), | |
194 FONT_ENTITY_MAX, PVEC_FONT)); | |
195 XSETFONT (font_entity, entity); | |
196 return font_entity; | |
197 } | |
198 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
199 /* Create a font-object whose structure size is SIZE. If ENTITY is |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
200 not nil, copy properties from ENTITY to the font-object. If |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
201 PIXELSIZE is positive, set the `size' property to PIXELSIZE. */ |
94926 | 202 Lisp_Object |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
203 font_make_object (size, entity, pixelsize) |
94926 | 204 int size; |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
205 Lisp_Object entity; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
206 int pixelsize; |
94926 | 207 { |
208 Lisp_Object font_object; | |
209 struct font *font | |
210 = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, PVEC_FONT); | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
211 int i; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
212 |
94926 | 213 XSETFONT (font_object, font); |
214 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
215 if (! NILP (entity)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
216 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
217 for (i = 1; i < FONT_SPEC_MAX; i++) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
218 font->props[i] = AREF (entity, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
219 if (! NILP (AREF (entity, FONT_EXTRA_INDEX))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
220 font->props[FONT_EXTRA_INDEX] |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
221 = Fcopy_sequence (AREF (entity, FONT_EXTRA_INDEX)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
222 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
223 if (size > 0) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
224 font->props[FONT_SIZE_INDEX] = make_number (pixelsize); |
94926 | 225 return font_object; |
226 } | |
227 | |
228 | |
229 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
230 static int font_pixel_size P_ ((FRAME_PTR f, Lisp_Object)); |
94926 | 231 static Lisp_Object font_open_entity P_ ((FRAME_PTR, Lisp_Object, int)); |
232 static Lisp_Object font_matching_entity P_ ((FRAME_PTR, Lisp_Object *, | |
90400 | 233 Lisp_Object)); |
234 | |
235 /* Number of registered font drivers. */ | |
236 static int num_font_drivers; | |
237 | |
94926 | 238 |
239 /* Return a Lispy value of a font property value at STR and LEN bytes. | |
240 If STR is "*", it returns nil. | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
241 If FORCE_SYMBOL is zero and all characters in STR are digits, it |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
242 returns an integer. Otherwise, it returns a symbol interned from |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
243 STR. */ |
94926 | 244 |
245 Lisp_Object | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
246 font_intern_prop (str, len, force_symbol) |
94926 | 247 char *str; |
248 int len; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
249 int force_symbol; |
94926 | 250 { |
251 int i; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
252 Lisp_Object tem; |
94926 | 253 Lisp_Object obarray; |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
254 int nbytes, nchars; |
94926 | 255 |
256 if (len == 1 && *str == '*') | |
257 return Qnil; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
258 if (!force_symbol && len >=1 && isdigit (*str)) |
94926 | 259 { |
260 for (i = 1; i < len; i++) | |
261 if (! isdigit (str[i])) | |
262 break; | |
263 if (i == len) | |
264 return make_number (atoi (str)); | |
265 } | |
266 | |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
267 /* The following code is copied from the function intern (in |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
268 lread.c), and modified to suite our purpose. */ |
94926 | 269 obarray = Vobarray; |
270 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) | |
271 obarray = check_obarray (obarray); | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
272 parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes); |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
273 if (len == nchars || len != nbytes) |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
274 /* CONTENTS contains no multibyte sequences or contains an invalid |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
275 multibyte sequence. We'll make a unibyte string. */ |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
276 tem = oblookup (obarray, str, len, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
277 else |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
278 tem = oblookup (obarray, str, nchars, len); |
94926 | 279 if (SYMBOLP (tem)) |
280 return tem; | |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
281 if (len == nchars || len != nbytes) |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
282 tem = make_unibyte_string (str, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
283 else |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
284 tem = make_multibyte_string (str, nchars, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
285 return Fintern (tem, obarray); |
94926 | 286 } |
287 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
288 /* Return a pixel size of font-spec SPEC on frame F. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
289 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
290 static int |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
291 font_pixel_size (f, spec) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
292 FRAME_PTR f; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
293 Lisp_Object spec; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
294 { |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
295 #ifdef HAVE_WINDOW_SYSTEM |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
296 Lisp_Object size = AREF (spec, FONT_SIZE_INDEX); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
297 double point_size; |
94926 | 298 int dpi, pixel_size; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
299 Lisp_Object val; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
300 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
301 if (INTEGERP (size)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
302 return XINT (size); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
303 if (NILP (size)) |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
304 return 0; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
305 font_assert (FLOATP (size)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
306 point_size = XFLOAT_DATA (size); |
94926 | 307 val = AREF (spec, FONT_DPI_INDEX); |
308 if (INTEGERP (val)) | |
95483
d3cbd7d56845
(font_pixel_size): Don't take cdr of an integer.
Chong Yidong <cyd@stupidchicken.com>
parents:
95475
diff
changeset
|
309 dpi = XINT (val); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
310 else |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
311 dpi = f->resy; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
312 pixel_size = POINT_TO_PIXEL (point_size, dpi); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
313 return pixel_size; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
314 #else |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
315 return 1; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
316 #endif |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
317 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
318 |
94926 | 319 |
320 /* Return a value of PROP's VAL (symbol or integer) to be stored in a | |
321 font vector. If VAL is not valid (i.e. not registered in | |
322 font_style_table), return -1 if NOERROR is zero, and return a | |
323 proper index if NOERROR is nonzero. In that case, register VAL in | |
324 font_style_table if VAL is a symbol, and return a closest index if | |
325 VAL is an integer. */ | |
326 | |
327 int | |
328 font_style_to_value (prop, val, noerror) | |
90400 | 329 enum font_property_index prop; |
94926 | 330 Lisp_Object val; |
331 int noerror; | |
90400 | 332 { |
94926 | 333 Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); |
334 int len = ASIZE (table); | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
335 int i, j; |
94926 | 336 |
337 if (SYMBOLP (val)) | |
90400 | 338 { |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
339 unsigned char *s; |
94926 | 340 Lisp_Object args[2], elt; |
341 | |
342 /* At first try exact match. */ | |
343 for (i = 0; i < len; i++) | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
344 for (j = 1; j < ASIZE (AREF (table, i)); j++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
345 if (EQ (val, AREF (AREF (table, i), j))) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
346 return ((XINT (AREF (AREF (table, i), 0)) << 8) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
347 | (i << 4) | (j - 1)); |
94926 | 348 /* Try also with case-folding match. */ |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
349 s = SDATA (SYMBOL_NAME (val)); |
94926 | 350 for (i = 0; i < len; i++) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
351 for (j = 1; j < ASIZE (AREF (table, i)); j++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
352 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
353 elt = AREF (AREF (table, i), j); |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
354 if (xstrcasecmp (s, SDATA (SYMBOL_NAME (elt))) == 0) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
355 return ((XINT (AREF (AREF (table, i), 0)) << 8) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
356 | (i << 4) | (j - 1)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
357 } |
94926 | 358 if (! noerror) |
359 return -1; | |
360 if (len == 255) | |
361 abort (); | |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
362 elt = Fmake_vector (make_number (2), make_number (100)); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
363 ASET (elt, 1, val); |
94926 | 364 args[0] = table; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
365 args[1] = Fmake_vector (make_number (1), elt); |
94926 | 366 ASET (font_style_table, prop - FONT_WEIGHT_INDEX, Fvconcat (2, args)); |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
367 return (100 << 8) | (i << 4); |
90400 | 368 } |
94926 | 369 else |
370 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
371 int i, last_n; |
94926 | 372 int numeric = XINT (val); |
373 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
374 for (i = 0, last_n = -1; i < len; i++) |
94926 | 375 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
376 int n = XINT (AREF (AREF (table, i), 0)); |
94926 | 377 |
378 if (numeric == n) | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
379 return (n << 8) | (i << 4); |
94926 | 380 if (numeric < n) |
381 { | |
382 if (! noerror) | |
383 return -1; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
384 return ((i == 0 || n - numeric < numeric - last_n) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
385 ? (n << 8) | (i << 4): (last_n << 8 | ((i - 1) << 4))); |
94926 | 386 } |
387 last_n = n; | |
388 } | |
389 if (! noerror) | |
390 return -1; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
391 return ((last_n << 8) | ((i - 1) << 4)); |
94926 | 392 } |
90400 | 393 } |
394 | |
395 Lisp_Object | |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
96000
diff
changeset
|
396 font_style_symbolic (font, prop, for_face) |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
96000
diff
changeset
|
397 Lisp_Object font; |
94926 | 398 enum font_property_index prop; |
399 int for_face; | |
90400 | 400 { |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
96000
diff
changeset
|
401 Lisp_Object val = AREF (font, prop); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
402 Lisp_Object table, elt; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
403 int i; |
94926 | 404 |
405 if (NILP (val)) | |
406 return Qnil; | |
407 table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
408 i = XINT (val) & 0xFF; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
409 font_assert (((i >> 4) & 0xF) < ASIZE (table)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
410 elt = AREF (table, ((i >> 4) & 0xF)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
411 font_assert ((i & 0xF) + 1 < ASIZE (elt)); |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
412 return (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1)); |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
413 } |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
414 |
90400 | 415 extern Lisp_Object Vface_alternative_font_family_alist; |
416 | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
417 extern Lisp_Object find_font_encoding P_ ((Lisp_Object)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
418 |
94926 | 419 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
420 /* Return ENCODING or a cons of ENCODING and REPERTORY of the font |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
421 FONTNAME. ENCODING is a charset symbol that specifies the encoding |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
422 of the font. REPERTORY is a charset symbol or nil. */ |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
423 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
424 Lisp_Object |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
425 find_font_encoding (fontname) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
426 Lisp_Object fontname; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
427 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
428 Lisp_Object tail, elt; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
429 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
430 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
431 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
432 elt = XCAR (tail); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
433 if (CONSP (elt) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
434 && STRINGP (XCAR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
435 && fast_string_match_ignore_case (XCAR (elt), fontname) >= 0 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
436 && (SYMBOLP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
437 ? CHARSETP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
438 : CONSP (XCDR (elt)) && CHARSETP (XCAR (XCDR (elt))))) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
439 return (XCDR (elt)); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
440 } |
102708
c8014e79191f
(find_font_encoding): Return Qnil for unsupported encoding.
Kenichi Handa <handa@m17n.org>
parents:
102483
diff
changeset
|
441 return Qnil; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
442 } |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
443 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
444 /* Return encoding charset and repertory charset for REGISTRY in |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
445 ENCODING and REPERTORY correspondingly. If correct information for |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
446 REGISTRY is available, return 0. Otherwise return -1. */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
447 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
448 int |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
449 font_registry_charsets (registry, encoding, repertory) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
450 Lisp_Object registry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
451 struct charset **encoding, **repertory; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
452 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
453 Lisp_Object val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
454 int encoding_id, repertory_id; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
455 |
94926 | 456 val = Fassoc_string (registry, font_charset_alist, Qt); |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
457 if (! NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
458 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
459 val = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
460 if (NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
461 return -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
462 encoding_id = XINT (XCAR (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
463 repertory_id = XINT (XCDR (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
464 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
465 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
466 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
467 val = find_font_encoding (SYMBOL_NAME (registry)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
468 if (SYMBOLP (val) && CHARSETP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
469 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
470 encoding_id = repertory_id = XINT (CHARSET_SYMBOL_ID (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
471 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
472 else if (CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
473 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
474 if (! CHARSETP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
475 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
476 encoding_id = XINT (CHARSET_SYMBOL_ID (XCAR (val))); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
477 if (NILP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
478 repertory_id = -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
479 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
480 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
481 if (! CHARSETP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
482 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
483 repertory_id = XINT (CHARSET_SYMBOL_ID (XCDR (val))); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
484 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
485 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
486 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
487 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
488 val = Fcons (make_number (encoding_id), make_number (repertory_id)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
489 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
490 = nconc2 (font_charset_alist, Fcons (Fcons (registry, val), Qnil)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
491 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
492 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
493 if (encoding) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
494 *encoding = CHARSET_FROM_ID (encoding_id); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
495 if (repertory) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
496 *repertory = repertory_id >= 0 ? CHARSET_FROM_ID (repertory_id) : NULL; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
497 return 0; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
498 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
499 invalid_entry: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
500 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
501 = nconc2 (font_charset_alist, Fcons (Fcons (registry, Qnil), Qnil)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
502 return -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
503 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
504 |
90400 | 505 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
506 /* Font property value validaters. See the comment of |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
507 font_property_table for the meaning of the arguments. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
508 |
94926 | 509 static Lisp_Object font_prop_validate P_ ((int, Lisp_Object, Lisp_Object)); |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
510 static Lisp_Object font_prop_validate_symbol P_ ((Lisp_Object, Lisp_Object)); |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
511 static Lisp_Object font_prop_validate_style P_ ((Lisp_Object, Lisp_Object)); |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
512 static Lisp_Object font_prop_validate_non_neg P_ ((Lisp_Object, Lisp_Object)); |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
513 static Lisp_Object font_prop_validate_spacing P_ ((Lisp_Object, Lisp_Object)); |
94926 | 514 static int get_font_prop_index P_ ((Lisp_Object)); |
90400 | 515 |
516 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
517 font_prop_validate_symbol (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
518 Lisp_Object prop, val; |
90400 | 519 { |
520 if (STRINGP (val)) | |
94926 | 521 val = Fintern (val, Qnil); |
522 if (! SYMBOLP (val)) | |
523 val = Qerror; | |
524 else if (EQ (prop, QCregistry)) | |
525 val = Fintern (Fdowncase (SYMBOL_NAME (val)), Qnil); | |
526 return val; | |
527 } | |
528 | |
529 | |
530 static Lisp_Object | |
531 font_prop_validate_style (style, val) | |
532 Lisp_Object style, val; | |
533 { | |
534 enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX | |
535 : EQ (style, QCslant) ? FONT_SLANT_INDEX | |
536 : FONT_WIDTH_INDEX); | |
537 int n; | |
538 if (INTEGERP (val)) | |
539 { | |
540 n = XINT (val); | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
541 if (((n >> 4) & 0xF) |
94926 | 542 >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) |
543 val = Qerror; | |
544 else | |
545 { | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
546 Lisp_Object elt = AREF (AREF (font_style_table, prop - FONT_WEIGHT_INDEX), (n >> 4) & 0xF); |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
547 |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
548 if ((n & 0xF) + 1 >= ASIZE (elt)) |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
549 val = Qerror; |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
550 else if (XINT (AREF (elt, 0)) != (n >> 8)) |
94926 | 551 val = Qerror; |
552 } | |
553 } | |
90400 | 554 else if (SYMBOLP (val)) |
555 { | |
94926 | 556 int n = font_style_to_value (prop, val, 0); |
557 | |
558 val = n >= 0 ? make_number (n) : Qerror; | |
90400 | 559 } |
560 else | |
561 val = Qerror; | |
562 return val; | |
563 } | |
564 | |
565 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
566 font_prop_validate_non_neg (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
567 Lisp_Object prop, val; |
90400 | 568 { |
569 return (NATNUMP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0) | |
570 ? val : Qerror); | |
571 } | |
572 | |
573 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
574 font_prop_validate_spacing (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
575 Lisp_Object prop, val; |
90400 | 576 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
577 if (NILP (val) || (NATNUMP (val) && XINT (val) <= FONT_SPACING_CHARCELL)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
578 return val; |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
579 if (SYMBOLP (val) && SBYTES (SYMBOL_NAME (val)) == 1) |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
580 { |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
581 char spacing = SDATA (SYMBOL_NAME (val))[0]; |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
582 |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
583 if (spacing == 'c' || spacing == 'C') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
584 return make_number (FONT_SPACING_CHARCELL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
585 if (spacing == 'm' || spacing == 'M') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
586 return make_number (FONT_SPACING_MONO); |
95523
3c4256715c94
(font_prop_validate_spacing): Fix last change.
Andreas Schwab <schwab@suse.de>
parents:
95516
diff
changeset
|
587 if (spacing == 'p' || spacing == 'P') |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
588 return make_number (FONT_SPACING_PROPORTIONAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
589 if (spacing == 'd' || spacing == 'D') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
590 return make_number (FONT_SPACING_DUAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
591 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
592 return Qerror; |
90400 | 593 } |
594 | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
595 static Lisp_Object |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
596 font_prop_validate_otf (prop, val) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
597 Lisp_Object prop, val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
598 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
599 Lisp_Object tail, tmp; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
600 int i; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
601 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
602 /* VAL = (SCRIPT [ LANGSYS [ GSUB-FEATURES [ GPOS-FEATURES ]]]) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
603 GSUB-FEATURES = (FEATURE ... [ nil FEATURE ... ]) | nil |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
604 GPOS-FEATURES = (FEATURE ... [ nil FEATURE ... ]) | nil */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
605 if (! CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
606 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
607 if (! SYMBOLP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
608 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
609 tail = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
610 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
611 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
612 if (! CONSP (tail) || ! SYMBOLP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
613 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
614 for (i = 0; i < 2; i++) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
615 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
616 tail = XCDR (tail); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
617 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
618 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
619 if (! CONSP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
620 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
621 for (tmp = XCAR (tail); CONSP (tmp); tmp = XCDR (tmp)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
622 if (! SYMBOLP (XCAR (tmp))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
623 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
624 if (! NILP (tmp)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
625 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
626 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
627 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
628 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
629 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
630 /* Structure of known font property keys and validater of the |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
631 values. */ |
90400 | 632 struct |
633 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
634 /* Pointer to the key symbol. */ |
90400 | 635 Lisp_Object *key; |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
636 /* Function to validate PROP's value VAL, or NULL if any value is |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
637 ok. The value is VAL or its regularized value if VAL is valid, |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
638 and Qerror if not. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
639 Lisp_Object (*validater) P_ ((Lisp_Object prop, Lisp_Object val)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
640 } font_property_table[] = |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
641 { { &QCtype, font_prop_validate_symbol }, |
90400 | 642 { &QCfoundry, font_prop_validate_symbol }, |
643 { &QCfamily, font_prop_validate_symbol }, | |
644 { &QCadstyle, font_prop_validate_symbol }, | |
645 { &QCregistry, font_prop_validate_symbol }, | |
646 { &QCweight, font_prop_validate_style }, | |
647 { &QCslant, font_prop_validate_style }, | |
648 { &QCwidth, font_prop_validate_style }, | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
649 { &QCsize, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
650 { &QCdpi, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
651 { &QCspacing, font_prop_validate_spacing }, |
94926 | 652 { &QCavgwidth, font_prop_validate_non_neg }, |
653 /* The order of the above entries must match with enum | |
654 font_property_index. */ | |
655 { &QClang, font_prop_validate_symbol }, | |
656 { &QCscript, font_prop_validate_symbol }, | |
657 { &QCotf, font_prop_validate_otf } | |
90400 | 658 }; |
659 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
660 /* Size (number of elements) of the above table. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
661 #define FONT_PROPERTY_TABLE_SIZE \ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
662 ((sizeof font_property_table) / (sizeof *font_property_table)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
663 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
664 /* Return an index number of font property KEY or -1 if KEY is not an |
94926 | 665 already known property. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
666 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
667 static int |
94926 | 668 get_font_prop_index (key) |
90400 | 669 Lisp_Object key; |
670 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
671 int i; |
94926 | 672 |
673 for (i = 0; i < FONT_PROPERTY_TABLE_SIZE; i++) | |
674 if (EQ (key, *font_property_table[i].key)) | |
675 return i; | |
676 return -1; | |
677 } | |
678 | |
679 /* Validate the font property. The property key is specified by the | |
680 symbol PROP, or the index IDX (if PROP is nil). If VAL is invalid, | |
681 signal an error. The value is VAL or the regularized one. */ | |
682 | |
683 static Lisp_Object | |
684 font_prop_validate (idx, prop, val) | |
685 int idx; | |
686 Lisp_Object prop, val; | |
687 { | |
688 Lisp_Object validated; | |
689 | |
94964
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
690 if (NILP (val)) |
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
691 return val; |
94926 | 692 if (NILP (prop)) |
693 prop = *font_property_table[idx].key; | |
694 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
695 { |
94926 | 696 idx = get_font_prop_index (prop); |
697 if (idx < 0) | |
698 return val; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
699 } |
94926 | 700 validated = (font_property_table[idx].validater) (prop, val); |
701 if (EQ (validated, Qerror)) | |
702 signal_error ("invalid font property", Fcons (prop, val)); | |
703 return validated; | |
90400 | 704 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
705 |
94926 | 706 |
707 /* Store VAL as a value of extra font property PROP in FONT while | |
708 keeping the sorting order. Don't check the validity of VAL. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
709 |
90888
5f03b3602143
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90883
diff
changeset
|
710 Lisp_Object |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
711 font_put_extra (font, prop, val) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
712 Lisp_Object font, prop, val; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
713 { |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
714 Lisp_Object extra = AREF (font, FONT_EXTRA_INDEX); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
715 Lisp_Object slot = (NILP (extra) ? Qnil : assq_no_quit (prop, extra)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
716 |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
717 if (NILP (slot)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
718 { |
94926 | 719 Lisp_Object prev = Qnil; |
720 | |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
721 if (NILP (val)) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
722 return val; |
94926 | 723 while (CONSP (extra) |
724 && NILP (Fstring_lessp (prop, XCAR (XCAR (extra))))) | |
725 prev = extra, extra = XCDR (extra); | |
726 if (NILP (prev)) | |
727 ASET (font, FONT_EXTRA_INDEX, Fcons (Fcons (prop, val), extra)); | |
728 else | |
729 XSETCDR (prev, Fcons (Fcons (prop, val), extra)); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
730 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
731 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
732 XSETCDR (slot, val); |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
733 if (NILP (val)) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
734 ASET (font, FONT_EXTRA_INDEX, Fdelq (slot, extra)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
735 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
736 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
737 |
90400 | 738 |
739 /* Font name parser and unparser */ | |
740 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
741 static int parse_matrix P_ ((char *)); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
742 static int font_expand_wildcards P_ ((Lisp_Object *, int)); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
743 static int font_parse_name P_ ((char *, Lisp_Object)); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
744 |
90400 | 745 /* An enumerator for each field of an XLFD font name. */ |
746 enum xlfd_field_index | |
747 { | |
748 XLFD_FOUNDRY_INDEX, | |
749 XLFD_FAMILY_INDEX, | |
750 XLFD_WEIGHT_INDEX, | |
751 XLFD_SLANT_INDEX, | |
752 XLFD_SWIDTH_INDEX, | |
753 XLFD_ADSTYLE_INDEX, | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
754 XLFD_PIXEL_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
755 XLFD_POINT_INDEX, |
90400 | 756 XLFD_RESX_INDEX, |
757 XLFD_RESY_INDEX, | |
758 XLFD_SPACING_INDEX, | |
759 XLFD_AVGWIDTH_INDEX, | |
760 XLFD_REGISTRY_INDEX, | |
761 XLFD_ENCODING_INDEX, | |
762 XLFD_LAST_INDEX | |
763 }; | |
764 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
765 /* An enumerator for mask bit corresponding to each XLFD field. */ |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
766 enum xlfd_field_mask |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
767 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
768 XLFD_FOUNDRY_MASK = 0x0001, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
769 XLFD_FAMILY_MASK = 0x0002, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
770 XLFD_WEIGHT_MASK = 0x0004, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
771 XLFD_SLANT_MASK = 0x0008, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
772 XLFD_SWIDTH_MASK = 0x0010, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
773 XLFD_ADSTYLE_MASK = 0x0020, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
774 XLFD_PIXEL_MASK = 0x0040, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
775 XLFD_POINT_MASK = 0x0080, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
776 XLFD_RESX_MASK = 0x0100, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
777 XLFD_RESY_MASK = 0x0200, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
778 XLFD_SPACING_MASK = 0x0400, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
779 XLFD_AVGWIDTH_MASK = 0x0800, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
780 XLFD_REGISTRY_MASK = 0x1000, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
781 XLFD_ENCODING_MASK = 0x2000 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
782 }; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
783 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
784 |
90400 | 785 /* Parse P pointing the pixel/point size field of the form |
786 `[A B C D]' which specifies a transformation matrix: | |
787 | |
788 A B 0 | |
789 C D 0 | |
790 0 0 1 | |
791 | |
792 by which all glyphs of the font are transformed. The spec says | |
793 that scalar value N for the pixel/point size is equivalent to: | |
794 A = N * resx/resy, B = C = 0, D = N. | |
795 | |
796 Return the scalar value N if the form is valid. Otherwise return | |
797 -1. */ | |
798 | |
799 static int | |
800 parse_matrix (p) | |
801 char *p; | |
802 { | |
803 double matrix[4]; | |
804 char *end; | |
805 int i; | |
806 | |
807 for (i = 0, p++; i < 4 && *p && *p != ']'; i++) | |
808 { | |
809 if (*p == '~') | |
810 matrix[i] = - strtod (p + 1, &end); | |
811 else | |
812 matrix[i] = strtod (p, &end); | |
813 p = end; | |
814 } | |
815 return (i == 4 ? (int) matrix[3] : -1); | |
816 } | |
817 | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
818 /* Expand a wildcard field in FIELD (the first N fields are filled) to |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
819 multiple fields to fill in all 14 XLFD fields while restring a |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
820 field position by its contents. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
821 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
822 static int |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
823 font_expand_wildcards (field, n) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
824 Lisp_Object field[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
825 int n; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
826 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
827 /* Copy of FIELD. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
828 Lisp_Object tmp[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
829 /* Array of information about where this element can go. Nth |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
830 element is for Nth element of FIELD. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
831 struct { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
832 /* Minimum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
833 int from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
834 /* Maxinum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
835 int to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
836 /* Bit mask of possible field. Nth bit corresponds to Nth field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
837 int mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
838 } range[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
839 int i, j; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
840 int range_from, range_to; |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
841 unsigned range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
842 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
843 #define XLFD_SYMBOL_MASK (XLFD_FOUNDRY_MASK | XLFD_FAMILY_MASK \ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
844 | XLFD_ADSTYLE_MASK | XLFD_REGISTRY_MASK) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
845 #define XLFD_NULL_MASK (XLFD_FOUNDRY_MASK | XLFD_ADSTYLE_MASK) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
846 #define XLFD_LARGENUM_MASK (XLFD_POINT_MASK | XLFD_RESX_MASK | XLFD_RESY_MASK \ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
847 | XLFD_AVGWIDTH_MASK) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
848 #define XLFD_REGENC_MASK (XLFD_REGISTRY_MASK | XLFD_ENCODING_MASK) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
849 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
850 /* Initialize RANGE_MASK for FIELD[0] which can be 0th to (14 - N)th |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
851 field. The value is shifted to left one bit by one in the |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
852 following loop. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
853 for (i = 0, range_mask = 0; i <= 14 - n; i++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
854 range_mask = (range_mask << 1) | 1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
855 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
856 /* The triplet RANGE_FROM, RANGE_TO, and RANGE_MASK is a |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
857 position-based retriction for FIELD[I]. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
858 for (i = 0, range_from = 0, range_to = 14 - n; i < n; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
859 i++, range_from++, range_to++, range_mask <<= 1) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
860 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
861 Lisp_Object val = field[i]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
862 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
863 tmp[i] = val; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
864 if (NILP (val)) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
865 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
866 /* Wildcard. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
867 range[i].from = range_from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
868 range[i].to = range_to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
869 range[i].mask = range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
870 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
871 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
872 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
873 /* The triplet FROM, TO, and MASK is a value-based |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
874 retriction for FIELD[I]. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
875 int from, to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
876 unsigned mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
877 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
878 if (INTEGERP (val)) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
879 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
880 int numeric = XINT (val); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
881 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
882 if (i + 1 == n) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
883 from = to = XLFD_ENCODING_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
884 mask = XLFD_ENCODING_MASK; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
885 else if (numeric == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
886 from = XLFD_PIXEL_INDEX, to = XLFD_AVGWIDTH_INDEX, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
887 mask = XLFD_PIXEL_MASK | XLFD_LARGENUM_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
888 else if (numeric <= 48) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
889 from = to = XLFD_PIXEL_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
890 mask = XLFD_PIXEL_MASK; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
891 else |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
892 from = XLFD_POINT_INDEX, to = XLFD_AVGWIDTH_INDEX, |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
893 mask = XLFD_LARGENUM_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
894 } |
94926 | 895 else if (SBYTES (SYMBOL_NAME (val)) == 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
896 from = XLFD_FOUNDRY_INDEX, to = XLFD_ADSTYLE_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
897 mask = XLFD_NULL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
898 else if (i == 0) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
899 from = to = XLFD_FOUNDRY_INDEX, mask = XLFD_FOUNDRY_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
900 else if (i + 1 == n) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
901 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
902 Lisp_Object name = SYMBOL_NAME (val); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
903 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
904 if (SDATA (name)[SBYTES (name) - 1] == '*') |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
905 from = XLFD_REGISTRY_INDEX, to = XLFD_ENCODING_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
906 mask = XLFD_REGENC_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
907 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
908 from = to = XLFD_ENCODING_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
909 mask = XLFD_ENCODING_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
910 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
911 else if (range_from <= XLFD_WEIGHT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
912 && range_to >= XLFD_WEIGHT_INDEX |
94926 | 913 && FONT_WEIGHT_NAME_NUMERIC (val) >= 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
914 from = to = XLFD_WEIGHT_INDEX, mask = XLFD_WEIGHT_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
915 else if (range_from <= XLFD_SLANT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
916 && range_to >= XLFD_SLANT_INDEX |
94926 | 917 && FONT_SLANT_NAME_NUMERIC (val) >= 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
918 from = to = XLFD_SLANT_INDEX, mask = XLFD_SLANT_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
919 else if (range_from <= XLFD_SWIDTH_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
920 && range_to >= XLFD_SWIDTH_INDEX |
94926 | 921 && FONT_WIDTH_NAME_NUMERIC (val) >= 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
922 from = to = XLFD_SWIDTH_INDEX, mask = XLFD_SWIDTH_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
923 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
924 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
925 if (EQ (val, Qc) || EQ (val, Qm) || EQ (val, Qp) || EQ (val, Qd)) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
926 from = to = XLFD_SPACING_INDEX, mask = XLFD_SPACING_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
927 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
928 from = XLFD_FOUNDRY_INDEX, to = XLFD_ENCODING_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
929 mask = XLFD_SYMBOL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
930 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
931 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
932 /* Merge position-based and value-based restrictions. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
933 mask &= range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
934 while (from < range_from) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
935 mask &= ~(1 << from++); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
936 while (from < 14 && ! (mask & (1 << from))) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
937 from++; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
938 while (to > range_to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
939 mask &= ~(1 << to--); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
940 while (to >= 0 && ! (mask & (1 << to))) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
941 to--; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
942 if (from > to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
943 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
944 range[i].from = from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
945 range[i].to = to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
946 range[i].mask = mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
947 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
948 if (from > range_from || to < range_to) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
949 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
950 /* The range is narrowed by value-based restrictions. |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
951 Reflect it to the other fields. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
952 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
953 /* Following fields should be after FROM. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
954 range_from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
955 /* Preceding fields should be before TO. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
956 for (j = i - 1, from--, to--; j >= 0; j--, from--, to--) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
957 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
958 /* Check FROM for non-wildcard field. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
959 if (! NILP (tmp[j]) && range[j].from < from) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
960 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
961 while (range[j].from < from) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
962 range[j].mask &= ~(1 << range[j].from++); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
963 while (from < 14 && ! (range[j].mask & (1 << from))) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
964 from++; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
965 range[j].from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
966 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
967 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
968 from = range[j].from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
969 if (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
970 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
971 while (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
972 range[j].mask &= ~(1 << range[j].to--); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
973 while (to >= 0 && ! (range[j].mask & (1 << to))) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
974 to--; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
975 range[j].to = to; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
976 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
977 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
978 to = range[j].to; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
979 if (from > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
980 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
981 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
982 } |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
983 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
984 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
985 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
986 /* Decide all fileds from restrictions in RANGE. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
987 for (i = j = 0; i < n ; i++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
988 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
989 if (j < range[i].from) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
990 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
991 if (i == 0 || ! NILP (tmp[i - 1])) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
992 /* None of TMP[X] corresponds to Jth field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
993 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
994 for (; j < range[i].from; j++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
995 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
996 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
997 field[j++] = tmp[i]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
998 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
999 if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1000 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1001 for (; j < XLFD_LAST_INDEX; j++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1002 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1003 if (INTEGERP (field[XLFD_ENCODING_INDEX])) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1004 field[XLFD_ENCODING_INDEX] |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1005 = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1006 return 0; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1007 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1008 |
92113
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1009 |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1010 #ifdef ENABLE_CHECKING |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1011 /* Match a 14-field XLFD pattern against a full XLFD font name. */ |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1012 static int |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1013 font_match_xlfd (char *pattern, char *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1014 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1015 while (*pattern && *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1016 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1017 if (*pattern == *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1018 pattern++; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1019 else if (*pattern == '*') |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1020 if (*name == pattern[1]) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1021 pattern += 2; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1022 else |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1023 ; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1024 else |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1025 return 0; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1026 name++; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1027 } |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1028 return 1; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1029 } |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1030 |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1031 /* Make sure the font object matches the XLFD font name. */ |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1032 static int |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1033 font_check_xlfd_parse (Lisp_Object font, char *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1034 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1035 char name_check[256]; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1036 font_unparse_xlfd (font, 0, name_check, 255); |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1037 return font_match_xlfd (name_check, name); |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1038 } |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1039 |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1040 #endif |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1041 |
94926 | 1042 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1043 /* Parse NAME (null terminated) as XLFD and store information in FONT |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1044 (font-spec or font-entity). Size property of FONT is set as |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1045 follows: |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1046 specified XLFD fields FONT property |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1047 --------------------- ------------- |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1048 PIXEL_SIZE PIXEL_SIZE (Lisp integer) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1049 POINT_SIZE and RESY calculated pixel size (Lisp integer) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1050 POINT_SIZE POINT_SIZE/10 (Lisp float) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1051 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1052 If NAME is successfully parsed, return 0. Otherwise return -1. |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1053 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1054 FONT is usually a font-spec, but when this function is called from |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1055 X font backend driver, it is a font-entity. In that case, NAME is |
94926 | 1056 a fully specified XLFD. */ |
90400 | 1057 |
1058 int | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1059 font_parse_xlfd (name, font) |
90400 | 1060 char *name; |
1061 Lisp_Object font; | |
1062 { | |
1063 int len = strlen (name); | |
94926 | 1064 int i, j, n; |
90695
a1cd7344d6a2
(font_parse_xlfd): Fix the array size of `f'.
Kenichi Handa <handa@m17n.org>
parents:
90677
diff
changeset
|
1065 char *f[XLFD_LAST_INDEX + 1]; |
90400 | 1066 Lisp_Object val; |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1067 char *p; |
90400 | 1068 |
101422
9e1fcd81389c
(font_parse_xlfd): Handle patterns of length < 2.
Chong Yidong <cyd@stupidchicken.com>
parents:
101293
diff
changeset
|
1069 if (len > 255 || !len) |
90400 | 1070 /* Maximum XLFD name length is 255. */ |
1071 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1072 /* Accept "*-.." as a fully specified XLFD. */ |
101422
9e1fcd81389c
(font_parse_xlfd): Handle patterns of length < 2.
Chong Yidong <cyd@stupidchicken.com>
parents:
101293
diff
changeset
|
1073 if (name[0] == '*' && (len == 1 || name[1] == '-')) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1074 i = 1, f[XLFD_FOUNDRY_INDEX] = name; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1075 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1076 i = 0; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1077 for (p = name + i; *p; p++) |
94926 | 1078 if (*p == '-') |
1079 { | |
1080 f[i++] = p + 1; | |
1081 if (i == XLFD_LAST_INDEX) | |
1082 break; | |
1083 } | |
1084 f[i] = name + len; | |
1085 | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1086 #define INTERN_FIELD(N) font_intern_prop (f[N], f[(N) + 1] - 1 - f[N], 0) |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1087 #define INTERN_FIELD_SYM(N) font_intern_prop (f[N], f[(N) + 1] - 1 - f[N], 1) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1088 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1089 if (i == XLFD_LAST_INDEX) |
90400 | 1090 { |
94926 | 1091 /* Fully specified XLFD. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1092 int pixel_size; |
94926 | 1093 |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1094 ASET (font, FONT_FOUNDRY_INDEX, INTERN_FIELD_SYM (XLFD_FOUNDRY_INDEX)); |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1095 ASET (font, FONT_FAMILY_INDEX, INTERN_FIELD_SYM (XLFD_FAMILY_INDEX)); |
94926 | 1096 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; |
1097 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90400 | 1098 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1099 val = INTERN_FIELD_SYM (i); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1100 if (! NILP (val)) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1101 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1102 if ((n = font_style_to_value (j, INTERN_FIELD_SYM (i), 0)) < 0) |
94926 | 1103 return -1; |
1104 ASET (font, j, make_number (n)); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1105 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1106 } |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1107 ASET (font, FONT_ADSTYLE_INDEX, INTERN_FIELD_SYM (XLFD_ADSTYLE_INDEX)); |
94926 | 1108 if (strcmp (f[XLFD_REGISTRY_INDEX], "*-*") == 0) |
1109 ASET (font, FONT_REGISTRY_INDEX, Qnil); | |
1110 else | |
1111 ASET (font, FONT_REGISTRY_INDEX, | |
1112 font_intern_prop (f[XLFD_REGISTRY_INDEX], | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1113 f[XLFD_LAST_INDEX] - f[XLFD_REGISTRY_INDEX], |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1114 1)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1115 p = f[XLFD_PIXEL_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1116 if (*p == '[' && (pixel_size = parse_matrix (p)) >= 0) |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
1117 ASET (font, FONT_SIZE_INDEX, make_number (pixel_size)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1118 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1119 { |
94926 | 1120 val = INTERN_FIELD (XLFD_PIXEL_INDEX); |
1121 if (INTEGERP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1122 ASET (font, FONT_SIZE_INDEX, val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1123 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1124 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1125 double point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1126 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1127 font_assert (FONT_SPEC_P (font)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1128 p = f[XLFD_POINT_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1129 if (*p == '[') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1130 point_size = parse_matrix (p); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1131 else if (isdigit (*p)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1132 point_size = atoi (p), point_size /= 10; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1133 if (point_size >= 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1134 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1135 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1136 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1137 |
104091
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1138 val = INTERN_FIELD (XLFD_RESY_INDEX); |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1139 if (! NILP (val) && ! INTEGERP (val)) |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1140 return -1; |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1141 ASET (font, FONT_DPI_INDEX, val); |
94926 | 1142 val = INTERN_FIELD (XLFD_SPACING_INDEX); |
1143 if (! NILP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1144 { |
94926 | 1145 val = font_prop_validate_spacing (QCspacing, val); |
1146 if (! INTEGERP (val)) | |
1147 return -1; | |
1148 ASET (font, FONT_SPACING_INDEX, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1149 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1150 p = f[XLFD_AVGWIDTH_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1151 if (*p == '~') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1152 p++; |
104091
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1153 val = font_intern_prop (p, f[XLFD_REGISTRY_INDEX] - 1 - p, 0); |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1154 if (! NILP (val) && ! INTEGERP (val)) |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1155 return -1; |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1156 ASET (font, FONT_AVGWIDTH_INDEX, val); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1157 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1158 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1159 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1160 int wild_card_found = 0; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1161 Lisp_Object prop[XLFD_LAST_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1162 |
94926 | 1163 if (FONT_ENTITY_P (font)) |
1164 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1165 for (j = 0; j < i; j++) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1166 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1167 if (*f[j] == '*') |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1168 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1169 if (f[j][1] && f[j][1] != '-') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1170 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1171 prop[j] = Qnil; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1172 wild_card_found = 1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1173 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1174 else if (j + 1 < i) |
94926 | 1175 prop[j] = INTERN_FIELD (j); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1176 else |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1177 prop[j] = font_intern_prop (f[j], f[i] - f[j], 0); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1178 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1179 if (! wild_card_found) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1180 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1181 if (font_expand_wildcards (prop, i) < 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1182 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1183 |
94926 | 1184 ASET (font, FONT_FOUNDRY_INDEX, prop[XLFD_FOUNDRY_INDEX]); |
1185 ASET (font, FONT_FAMILY_INDEX, prop[XLFD_FAMILY_INDEX]); | |
1186 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; | |
1187 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1188 if (! NILP (prop[i])) |
94926 | 1189 { |
1190 if ((n = font_style_to_value (j, prop[i], 1)) < 0) | |
1191 return -1; | |
1192 ASET (font, j, make_number (n)); | |
1193 } | |
1194 ASET (font, FONT_ADSTYLE_INDEX, prop[XLFD_ADSTYLE_INDEX]); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1195 val = prop[XLFD_REGISTRY_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1196 if (NILP (val)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1197 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1198 val = prop[XLFD_ENCODING_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1199 if (! NILP (val)) |
94926 | 1200 val = concat2 (build_string ("*-"), SYMBOL_NAME (val)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1201 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1202 else if (NILP (prop[XLFD_ENCODING_INDEX])) |
94926 | 1203 val = concat2 (SYMBOL_NAME (val), build_string ("-*")); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1204 else |
94926 | 1205 val = concat3 (SYMBOL_NAME (val), build_string ("-"), |
1206 SYMBOL_NAME (prop[XLFD_ENCODING_INDEX])); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1207 if (! NILP (val)) |
94926 | 1208 ASET (font, FONT_REGISTRY_INDEX, Fintern (val, Qnil)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1209 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1210 if (INTEGERP (prop[XLFD_PIXEL_INDEX])) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1211 ASET (font, FONT_SIZE_INDEX, prop[XLFD_PIXEL_INDEX]); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1212 else if (INTEGERP (prop[XLFD_POINT_INDEX])) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1213 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1214 double point_size = XINT (prop[XLFD_POINT_INDEX]); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1215 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1216 ASET (font, FONT_SIZE_INDEX, make_float (point_size / 10)); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1217 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1218 |
94926 | 1219 if (INTEGERP (prop[XLFD_RESX_INDEX])) |
1220 ASET (font, FONT_DPI_INDEX, prop[XLFD_RESY_INDEX]); | |
1221 if (! NILP (prop[XLFD_SPACING_INDEX])) | |
1222 { | |
1223 val = font_prop_validate_spacing (QCspacing, | |
1224 prop[XLFD_SPACING_INDEX]); | |
1225 if (! INTEGERP (val)) | |
1226 return -1; | |
1227 ASET (font, FONT_SPACING_INDEX, val); | |
1228 } | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1229 if (INTEGERP (prop[XLFD_AVGWIDTH_INDEX])) |
94926 | 1230 ASET (font, FONT_AVGWIDTH_INDEX, prop[XLFD_AVGWIDTH_INDEX]); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1231 } |
90400 | 1232 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1233 return 0; |
90400 | 1234 } |
1235 | |
1236 /* Store XLFD name of FONT (font-spec or font-entity) in NAME (NBYTES | |
1237 length), and return the name length. If FONT_SIZE_INDEX of FONT is | |
1238 0, use PIXEL_SIZE instead. */ | |
1239 | |
1240 int | |
1241 font_unparse_xlfd (font, pixel_size, name, nbytes) | |
1242 Lisp_Object font; | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1243 int pixel_size; |
90400 | 1244 char *name; |
1245 int nbytes; | |
1246 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1247 char *f[XLFD_REGISTRY_INDEX + 1]; |
90400 | 1248 Lisp_Object val; |
1249 int i, j, len = 0; | |
1250 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1251 font_assert (FONTP (font)); |
90400 | 1252 |
1253 for (i = FONT_FOUNDRY_INDEX, j = XLFD_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; | |
1254 i++, j++) | |
1255 { | |
1256 if (i == FONT_ADSTYLE_INDEX) | |
1257 j = XLFD_ADSTYLE_INDEX; | |
1258 else if (i == FONT_REGISTRY_INDEX) | |
1259 j = XLFD_REGISTRY_INDEX; | |
1260 val = AREF (font, i); | |
1261 if (NILP (val)) | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1262 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1263 if (j == XLFD_REGISTRY_INDEX) |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1264 f[j] = "*-*", len += 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1265 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1266 f[j] = "*", len += 2; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1267 } |
90400 | 1268 else |
1269 { | |
1270 if (SYMBOLP (val)) | |
1271 val = SYMBOL_NAME (val); | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1272 if (j == XLFD_REGISTRY_INDEX |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1273 && ! strchr ((char *) SDATA (val), '-')) |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1274 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1275 /* Change "jisx0208*" and "jisx0208" to "jisx0208*-*". */ |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1276 if (SDATA (val)[SBYTES (val) - 1] == '*') |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1277 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1278 f[j] = alloca (SBYTES (val) + 3); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1279 sprintf (f[j], "%s-*", SDATA (val)); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1280 len += SBYTES (val) + 3; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1281 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1282 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1283 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1284 f[j] = alloca (SBYTES (val) + 4); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1285 sprintf (f[j], "%s*-*", SDATA (val)); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1286 len += SBYTES (val) + 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1287 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1288 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1289 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1290 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
90400 | 1291 } |
1292 } | |
1293 | |
1294 for (i = FONT_WEIGHT_INDEX, j = XLFD_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; | |
1295 i++, j++) | |
1296 { | |
94926 | 1297 val = font_style_symbolic (font, i, 0); |
90400 | 1298 if (NILP (val)) |
1299 f[j] = "*", len += 2; | |
1300 else | |
1301 { | |
94926 | 1302 val = SYMBOL_NAME (val); |
90400 | 1303 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
1304 } | |
1305 } | |
1306 | |
1307 val = AREF (font, FONT_SIZE_INDEX); | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1308 font_assert (NUMBERP (val) || NILP (val)); |
90400 | 1309 if (INTEGERP (val)) |
1310 { | |
94926 | 1311 i = XINT (val); |
91943
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1312 if (i <= 0) |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1313 i = pixel_size; |
90400 | 1314 if (i > 0) |
91943
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1315 { |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1316 f[XLFD_PIXEL_INDEX] = alloca (22); |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1317 len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", i) + 1; |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1318 } |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1319 else |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1320 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
90400 | 1321 } |
1322 else if (FLOATP (val)) | |
1323 { | |
94926 | 1324 i = XFLOAT_DATA (val) * 10; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1325 f[XLFD_PIXEL_INDEX] = alloca (12); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1326 len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1; |
90400 | 1327 } |
1328 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1329 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1330 |
94926 | 1331 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) |
90400 | 1332 { |
94926 | 1333 i = XINT (AREF (font, FONT_DPI_INDEX)); |
1334 f[XLFD_RESX_INDEX] = alloca (22); | |
1335 len += sprintf (f[XLFD_RESX_INDEX], | |
1336 "%d-%d", i, i) + 1; | |
90400 | 1337 } |
1338 else | |
94926 | 1339 f[XLFD_RESX_INDEX] = "*-*", len += 4; |
1340 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1341 { |
94926 | 1342 int spacing = XINT (AREF (font, FONT_SPACING_INDEX)); |
1343 | |
1344 f[XLFD_SPACING_INDEX] = (spacing <= FONT_SPACING_PROPORTIONAL ? "p" | |
1345 : spacing <= FONT_SPACING_DUAL ? "d" | |
1346 : spacing <= FONT_SPACING_MONO ? "m" | |
1347 : "c"); | |
1348 len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1349 } |
94926 | 1350 else |
1351 f[XLFD_SPACING_INDEX] = "*", len += 2; | |
1352 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1353 { | |
1354 f[XLFD_AVGWIDTH_INDEX] = alloca (11); | |
1355 len += sprintf (f[XLFD_AVGWIDTH_INDEX], | |
1356 "%d", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; | |
1357 } | |
1358 else | |
1359 f[XLFD_AVGWIDTH_INDEX] = "*", len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1360 len++; /* for terminating '\0'. */ |
90400 | 1361 if (len >= nbytes) |
1362 return -1; | |
94926 | 1363 return sprintf (name, "-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s", |
90400 | 1364 f[XLFD_FOUNDRY_INDEX], f[XLFD_FAMILY_INDEX], |
1365 f[XLFD_WEIGHT_INDEX], f[XLFD_SLANT_INDEX], | |
94926 | 1366 f[XLFD_SWIDTH_INDEX], f[XLFD_ADSTYLE_INDEX], |
1367 f[XLFD_PIXEL_INDEX], f[XLFD_RESX_INDEX], | |
1368 f[XLFD_SPACING_INDEX], f[XLFD_AVGWIDTH_INDEX], | |
1369 f[XLFD_REGISTRY_INDEX]); | |
90400 | 1370 } |
1371 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1372 /* Parse NAME (null terminated) and store information in FONT |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1373 (font-spec or font-entity). NAME is supplied in either the |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1374 Fontconfig or GTK font name format. If NAME is successfully |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1375 parsed, return 0. Otherwise return -1. |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1376 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1377 The fontconfig format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1378 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1379 FAMILY[-SIZE][:PROP1[=VAL1][:PROP2[=VAL2]...]] |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1380 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1381 The GTK format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1382 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1383 FAMILY [PROPS...] [SIZE] |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1384 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1385 This function tries to guess which format it is. */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1386 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1387 int |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1388 font_parse_fcname (name, font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1389 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1390 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1391 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1392 char *p, *q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1393 char *size_beg = NULL, *size_end = NULL; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1394 char *props_beg = NULL, *family_end = NULL; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1395 int len = strlen (name); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1396 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1397 if (len == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1398 return -1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1399 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1400 for (p = name; *p; p++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1401 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1402 if (*p == '\\' && p[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1403 p++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1404 else if (*p == ':') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1405 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1406 props_beg = family_end = p; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1407 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1408 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1409 else if (*p == '-') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1410 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1411 int decimal = 0, size_found = 1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1412 for (q = p + 1; *q && *q != ':'; q++) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1413 if (! isdigit(*q)) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1414 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1415 if (*q != '.' || decimal) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1416 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1417 size_found = 0; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1418 break; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1419 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1420 decimal = 1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1421 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1422 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1423 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1424 family_end = p; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1425 size_beg = p + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1426 size_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1427 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1428 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1429 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1430 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1431 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1432 if (family_end) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1433 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1434 /* A fontconfig name with size and/or property data. */ |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1435 if (family_end > name) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1436 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1437 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1438 family = font_intern_prop (name, family_end - name, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1439 ASET (font, FONT_FAMILY_INDEX, family); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1440 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1441 if (size_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1442 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1443 double point_size = strtod (size_beg, &size_end); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1444 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1445 if (*size_end == ':' && size_end[1]) |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1446 props_beg = size_end; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1447 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1448 if (props_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1449 { |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1450 /* Now parse ":KEY=VAL" patterns. */ |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1451 Lisp_Object val; |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1452 |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1453 for (p = props_beg; *p; p = q) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1454 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1455 for (q = p + 1; *q && *q != '=' && *q != ':'; q++); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1456 if (*q != '=') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1457 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1458 /* Must be an enumerated value. */ |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1459 int word_len; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1460 p = p + 1; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1461 word_len = q - p; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1462 val = font_intern_prop (p, q - p, 1); |
95984 | 1463 |
1464 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) | |
1465 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1466 if (PROP_MATCH ("light", 5) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1467 || PROP_MATCH ("medium", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1468 || PROP_MATCH ("demibold", 8) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1469 || PROP_MATCH ("bold", 4) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1470 || PROP_MATCH ("black", 5)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1471 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, val); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1472 else if (PROP_MATCH ("roman", 5) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1473 || PROP_MATCH ("italic", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1474 || PROP_MATCH ("oblique", 7)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1475 FONT_SET_STYLE (font, FONT_SLANT_INDEX, val); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1476 else if (PROP_MATCH ("charcell", 8)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1477 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1478 make_number (FONT_SPACING_CHARCELL)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1479 else if (PROP_MATCH ("mono", 4)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1480 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1481 make_number (FONT_SPACING_MONO)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1482 else if (PROP_MATCH ("proportional", 12)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1483 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1484 make_number (FONT_SPACING_PROPORTIONAL)); |
95984 | 1485 #undef PROP_MATCH |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1486 } |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1487 else |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1488 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1489 /* KEY=VAL pairs */ |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1490 Lisp_Object key; |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1491 int prop; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1492 |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1493 if (q - p == 10 && memcmp (p + 1, "pixelsize", 9) == 0) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1494 prop = FONT_SIZE_INDEX; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1495 else |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1496 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1497 key = font_intern_prop (p, q - p, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1498 prop = get_font_prop_index (key); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1499 } |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1500 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1501 p = q + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1502 for (q = p; *q && *q != ':'; q++); |
95983
104a55eb192a
(font_parse_fcname): Correctly parse KEY=VAL values.
Chong Yidong <cyd@stupidchicken.com>
parents:
95972
diff
changeset
|
1503 val = font_intern_prop (p, q - p, 0); |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1504 |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1505 if (prop >= FONT_FOUNDRY_INDEX |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1506 && prop < FONT_EXTRA_INDEX) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1507 ASET (font, prop, font_prop_validate (prop, Qnil, val)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1508 else |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1509 Ffont_put (font, key, val); |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1510 } |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1511 p = q; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1512 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1513 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1514 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1515 else |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1516 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1517 /* Either a fontconfig-style name with no size and property |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1518 data, or a GTK-style name. */ |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1519 Lisp_Object prop; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1520 int word_len, prop_found = 0; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1521 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1522 for (p = name; *p; p = *q ? q + 1 : q) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1523 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1524 if (isdigit (*p)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1525 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1526 int size_found = 1; |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
1527 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1528 for (q = p + 1; *q && *q != ' '; q++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1529 if (! isdigit (*q)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1530 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1531 size_found = 0; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1532 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1533 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1534 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1535 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1536 double point_size = strtod (p, &q); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1537 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1538 continue; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1539 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1540 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1541 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1542 for (q = p + 1; *q && *q != ' '; q++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1543 if (*q == '\\' && q[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1544 q++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1545 word_len = q - p; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1546 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1547 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1548 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1549 if (PROP_MATCH ("Ultra-Light", 11)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1550 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1551 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1552 prop = font_intern_prop ("ultra-light", 11, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1553 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1554 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1555 else if (PROP_MATCH ("Light", 5)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1556 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1557 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1558 prop = font_intern_prop ("light", 5, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1559 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
1560 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1561 else if (PROP_MATCH ("Semi-Bold", 9)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1562 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1563 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1564 prop = font_intern_prop ("semi-bold", 9, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1565 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1566 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1567 else if (PROP_MATCH ("Bold", 4)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1568 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1569 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1570 prop = font_intern_prop ("bold", 4, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1571 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1572 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1573 else if (PROP_MATCH ("Italic", 6)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1574 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1575 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1576 prop = font_intern_prop ("italic", 4, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1577 FONT_SET_STYLE (font, FONT_SLANT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1578 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1579 else if (PROP_MATCH ("Oblique", 7)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1580 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1581 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1582 prop = font_intern_prop ("oblique", 7, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1583 FONT_SET_STYLE (font, FONT_SLANT_INDEX, prop); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1584 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1585 else { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1586 if (prop_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1587 return -1; /* Unknown property in GTK-style font name. */ |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1588 family_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1589 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1590 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1591 #undef PROP_MATCH |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1592 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1593 if (family_end) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1594 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1595 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1596 family = font_intern_prop (name, family_end - name, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1597 ASET (font, FONT_FAMILY_INDEX, family); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1598 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1599 } |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
1600 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1601 return 0; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1602 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1603 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1604 /* Store fontconfig's font name of FONT (font-spec or font-entity) in |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1605 NAME (NBYTES length), and return the name length. If |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1606 FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead. */ |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1607 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1608 int |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1609 font_unparse_fcname (font, pixel_size, name, nbytes) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1610 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1611 int pixel_size; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1612 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1613 int nbytes; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1614 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1615 Lisp_Object family, foundry; |
94926 | 1616 Lisp_Object tail, val; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1617 int point_size; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1618 int i, len = 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1619 char *p; |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1620 Lisp_Object styles[3]; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
1621 char *style_names[3] = { "weight", "slant", "width" }; |
94926 | 1622 char work[256]; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1623 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1624 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1625 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1626 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1627 if (SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1628 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1629 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1630 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1631 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1632 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1633 family = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1634 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1635 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1636 val = AREF (font, FONT_SIZE_INDEX); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1637 if (INTEGERP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1638 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1639 if (XINT (val) != 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1640 pixel_size = XINT (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1641 point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1642 len += 21; /* for ":pixelsize=NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1643 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1644 else if (FLOATP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1645 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1646 pixel_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1647 point_size = (int) XFLOAT_DATA (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1648 len += 11; /* for "-NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1649 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1650 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1651 foundry = AREF (font, FONT_FOUNDRY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1652 if (! NILP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1653 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1654 if (SYMBOLP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1655 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1656 foundry = SYMBOL_NAME (foundry); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1657 len += 9 + SBYTES (foundry); /* ":foundry=NAME" */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1658 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1659 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1660 foundry = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1661 } |
94926 | 1662 |
1663 for (i = 0; i < 3; i++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1664 { |
94926 | 1665 styles[i] = font_style_symbolic (font, FONT_WEIGHT_INDEX + i, 0); |
1666 if (! NILP (styles[i])) | |
1667 len += sprintf (work, ":%s=%s", style_names[i], | |
1668 SDATA (SYMBOL_NAME (styles[i]))); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1669 } |
94926 | 1670 |
1671 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
100126
dcdbc6ad9e02
(font_unparse_fcname): Fix use of uninitialized variable.
Andreas Schwab <schwab@suse.de>
parents:
100103
diff
changeset
|
1672 len += sprintf (work, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX))); |
94926 | 1673 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) |
1674 len += strlen (":spacing=100"); | |
1675 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1676 len += strlen (":scalable=false"); /* or ":scalable=true" */ | |
1677 for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1678 { |
94926 | 1679 Lisp_Object key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail)); |
1680 | |
1681 len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */ | |
1682 if (STRINGP (val)) | |
1683 len += SBYTES (val); | |
1684 else if (INTEGERP (val)) | |
1685 len += sprintf (work, "%d", XINT (val)); | |
1686 else if (SYMBOLP (val)) | |
1687 len += (NILP (val) ? 5 : 4); /* for "false" or "true" */ | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1688 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1689 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1690 if (len > nbytes) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1691 return -1; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1692 p = name; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1693 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1694 p += sprintf (p, "%s", SDATA (family)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1695 if (point_size > 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1696 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1697 if (p == name) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1698 p += sprintf (p, "%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1699 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1700 p += sprintf (p, "-%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1701 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1702 else if (pixel_size > 0) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1703 p += sprintf (p, ":pixelsize=%d", pixel_size); |
94926 | 1704 if (! NILP (AREF (font, FONT_FOUNDRY_INDEX))) |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1705 p += sprintf (p, ":foundry=%s", |
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1706 SDATA (SYMBOL_NAME (AREF (font, FONT_FOUNDRY_INDEX)))); |
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1707 for (i = 0; i < 3; i++) |
94926 | 1708 if (! NILP (styles[i])) |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1709 p += sprintf (p, ":%s=%s", style_names[i], |
94926 | 1710 SDATA (SYMBOL_NAME (styles[i]))); |
1711 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
1712 p += sprintf (p, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX))); | |
1713 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) | |
1714 p += sprintf (p, ":spacing=%d", XINT (AREF (font, FONT_SPACING_INDEX))); | |
1715 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1716 { | |
1717 if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0) | |
1718 p += sprintf (p, ":scalable=true"); | |
1719 else | |
1720 p += sprintf (p, ":scalable=false"); | |
1721 } | |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1722 return (p - name); |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1723 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1724 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1725 /* Store GTK-style font name of FONT (font-spec or font-entity) in |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1726 NAME (NBYTES length), and return the name length. F is the frame |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1727 on which the font is displayed; it is used to calculate the point |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1728 size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1729 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1730 int |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1731 font_unparse_gtkname (font, f, name, nbytes) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1732 Lisp_Object font; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1733 struct frame *f; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1734 char *name; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1735 int nbytes; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1736 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1737 char *p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1738 int len = 1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1739 Lisp_Object family, weight, slant, size; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1740 int point_size = -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1741 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1742 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1743 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1744 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1745 if (! SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1746 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1747 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1748 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1749 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1750 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1751 weight = font_style_symbolic (font, FONT_WEIGHT_INDEX, 0); |
96017
54d310663505
(font_unparse_gtkname): Use EQ to compare Lisp_Objects.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96016
diff
changeset
|
1752 if (EQ (weight, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1753 weight = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1754 else if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1755 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1756 weight = SYMBOL_NAME (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1757 len += SBYTES (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1758 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1759 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1760 slant = font_style_symbolic (font, FONT_SLANT_INDEX, 0); |
96017
54d310663505
(font_unparse_gtkname): Use EQ to compare Lisp_Objects.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96016
diff
changeset
|
1761 if (EQ (slant, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1762 slant = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1763 else if (! NILP (slant)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1764 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1765 slant = SYMBOL_NAME (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1766 len += SBYTES (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1767 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1768 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1769 size = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1770 /* Convert pixel size to point size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1771 if (INTEGERP (size)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1772 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1773 Lisp_Object font_dpi = AREF (font, FONT_DPI_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1774 int dpi = 75; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1775 if (INTEGERP (font_dpi)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1776 dpi = XINT (font_dpi); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1777 else if (f) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1778 dpi = f->resy; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1779 point_size = PIXEL_TO_POINT (XINT (size), dpi); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1780 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1781 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1782 else if (FLOATP (size)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1783 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1784 point_size = (int) XFLOAT_DATA (size); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1785 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1786 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1787 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1788 if (len > nbytes) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1789 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1790 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1791 p = name + sprintf (name, "%s", SDATA (family)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1792 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1793 if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1794 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1795 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1796 p += sprintf (p, " %s", SDATA (weight)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1797 q[1] = toupper (q[1]); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1798 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1799 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1800 if (! NILP (slant)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1801 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1802 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1803 p += sprintf (p, " %s", SDATA (slant)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1804 q[1] = toupper (q[1]); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1805 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1806 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1807 if (point_size > 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1808 p += sprintf (p, " %d", point_size); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1809 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1810 return (p - name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1811 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1812 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1813 /* Parse NAME (null terminated) and store information in FONT |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1814 (font-spec or font-entity). If NAME is successfully parsed, return |
94926 | 1815 0. Otherwise return -1. */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1816 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1817 static int |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1818 font_parse_name (name, font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1819 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1820 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1821 { |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
1822 if (name[0] == '-' || index (name, '*') || index (name, '?')) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1823 return font_parse_xlfd (name, font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1824 return font_parse_fcname (name, font); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1825 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1826 |
94926 | 1827 |
1828 /* Merge FAMILY and REGISTRY into FONT_SPEC. FAMILY may have the form | |
1829 "FAMILY-FOUNDRY". REGISTRY may not contain charset-encoding | |
1830 part. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1831 |
90400 | 1832 void |
94926 | 1833 font_parse_family_registry (family, registry, font_spec) |
1834 Lisp_Object family, registry, font_spec; | |
90400 | 1835 { |
94926 | 1836 int len; |
1837 char *p0, *p1; | |
1838 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1839 if (! NILP (family) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1840 && NILP (AREF (font_spec, FONT_FAMILY_INDEX))) |
90400 | 1841 { |
94926 | 1842 CHECK_STRING (family); |
1843 len = SBYTES (family); | |
1844 p0 = (char *) SDATA (family); | |
1845 p1 = index (p0, '-'); | |
1846 if (p1) | |
90400 | 1847 { |
103369
97cfffb6f666
(font_parse_family_registry): Fix for one-char foundry.
Kenichi Handa <handa@m17n.org>
parents:
103255
diff
changeset
|
1848 if ((*p0 != '*' && p1 - p0 > 0) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1849 && NILP (AREF (font_spec, FONT_FOUNDRY_INDEX))) |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1850 Ffont_put (font_spec, QCfoundry, font_intern_prop (p0, p1 - p0, 1)); |
94926 | 1851 p1++; |
1852 len -= p1 - p0; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1853 Ffont_put (font_spec, QCfamily, font_intern_prop (p1, len, 1)); |
90400 | 1854 } |
94926 | 1855 else |
1856 ASET (font_spec, FONT_FAMILY_INDEX, Fintern (family, Qnil)); | |
1857 } | |
1858 if (! NILP (registry)) | |
1859 { | |
1860 /* Convert "XXX" and "XXX*" to "XXX*-*". */ | |
1861 CHECK_STRING (registry); | |
1862 len = SBYTES (registry); | |
1863 p0 = (char *) SDATA (registry); | |
1864 p1 = index (p0, '-'); | |
1865 if (! p1) | |
1866 { | |
1867 if (SDATA (registry)[len - 1] == '*') | |
1868 registry = concat2 (registry, build_string ("-*")); | |
1869 else | |
1870 registry = concat2 (registry, build_string ("*-*")); | |
1871 } | |
1872 registry = Fdowncase (registry); | |
1873 ASET (font_spec, FONT_REGISTRY_INDEX, Fintern (registry, Qnil)); | |
90400 | 1874 } |
1875 } | |
1876 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1877 |
94926 | 1878 /* This part (through the next ^L) is still experimental and not |
1879 tested much. We may drastically change codes. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1880 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1881 /* OTF handler */ |
90541 | 1882 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1883 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1884 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1885 #define LGSTRING_HEADER_SIZE 6 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1886 #define LGSTRING_GLYPH_SIZE 8 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1887 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1888 static int |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1889 check_gstring (gstring) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1890 Lisp_Object gstring; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1891 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1892 Lisp_Object val; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1893 int i, j; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1894 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1895 CHECK_VECTOR (gstring); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1896 val = AREF (gstring, 0); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1897 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1898 if (ASIZE (val) < LGSTRING_HEADER_SIZE) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1899 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1900 CHECK_FONT_OBJECT (LGSTRING_FONT (gstring)); |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1901 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1902 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1903 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1904 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1905 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1906 CHECK_NATNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1907 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1908 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1909 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1910 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1911 |
97822 | 1912 for (i = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1913 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1914 val = LGSTRING_GLYPH (gstring, i); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1915 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1916 if (ASIZE (val) < LGSTRING_GLYPH_SIZE) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1917 goto err; |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1918 if (NILP (AREF (val, LGLYPH_IX_CHAR))) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1919 break; |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1920 CHECK_NATNUM (AREF (val, LGLYPH_IX_FROM)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1921 CHECK_NATNUM (AREF (val, LGLYPH_IX_TO)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1922 CHECK_CHARACTER (AREF (val, LGLYPH_IX_CHAR)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1923 if (!NILP (AREF (val, LGLYPH_IX_CODE))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1924 CHECK_NATNUM (AREF (val, LGLYPH_IX_CODE)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1925 if (!NILP (AREF (val, LGLYPH_IX_WIDTH))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1926 CHECK_NATNUM (AREF (val, LGLYPH_IX_WIDTH)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1927 if (!NILP (AREF (val, LGLYPH_IX_ADJUSTMENT))) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1928 { |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1929 val = AREF (val, LGLYPH_IX_ADJUSTMENT); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1930 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1931 if (ASIZE (val) < 3) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1932 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1933 for (j = 0; j < 3; j++) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1934 CHECK_NUMBER (AREF (val, j)); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1935 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1936 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1937 return i; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1938 err: |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1939 error ("Invalid glyph-string format"); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1940 return -1; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1941 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1942 |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1943 static void |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1944 check_otf_features (otf_features) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1945 Lisp_Object otf_features; |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1946 { |
94926 | 1947 Lisp_Object val; |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1948 |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1949 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1950 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1951 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1952 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1953 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1954 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1955 for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val)) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1956 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1957 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1958 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1959 error ("Invalid OTF GSUB feature: %s", SYMBOL_NAME (XCAR (val))); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1960 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1961 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1962 for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val)) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1963 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1964 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1965 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1966 error ("Invalid OTF GPOS feature: %s", SYMBOL_NAME (XCAR (val))); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1967 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1968 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1969 |
90400 | 1970 #ifdef HAVE_LIBOTF |
1971 #include <otf.h> | |
1972 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1973 Lisp_Object otf_list; |
90400 | 1974 |
1975 static Lisp_Object | |
1976 otf_tag_symbol (tag) | |
1977 OTF_Tag tag; | |
1978 { | |
1979 char name[5]; | |
1980 | |
1981 OTF_tag_name (tag, name); | |
1982 return Fintern (make_unibyte_string (name, 4), Qnil); | |
1983 } | |
1984 | |
1985 static OTF * | |
94926 | 1986 otf_open (file) |
1987 Lisp_Object file; | |
90400 | 1988 { |
94926 | 1989 Lisp_Object val = Fassoc (file, otf_list); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1990 OTF *otf; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1991 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1992 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1993 otf = XSAVE_VALUE (XCDR (val))->pointer; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1994 else |
90400 | 1995 { |
94926 | 1996 otf = STRINGP (file) ? OTF_open ((char *) SDATA (file)) : NULL; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1997 val = make_save_value (otf, 0); |
94926 | 1998 otf_list = Fcons (Fcons (file, val), otf_list); |
90400 | 1999 } |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2000 return otf; |
90400 | 2001 } |
2002 | |
2003 | |
2004 /* Return a list describing which scripts/languages FONT supports by | |
2005 which GSUB/GPOS features of OpenType tables. See the comment of | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2006 (struct font_driver).otf_capability. */ |
90400 | 2007 |
2008 Lisp_Object | |
2009 font_otf_capability (font) | |
2010 struct font *font; | |
2011 { | |
2012 OTF *otf; | |
2013 Lisp_Object capability = Fcons (Qnil, Qnil); | |
2014 int i; | |
2015 | |
94926 | 2016 otf = otf_open (font->props[FONT_FILE_INDEX]); |
90400 | 2017 if (! otf) |
2018 return Qnil; | |
2019 for (i = 0; i < 2; i++) | |
2020 { | |
2021 OTF_GSUB_GPOS *gsub_gpos; | |
2022 Lisp_Object script_list = Qnil; | |
2023 int j; | |
2024 | |
2025 if (OTF_get_features (otf, i == 0) < 0) | |
2026 continue; | |
2027 gsub_gpos = i == 0 ? otf->gsub : otf->gpos; | |
2028 for (j = gsub_gpos->ScriptList.ScriptCount - 1; j >= 0; j--) | |
2029 { | |
2030 OTF_Script *script = gsub_gpos->ScriptList.Script + j; | |
2031 Lisp_Object langsys_list = Qnil; | |
2032 Lisp_Object script_tag = otf_tag_symbol (script->ScriptTag); | |
2033 int k; | |
2034 | |
2035 for (k = script->LangSysCount; k >= 0; k--) | |
2036 { | |
2037 OTF_LangSys *langsys; | |
2038 Lisp_Object feature_list = Qnil; | |
2039 Lisp_Object langsys_tag; | |
2040 int l; | |
2041 | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2042 if (k == script->LangSysCount) |
90400 | 2043 { |
2044 langsys = &script->DefaultLangSys; | |
2045 langsys_tag = Qnil; | |
2046 } | |
2047 else | |
2048 { | |
2049 langsys = script->LangSys + k; | |
2050 langsys_tag | |
2051 = otf_tag_symbol (script->LangSysRecord[k].LangSysTag); | |
2052 } | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2053 for (l = langsys->FeatureCount - 1; l >= 0; l--) |
90400 | 2054 { |
2055 OTF_Feature *feature | |
2056 = gsub_gpos->FeatureList.Feature + langsys->FeatureIndex[l]; | |
2057 Lisp_Object feature_tag | |
2058 = otf_tag_symbol (feature->FeatureTag); | |
2059 | |
2060 feature_list = Fcons (feature_tag, feature_list); | |
2061 } | |
2062 langsys_list = Fcons (Fcons (langsys_tag, feature_list), | |
2063 langsys_list); | |
2064 } | |
2065 script_list = Fcons (Fcons (script_tag, langsys_list), | |
2066 script_list); | |
2067 } | |
2068 | |
2069 if (i == 0) | |
2070 XSETCAR (capability, script_list); | |
2071 else | |
2072 XSETCDR (capability, script_list); | |
2073 } | |
2074 | |
2075 return capability; | |
2076 } | |
2077 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2078 /* Parse OTF features in SPEC and write a proper features spec string |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2079 in FEATURES for the call of OTF_drive_gsub/gpos (of libotf). It is |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2080 assured that the sufficient memory has already allocated for |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2081 FEATURES. */ |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2082 |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2083 static void |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2084 generate_otf_features (spec, features) |
90400 | 2085 Lisp_Object spec; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2086 char *features; |
90400 | 2087 { |
2088 Lisp_Object val; | |
94926 | 2089 char *p; |
90400 | 2090 int asterisk; |
2091 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2092 p = features; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2093 *p = '\0'; |
90400 | 2094 for (asterisk = 0; CONSP (spec); spec = XCDR (spec)) |
2095 { | |
2096 val = XCAR (spec); | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2097 CHECK_SYMBOL (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2098 if (p > features) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2099 *p++ = ','; |
90400 | 2100 if (SREF (SYMBOL_NAME (val), 0) == '*') |
2101 { | |
2102 asterisk = 1; | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2103 *p++ = '*'; |
90400 | 2104 } |
2105 else if (! asterisk) | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2106 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2107 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2108 p += sprintf (p, "%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2109 } |
90400 | 2110 else |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2111 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2112 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2113 p += sprintf (p, "~%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2114 } |
90400 | 2115 } |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2116 if (CONSP (spec)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2117 error ("OTF spec too long"); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2118 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2119 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2120 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2121 font_otf_DeviceTable (device_table) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2122 OTF_DeviceTable *device_table; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2123 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2124 int len = device_table->StartSize - device_table->EndSize + 1; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2125 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2126 return Fcons (make_number (len), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2127 make_unibyte_string (device_table->DeltaValue, len)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2128 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2129 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2130 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2131 font_otf_ValueRecord (value_format, value_record) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2132 int value_format; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2133 OTF_ValueRecord *value_record; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2134 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2135 Lisp_Object val = Fmake_vector (make_number (8), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2136 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2137 if (value_format & OTF_XPlacement) |
91909 | 2138 ASET (val, 0, make_number (value_record->XPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2139 if (value_format & OTF_YPlacement) |
91909 | 2140 ASET (val, 1, make_number (value_record->YPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2141 if (value_format & OTF_XAdvance) |
91909 | 2142 ASET (val, 2, make_number (value_record->XAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2143 if (value_format & OTF_YAdvance) |
91909 | 2144 ASET (val, 3, make_number (value_record->YAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2145 if (value_format & OTF_XPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2146 ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2147 if (value_format & OTF_YPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2148 ASET (val, 4, font_otf_DeviceTable (&value_record->YPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2149 if (value_format & OTF_XAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2150 ASET (val, 4, font_otf_DeviceTable (&value_record->XAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2151 if (value_format & OTF_YAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2152 ASET (val, 4, font_otf_DeviceTable (&value_record->YAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2153 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2154 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2155 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2156 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2157 font_otf_Anchor (anchor) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2158 OTF_Anchor *anchor; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2159 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2160 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2161 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2162 val = Fmake_vector (make_number (anchor->AnchorFormat + 1), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2163 ASET (val, 0, make_number (anchor->XCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2164 ASET (val, 1, make_number (anchor->YCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2165 if (anchor->AnchorFormat == 2) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2166 ASET (val, 2, make_number (anchor->f.f1.AnchorPoint)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2167 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2168 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2169 ASET (val, 3, font_otf_DeviceTable (&anchor->f.f2.XDeviceTable)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2170 ASET (val, 4, font_otf_DeviceTable (&anchor->f.f2.YDeviceTable)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2171 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2172 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2173 } |
90400 | 2174 #endif /* HAVE_LIBOTF */ |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
2175 #endif /* 0 */ |
90400 | 2176 |
2177 | |
2178 /* Font sorting */ | |
2179 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2180 static unsigned font_score P_ ((Lisp_Object, Lisp_Object *)); |
90400 | 2181 static int font_compare P_ ((const void *, const void *)); |
103255
a8e08bcfc3ad
(font_sort_entities): Renamed from font_sort_entites.
Kenichi Handa <handa@m17n.org>
parents:
103246
diff
changeset
|
2182 static Lisp_Object font_sort_entities P_ ((Lisp_Object, Lisp_Object, |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2183 Lisp_Object, int)); |
90400 | 2184 |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2185 /* Return a rescaling ratio of FONT_ENTITY. */ |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2186 extern Lisp_Object Vface_font_rescale_alist; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2187 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2188 static double |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2189 font_rescale_ratio (font_entity) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2190 Lisp_Object font_entity; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2191 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2192 Lisp_Object tail, elt; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2193 Lisp_Object name = Qnil; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2194 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2195 for (tail = Vface_font_rescale_alist; CONSP (tail); tail = XCDR (tail)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2196 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2197 elt = XCAR (tail); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2198 if (FLOATP (XCDR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2199 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2200 if (STRINGP (XCAR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2201 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2202 if (NILP (name)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2203 name = Ffont_xlfd_name (font_entity, Qnil); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2204 if (fast_string_match_ignore_case (XCAR (elt), name) >= 0) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2205 return XFLOAT_DATA (XCDR (elt)); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2206 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2207 else if (FONT_SPEC_P (XCAR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2208 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2209 if (font_match_p (XCAR (elt), font_entity)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2210 return XFLOAT_DATA (XCDR (elt)); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2211 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2212 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2213 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2214 return 1.0; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2215 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2216 |
90400 | 2217 /* We sort fonts by scoring each of them against a specified |
2218 font-spec. The score value is 32 bit (`unsigned'), and the smaller | |
2219 the value is, the closer the font is to the font-spec. | |
2220 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2221 The lowest 2 bits of the score is used for driver type. The font |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2222 available by the most preferred font driver is 0. |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2223 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2224 Each 7-bit in the higher 28 bits are used for numeric properties |
90400 | 2225 WEIGHT, SLANT, WIDTH, and SIZE. */ |
2226 | |
2227 /* How many bits to shift to store the difference value of each font | |
94926 | 2228 property in a score. Note that flots for FONT_TYPE_INDEX and |
2229 FONT_REGISTRY_INDEX are not used. */ | |
90400 | 2230 static int sort_shift_bits[FONT_SIZE_INDEX + 1]; |
2231 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2232 /* Score font-entity ENTITY against properties of font-spec SPEC_PROP. |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2233 The return value indicates how different ENTITY is compared with |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2234 SPEC_PROP. */ |
90400 | 2235 |
2236 static unsigned | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2237 font_score (entity, spec_prop) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2238 Lisp_Object entity, *spec_prop; |
90400 | 2239 { |
2240 unsigned score = 0; | |
2241 int i; | |
94926 | 2242 |
2243 /* Score three style numeric fields. Maximum difference is 127. */ | |
2244 for (i = FONT_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; i++) | |
2245 if (! NILP (spec_prop[i]) && ! EQ (AREF (entity, i), spec_prop[i])) | |
2246 { | |
2247 int diff = (XINT (AREF (entity, i)) >> 8) - (XINT (spec_prop[i]) >> 8); | |
2248 | |
2249 if (diff < 0) | |
2250 diff = - diff; | |
95875
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2251 if (diff > 0) |
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2252 score |= min (diff, 127) << sort_shift_bits[i]; |
94926 | 2253 } |
2254 | |
2255 /* Score the size. Maximum difference is 127. */ | |
2256 i = FONT_SIZE_INDEX; | |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2257 if (! NILP (spec_prop[FONT_SIZE_INDEX]) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2258 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) |
90400 | 2259 { |
94926 | 2260 /* We use the higher 6-bit for the actual size difference. The |
2261 lowest bit is set if the DPI is different. */ | |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2262 int diff; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2263 int pixel_size = XINT (spec_prop[FONT_SIZE_INDEX]); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2264 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2265 if (CONSP (Vface_font_rescale_alist)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2266 pixel_size *= font_rescale_ratio (entity); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2267 diff = pixel_size - XINT (AREF (entity, FONT_SIZE_INDEX)); |
94926 | 2268 if (diff < 0) |
2269 diff = - diff; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2270 diff <<= 1; |
94926 | 2271 if (! NILP (spec_prop[FONT_DPI_INDEX]) |
2272 && ! EQ (spec_prop[FONT_DPI_INDEX], AREF (entity, FONT_DPI_INDEX))) | |
2273 diff |= 1; | |
103041
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2274 if (! NILP (spec_prop[FONT_AVGWIDTH_INDEX]) |
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2275 && ! EQ (spec_prop[FONT_AVGWIDTH_INDEX], AREF (entity, FONT_AVGWIDTH_INDEX))) |
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2276 diff |= 1; |
94926 | 2277 score |= min (diff, 127) << sort_shift_bits[FONT_SIZE_INDEX]; |
90400 | 2278 } |
2279 | |
2280 return score; | |
2281 } | |
2282 | |
2283 | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2284 /* Concatenate all elements of LIST into one vector. LIST is a list |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2285 of font-entity vectors. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2286 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2287 static Lisp_Object |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2288 font_vconcat_entity_vectors (Lisp_Object list) |
90400 | 2289 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2290 int nargs = XINT (Flength (list)); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2291 Lisp_Object *args = alloca (sizeof (Lisp_Object) * nargs); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2292 int i; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2293 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2294 for (i = 0; i < nargs; i++, list = XCDR (list)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2295 args[i] = XCAR (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2296 return Fvconcat (nargs, args); |
90400 | 2297 } |
2298 | |
2299 | |
2300 /* The structure for elements being sorted by qsort. */ | |
2301 struct font_sort_data | |
2302 { | |
2303 unsigned score; | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2304 int font_driver_preference; |
90400 | 2305 Lisp_Object entity; |
2306 }; | |
2307 | |
2308 | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2309 /* The comparison function for qsort. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2310 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2311 static int |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2312 font_compare (d1, d2) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2313 const void *d1, *d2; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2314 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2315 const struct font_sort_data *data1 = d1; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2316 const struct font_sort_data *data2 = d2; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2317 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2318 if (data1->score < data2->score) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2319 return -1; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2320 else if (data1->score > data2->score) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2321 return 1; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2322 return (data1->font_driver_preference - data2->font_driver_preference); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2323 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2324 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2325 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2326 /* Sort each font-entity vector in LIST by closeness to font-spec PREFER. |
90400 | 2327 If PREFER specifies a point-size, calculate the corresponding |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2328 pixel-size from QCdpi property of PREFER or from the Y-resolution |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2329 of FRAME before sorting. |
94926 | 2330 |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2331 If BEST-ONLY is nonzero, return the best matching entity (that |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2332 supports the character BEST-ONLY if BEST-ONLY is positive, or any |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2333 if BEST-ONLY is negative). Otherwise, return the sorted result as |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2334 a single vector of font-entities. |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2335 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2336 This function does no optimization for the case that the total |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2337 number of elements is 1. The caller should avoid calling this in |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2338 such a case. */ |
90400 | 2339 |
2340 static Lisp_Object | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2341 font_sort_entities (list, prefer, frame, best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2342 Lisp_Object list, prefer, frame; |
94926 | 2343 int best_only; |
90400 | 2344 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2345 Lisp_Object prefer_prop[FONT_SPEC_MAX]; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2346 int len, maxlen, i; |
90400 | 2347 struct font_sort_data *data; |
94926 | 2348 unsigned best_score; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2349 Lisp_Object best_entity; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2350 struct frame *f = XFRAME (frame); |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2351 Lisp_Object tail, vec; |
90400 | 2352 USE_SAFE_ALLOCA; |
2353 | |
103369
97cfffb6f666
(font_parse_family_registry): Fix for one-char foundry.
Kenichi Handa <handa@m17n.org>
parents:
103255
diff
changeset
|
2354 for (i = FONT_WEIGHT_INDEX; i <= FONT_AVGWIDTH_INDEX; i++) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2355 prefer_prop[i] = AREF (prefer, i); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2356 if (FLOATP (prefer_prop[FONT_SIZE_INDEX])) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2357 prefer_prop[FONT_SIZE_INDEX] |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2358 = make_number (font_pixel_size (XFRAME (frame), prefer)); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2359 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2360 if (NILP (XCDR (list))) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2361 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2362 /* What we have to take care of is this single vector. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2363 vec = XCAR (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2364 maxlen = ASIZE (vec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2365 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2366 else if (best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2367 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2368 /* We don't have to perform sort, so there's no need of creating |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2369 a single vector. But, we must find the length of the longest |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2370 vector. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2371 maxlen = 0; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2372 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2373 if (maxlen < ASIZE (XCAR (tail))) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2374 maxlen = ASIZE (XCAR (tail)); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2375 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2376 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2377 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2378 /* We have to create a single vector to sort it. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2379 vec = font_vconcat_entity_vectors (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2380 maxlen = ASIZE (vec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2381 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2382 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2383 SAFE_ALLOCA (data, struct font_sort_data *, (sizeof *data) * maxlen); |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2384 best_score = 0xFFFFFFFF; |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2385 best_entity = Qnil; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2386 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2387 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
90400 | 2388 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2389 int font_driver_preference = 0; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2390 Lisp_Object current_font_driver; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2391 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2392 if (best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2393 vec = XCAR (tail); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2394 len = ASIZE (vec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2395 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2396 /* We are sure that the length of VEC > 0. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2397 current_font_driver = AREF (AREF (vec, 0), FONT_TYPE_INDEX); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2398 /* Score the elements. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2399 for (i = 0; i < len; i++) |
94926 | 2400 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2401 data[i].entity = AREF (vec, i); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2402 data[i].score |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2403 = ((best_only <= 0 || font_has_char (f, data[i].entity, best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2404 > 0) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2405 ? font_score (data[i].entity, prefer_prop) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2406 : 0xFFFFFFFF); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2407 if (best_only && best_score > data[i].score) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2408 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2409 best_score = data[i].score; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2410 best_entity = data[i].entity; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2411 if (best_score == 0) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2412 break; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2413 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2414 if (! EQ (current_font_driver, AREF (AREF (vec, i), FONT_TYPE_INDEX))) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2415 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2416 current_font_driver = AREF (AREF (vec, i), FONT_TYPE_INDEX); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2417 font_driver_preference++; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2418 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2419 data[i].font_driver_preference = font_driver_preference; |
94926 | 2420 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2421 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2422 /* Sort if necessary. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2423 if (! best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2424 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2425 qsort (data, len, sizeof *data, font_compare); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2426 for (i = 0; i < len; i++) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2427 ASET (vec, i, data[i].entity); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2428 break; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2429 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2430 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2431 vec = best_entity; |
90400 | 2432 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2433 |
90400 | 2434 SAFE_FREE (); |
2435 | |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
2436 FONT_ADD_LOG ("sort-by", prefer, vec); |
90400 | 2437 return vec; |
2438 } | |
2439 | |
2440 | |
2441 /* API of Font Service Layer. */ | |
2442 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2443 /* Reflect ORDER (see the variable font_sort_order in xfaces.c) to |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2444 sort_shift_bits. Finternal_set_font_selection_order calls this |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2445 function with font_sort_order after setting up it. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2446 |
90400 | 2447 void |
2448 font_update_sort_order (order) | |
2449 int *order; | |
2450 { | |
94926 | 2451 int i, shift_bits; |
2452 | |
95869
14ab94c436d7
(font_update_sort_order): Setting of sort_shift_bits adjusted for the
Kenichi Handa <handa@m17n.org>
parents:
95867
diff
changeset
|
2453 for (i = 0, shift_bits = 23; i < 4; i++, shift_bits -= 7) |
90400 | 2454 { |
2455 int xlfd_idx = order[i]; | |
2456 | |
2457 if (xlfd_idx == XLFD_WEIGHT_INDEX) | |
2458 sort_shift_bits[FONT_WEIGHT_INDEX] = shift_bits; | |
2459 else if (xlfd_idx == XLFD_SLANT_INDEX) | |
2460 sort_shift_bits[FONT_SLANT_INDEX] = shift_bits; | |
2461 else if (xlfd_idx == XLFD_SWIDTH_INDEX) | |
2462 sort_shift_bits[FONT_WIDTH_INDEX] = shift_bits; | |
2463 else | |
2464 sort_shift_bits[FONT_SIZE_INDEX] = shift_bits; | |
2465 } | |
2466 } | |
2467 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2468 static int |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2469 font_check_otf_features (script, langsys, features, table) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2470 Lisp_Object script, langsys, features, table; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2471 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2472 Lisp_Object val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2473 int negative; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2474 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2475 table = assq_no_quit (script, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2476 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2477 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2478 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2479 if (! NILP (langsys)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2480 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2481 table = assq_no_quit (langsys, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2482 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2483 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2484 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2485 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2486 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2487 val = assq_no_quit (Qnil, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2488 if (NILP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2489 table = XCAR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2490 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2491 table = val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2492 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2493 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2494 for (negative = 0; CONSP (features); features = XCDR (features)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2495 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2496 if (NILP (XCAR (features))) |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2497 { |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2498 negative = 1; |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2499 continue; |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2500 } |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2501 if (NILP (Fmemq (XCAR (features), table)) != negative) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2502 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2503 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2504 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2505 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2506 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2507 /* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */ |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2508 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2509 static int |
96573
3de01ebe30b7
* fontset.c (fontset_get_font_group):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96565
diff
changeset
|
2510 font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2511 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2512 Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2513 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2514 script = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2515 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2516 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2517 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2518 langsys = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2519 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2520 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2521 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2522 gsub = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2523 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2524 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2525 gpos = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2526 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2527 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2528 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2529 if (! NILP (gsub) && ! font_check_otf_features (script, langsys, gsub, |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2530 XCAR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2531 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2532 if (! NILP (gpos) && ! font_check_otf_features (script, langsys, gpos, |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2533 XCDR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2534 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2535 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2536 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2537 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2538 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2539 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2540 /* Check if FONT (font-entity or font-object) matches with the font |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2541 specification SPEC. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2542 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2543 int |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2544 font_match_p (spec, font) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2545 Lisp_Object spec, font; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2546 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2547 Lisp_Object prop[FONT_SPEC_MAX], *props; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2548 Lisp_Object extra, font_extra; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2549 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2550 |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2551 for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2552 if (! NILP (AREF (spec, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2553 && ! NILP (AREF (font, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2554 && ! EQ (AREF (spec, i), AREF (font, i))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2555 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2556 props = XFONT_SPEC (spec)->props; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2557 if (FLOATP (props[FONT_SIZE_INDEX])) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2558 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2559 for (i = FONT_FOUNDRY_INDEX; i < FONT_SIZE_INDEX; i++) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2560 prop[i] = AREF (spec, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2561 prop[FONT_SIZE_INDEX] |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2562 = make_number (font_pixel_size (XFRAME (selected_frame), spec)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2563 props = prop; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2564 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2565 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2566 if (font_score (font, props) > 0) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2567 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2568 extra = AREF (spec, FONT_EXTRA_INDEX); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2569 font_extra = AREF (font, FONT_EXTRA_INDEX); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2570 for (; CONSP (extra); extra = XCDR (extra)) |
94926 | 2571 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2572 Lisp_Object key = XCAR (XCAR (extra)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2573 Lisp_Object val = XCDR (XCAR (extra)), val2; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2574 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2575 if (EQ (key, QClang)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2576 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2577 val2 = assq_no_quit (key, font_extra); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2578 if (NILP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2579 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2580 val2 = XCDR (val2); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2581 if (CONSP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2582 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2583 if (! CONSP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2584 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2585 while (CONSP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2586 if (NILP (Fmemq (val, val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2587 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2588 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2589 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2590 if (CONSP (val2) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2591 ? NILP (Fmemq (val, XCDR (val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2592 : ! EQ (val, val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2593 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2594 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2595 else if (EQ (key, QCscript)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2596 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2597 val2 = assq_no_quit (val, Vscript_representative_chars); |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2598 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2599 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2600 val2 = XCDR (val2); |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2601 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2602 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2603 /* All characters in the list must be supported. */ |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2604 for (; CONSP (val2); val2 = XCDR (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2605 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2606 if (! NATNUMP (XCAR (val2))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2607 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2608 if (font_encode_char (font, XFASTINT (XCAR (val2))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2609 == FONT_INVALID_CODE) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2610 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2611 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2612 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2613 else if (VECTORP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2614 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2615 /* At most one character in the vector must be supported. */ |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2616 for (i = 0; i < ASIZE (val2); i++) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2617 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2618 if (! NATNUMP (AREF (val2, i))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2619 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2620 if (font_encode_char (font, XFASTINT (AREF (val2, i))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2621 != FONT_INVALID_CODE) |
99076
06c37ccf1b58
(font_match_p): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
99075
diff
changeset
|
2622 break; |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2623 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2624 if (i == ASIZE (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2625 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2626 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2627 } |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2628 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2629 else if (EQ (key, QCotf)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2630 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2631 struct font *fontp; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2632 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2633 if (! FONT_OBJECT_P (font)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2634 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2635 fontp = XFONT_OBJECT (font); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2636 if (! fontp->driver->otf_capability) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2637 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2638 val2 = fontp->driver->otf_capability (fontp); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2639 if (NILP (val2) || ! font_check_otf (val, val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2640 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2641 } |
94926 | 2642 } |
2643 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2644 return 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2645 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2646 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2647 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2648 /* Font cache |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2649 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2650 Each font backend has the callback function get_cache, and it |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2651 returns a cons cell of which cdr part can be freely used for |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2652 caching fonts. The cons cell may be shared by multiple frames |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2653 and/or multiple font drivers. So, we arrange the cdr part as this: |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2654 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2655 ((DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...) ...) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2656 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2657 where DRIVER-TYPE is a symbol such as `x', `xft', etc., NUM-FRAMES |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2658 is a number frames sharing this cache, and FONT-CACHE-DATA is a |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2659 cons (FONT-SPEC FONT-ENTITY ...). */ |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2660 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2661 static void font_prepare_cache P_ ((FRAME_PTR, struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2662 static void font_finish_cache P_ ((FRAME_PTR, struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2663 static Lisp_Object font_get_cache P_ ((FRAME_PTR, struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2664 static void font_clear_cache P_ ((FRAME_PTR, Lisp_Object, |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2665 struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2666 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2667 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2668 font_prepare_cache (f, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2669 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2670 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2671 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2672 Lisp_Object cache, val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2673 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2674 cache = driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2675 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2676 while (CONSP (val) && ! EQ (XCAR (XCAR (val)), driver->type)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2677 val = XCDR (val); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2678 if (NILP (val)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2679 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2680 val = Fcons (driver->type, Fcons (make_number (1), Qnil)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2681 XSETCDR (cache, Fcons (val, XCDR (cache))); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2682 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2683 else |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2684 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2685 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2686 XSETCAR (val, make_number (XINT (XCAR (val)) + 1)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2687 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2688 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2689 |
91909 | 2690 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2691 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2692 font_finish_cache (f, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2693 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2694 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2695 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2696 Lisp_Object cache, val, tmp; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2697 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2698 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2699 cache = driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2700 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2701 while (CONSP (val) && ! EQ (XCAR (XCAR (val)), driver->type)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2702 cache = val, val = XCDR (val); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2703 font_assert (! NILP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2704 tmp = XCDR (XCAR (val)); |
91909 | 2705 XSETCAR (tmp, make_number (XINT (XCAR (tmp)) - 1)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2706 if (XINT (XCAR (tmp)) == 0) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2707 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2708 font_clear_cache (f, XCAR (val), driver); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2709 XSETCDR (cache, XCDR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2710 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2711 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2712 |
91909 | 2713 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2714 static Lisp_Object |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2715 font_get_cache (f, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2716 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2717 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2718 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2719 Lisp_Object val = driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2720 Lisp_Object type = driver->type; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2721 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2722 font_assert (CONSP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2723 for (val = XCDR (val); ! EQ (XCAR (XCAR (val)), type); val = XCDR (val)); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2724 font_assert (CONSP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2725 /* VAL = ((DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...) ...) */ |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2726 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2727 return val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2728 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2729 |
91909 | 2730 static int num_fonts; |
2731 | |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2732 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2733 font_clear_cache (f, cache, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2734 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2735 Lisp_Object cache; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2736 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2737 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2738 Lisp_Object tail, elt; |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2739 Lisp_Object tail2, entity; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2740 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2741 /* CACHE = (DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...) */ |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2742 for (tail = XCDR (XCDR (cache)); CONSP (tail); tail = XCDR (tail)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2743 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2744 elt = XCAR (tail); |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2745 /* elt should have the form (FONT-SPEC FONT-ENTITY ...) */ |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2746 if (CONSP (elt) && FONT_SPEC_P (XCAR (elt))) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2747 { |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2748 for (tail2 = XCDR (elt); CONSP (tail2); tail2 = XCDR (tail2)) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2749 { |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2750 entity = XCAR (tail2); |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2751 |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2752 if (FONT_ENTITY_P (entity) |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2753 && EQ (driver->type, AREF (entity, FONT_TYPE_INDEX))) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2754 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2755 Lisp_Object objlist = AREF (entity, FONT_OBJLIST_INDEX); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2756 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2757 for (; CONSP (objlist); objlist = XCDR (objlist)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2758 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2759 Lisp_Object val = XCAR (objlist); |
94926 | 2760 struct font *font = XFONT_OBJECT (val); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2761 |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2762 if (! NILP (AREF (val, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2763 { |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2764 font_assert (font && driver == font->driver); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2765 driver->close (f, font); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2766 num_fonts--; |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2767 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2768 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2769 if (driver->free_entity) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2770 driver->free_entity (entity); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2771 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2772 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2773 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2774 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2775 XSETCDR (cache, Qnil); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2776 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2777 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2778 |
90400 | 2779 static Lisp_Object scratch_font_spec, scratch_font_prefer; |
2780 | |
94926 | 2781 Lisp_Object |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2782 font_delete_unmatched (vec, spec, size) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2783 Lisp_Object vec, spec; |
94926 | 2784 int size; |
2785 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2786 Lisp_Object entity, val; |
94926 | 2787 enum font_property_index prop; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2788 int i; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2789 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2790 for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--) |
94926 | 2791 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2792 entity = AREF (vec, i); |
94926 | 2793 for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) |
2794 if (INTEGERP (AREF (spec, prop)) | |
2795 && ((XINT (AREF (spec, prop)) >> 8) | |
2796 != (XINT (AREF (entity, prop)) >> 8))) | |
2797 prop = FONT_SPEC_MAX; | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2798 if (prop < FONT_SPEC_MAX |
94926 | 2799 && size |
2800 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) | |
2801 { | |
2802 int diff = XINT (AREF (entity, FONT_SIZE_INDEX)) - size; | |
2803 | |
2804 if (diff != 0 | |
2805 && (diff < 0 ? -diff > FONT_PIXEL_SIZE_QUANTUM | |
2806 : diff > FONT_PIXEL_SIZE_QUANTUM)) | |
2807 prop = FONT_SPEC_MAX; | |
2808 } | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2809 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2810 && INTEGERP (AREF (spec, FONT_DPI_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2811 && INTEGERP (AREF (entity, FONT_DPI_INDEX)) |
98581
bd9b20fa24a6
(font_delete_unmatched): Fix previous change. Don't
Kenichi Handa <handa@m17n.org>
parents:
98451
diff
changeset
|
2812 && XINT (AREF (entity, FONT_DPI_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2813 && ! EQ (AREF (spec, FONT_DPI_INDEX), AREF (entity, FONT_DPI_INDEX))) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2814 prop = FONT_SPEC_MAX; |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2815 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2816 && INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2817 && INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX)) |
98581
bd9b20fa24a6
(font_delete_unmatched): Fix previous change. Don't
Kenichi Handa <handa@m17n.org>
parents:
98451
diff
changeset
|
2818 && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2819 && ! EQ (AREF (spec, FONT_AVGWIDTH_INDEX), |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2820 AREF (entity, FONT_AVGWIDTH_INDEX))) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2821 prop = FONT_SPEC_MAX; |
94926 | 2822 if (prop < FONT_SPEC_MAX) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2823 val = Fcons (entity, val); |
94926 | 2824 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2825 return (Fvconcat (1, &val)); |
94926 | 2826 } |
2827 | |
2828 | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2829 /* Return a list of vectors of font-entities matching with SPEC on |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2830 FRAME. The elements of the list are in the same of order of |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2831 font-drivers. */ |
94926 | 2832 |
2833 Lisp_Object | |
90400 | 2834 font_list_entities (frame, spec) |
2835 Lisp_Object frame, spec; | |
2836 { | |
2837 FRAME_PTR f = XFRAME (frame); | |
2838 struct font_driver_list *driver_list = f->font_driver_list; | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2839 Lisp_Object ftype, val; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2840 Lisp_Object list = Qnil; |
94926 | 2841 int size; |
2842 int need_filtering = 0; | |
90400 | 2843 int i; |
2844 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2845 font_assert (FONT_SPEC_P (spec)); |
90400 | 2846 |
94926 | 2847 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) |
2848 size = XINT (AREF (spec, FONT_SIZE_INDEX)); | |
2849 else if (FLOATP (AREF (spec, FONT_SIZE_INDEX))) | |
2850 size = font_pixel_size (f, spec); | |
2851 else | |
2852 size = 0; | |
2853 | |
90400 | 2854 ftype = AREF (spec, FONT_TYPE_INDEX); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2855 for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) |
94926 | 2856 ASET (scratch_font_spec, i, AREF (spec, i)); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2857 for (i = FONT_WEIGHT_INDEX; i < FONT_EXTRA_INDEX; i++) |
94926 | 2858 { |
2859 ASET (scratch_font_spec, i, Qnil); | |
2860 if (! NILP (AREF (spec, i))) | |
2861 need_filtering = 1; | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2862 if (i == FONT_DPI_INDEX) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2863 /* Skip FONT_SPACING_INDEX */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2864 i++; |
94926 | 2865 } |
95359
f6580a4c58da
(font_parse_family_registry): Use Ffont_put to validate
Kenichi Handa <handa@m17n.org>
parents:
95290
diff
changeset
|
2866 ASET (scratch_font_spec, FONT_SPACING_INDEX, AREF (spec, FONT_SPACING_INDEX)); |
94926 | 2867 ASET (scratch_font_spec, FONT_EXTRA_INDEX, AREF (spec, FONT_EXTRA_INDEX)); |
2868 | |
90400 | 2869 for (i = 0; driver_list; driver_list = driver_list->next) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
2870 if (driver_list->on |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
2871 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) |
90400 | 2872 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2873 Lisp_Object cache = font_get_cache (f, driver_list->driver); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2874 |
95437
6e6db01383e4
(font_list_entities): Fix the car part of data to be
Kenichi Handa <handa@m17n.org>
parents:
95421
diff
changeset
|
2875 ASET (scratch_font_spec, FONT_TYPE_INDEX, driver_list->driver->type); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2876 val = assoc_no_quit (scratch_font_spec, XCDR (cache)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2877 if (CONSP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2878 val = XCDR (val); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2879 else |
90400 | 2880 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2881 Lisp_Object copy; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2882 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2883 val = driver_list->driver->list (frame, scratch_font_spec); |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2884 if (NILP (val)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2885 val = null_vector; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2886 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2887 val = Fvconcat (1, &val); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2888 copy = Fcopy_font_spec (scratch_font_spec); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2889 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2890 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); |
90400 | 2891 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2892 if (ASIZE (val) > 0 && need_filtering) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2893 val = font_delete_unmatched (val, spec, size); |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2894 if (ASIZE (val) > 0) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2895 list = Fcons (val, list); |
90400 | 2896 } |
94926 | 2897 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2898 list = Fnreverse (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2899 FONT_ADD_LOG ("list", spec, list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2900 return list; |
90400 | 2901 } |
2902 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2903 |
94926 | 2904 /* Return a font entity matching with SPEC on FRAME. ATTRS, if non |
2905 nil, is an array of face's attributes, which specifies preferred | |
2906 font-related attributes. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2907 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2908 static Lisp_Object |
94926 | 2909 font_matching_entity (f, attrs, spec) |
2910 FRAME_PTR f; | |
2911 Lisp_Object *attrs, spec; | |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2912 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2913 struct font_driver_list *driver_list = f->font_driver_list; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2914 Lisp_Object ftype, size, entity; |
94926 | 2915 Lisp_Object frame; |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2916 Lisp_Object work = Fcopy_font_spec (spec); |
94926 | 2917 |
2918 XSETFRAME (frame, f); | |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2919 ftype = AREF (spec, FONT_TYPE_INDEX); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2920 size = AREF (spec, FONT_SIZE_INDEX); |
98451
db015b441c0c
* nsfont.m (nsfont_spec_to_traits): Use UnXX masks only for non-normal styles. (nsfont_open): Reenable the cache.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
98445
diff
changeset
|
2921 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2922 if (FLOATP (size)) |
98451
db015b441c0c
* nsfont.m (nsfont_spec_to_traits): Use UnXX masks only for non-normal styles. (nsfont_open): Reenable the cache.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
98445
diff
changeset
|
2923 ASET (work, FONT_SIZE_INDEX, make_number (font_pixel_size (f, spec))); |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2924 FONT_SET_STYLE (work, FONT_WEIGHT_INDEX, attrs[LFACE_WEIGHT_INDEX]); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2925 FONT_SET_STYLE (work, FONT_SLANT_INDEX, attrs[LFACE_SLANT_INDEX]); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2926 FONT_SET_STYLE (work, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2927 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2928 entity = Qnil; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2929 for (; driver_list; driver_list = driver_list->next) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2930 if (driver_list->on |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2931 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2932 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2933 Lisp_Object cache = font_get_cache (f, driver_list->driver); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2934 Lisp_Object copy; |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2935 |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2936 ASET (work, FONT_TYPE_INDEX, driver_list->driver->type); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2937 entity = assoc_no_quit (work, XCDR (cache)); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2938 if (CONSP (entity)) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2939 entity = XCDR (entity); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2940 else |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2941 { |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2942 entity = driver_list->driver->match (frame, work); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2943 copy = Fcopy_font_spec (work); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2944 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); |
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2945 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2946 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2947 if (! NILP (entity)) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2948 break; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2949 } |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
2950 FONT_ADD_LOG ("match", work, entity); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2951 return entity; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2952 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2953 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2954 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2955 /* Open a font of ENTITY and PIXEL_SIZE on frame F, and return the |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2956 opened font object. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2957 |
90400 | 2958 static Lisp_Object |
2959 font_open_entity (f, entity, pixel_size) | |
2960 FRAME_PTR f; | |
2961 Lisp_Object entity; | |
2962 int pixel_size; | |
2963 { | |
2964 struct font_driver_list *driver_list; | |
91909 | 2965 Lisp_Object objlist, size, val, font_object; |
90400 | 2966 struct font *font; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2967 int min_width, height; |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2968 int scaled_pixel_size; |
94926 | 2969 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2970 font_assert (FONT_ENTITY_P (entity)); |
90400 | 2971 size = AREF (entity, FONT_SIZE_INDEX); |
2972 if (XINT (size) != 0) | |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2973 scaled_pixel_size = pixel_size = XINT (size); |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2974 else if (CONSP (Vface_font_rescale_alist)) |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2975 scaled_pixel_size = pixel_size * font_rescale_ratio (entity); |
90400 | 2976 |
2977 for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist); | |
2978 objlist = XCDR (objlist)) | |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2979 if (! NILP (AREF (XCAR (objlist), FONT_TYPE_INDEX)) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2980 && XFONT_OBJECT (XCAR (objlist))->pixel_size == pixel_size) |
94926 | 2981 return XCAR (objlist); |
2982 | |
2983 val = AREF (entity, FONT_TYPE_INDEX); | |
2984 for (driver_list = f->font_driver_list; | |
2985 driver_list && ! EQ (driver_list->driver->type, val); | |
2986 driver_list = driver_list->next); | |
2987 if (! driver_list) | |
2988 return Qnil; | |
2989 | |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2990 font_object = driver_list->driver->open (f, entity, scaled_pixel_size); |
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2991 ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
2992 FONT_ADD_LOG ("open", entity, font_object); |
91909 | 2993 if (NILP (font_object)) |
94926 | 2994 return Qnil; |
2995 ASET (entity, FONT_OBJLIST_INDEX, | |
2996 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); | |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2997 ASET (font_object, FONT_OBJLIST_INDEX, Qnil); |
94926 | 2998 num_fonts++; |
2999 | |
3000 font = XFONT_OBJECT (font_object); | |
3001 min_width = (font->min_width ? font->min_width | |
3002 : font->average_width ? font->average_width | |
3003 : font->space_width ? font->space_width | |
3004 : 1); | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3005 height = (font->height ? font->height : 1); |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
3006 #ifdef HAVE_WINDOW_SYSTEM |
94926 | 3007 FRAME_X_DISPLAY_INFO (f)->n_fonts++; |
3008 if (FRAME_X_DISPLAY_INFO (f)->n_fonts == 1) | |
91909 | 3009 { |
94926 | 3010 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3011 FRAME_SMALLEST_FONT_HEIGHT (f) = height; |
94926 | 3012 fonts_changed_p = 1; |
91909 | 3013 } |
94926 | 3014 else |
3015 { | |
3016 if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width) | |
3017 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width, fonts_changed_p = 1; | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3018 if (FRAME_SMALLEST_FONT_HEIGHT (f) > height) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3019 FRAME_SMALLEST_FONT_HEIGHT (f) = height, fonts_changed_p = 1; |
94926 | 3020 } |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
3021 #endif |
91909 | 3022 |
3023 return font_object; | |
90400 | 3024 } |
3025 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3026 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3027 /* Close FONT_OBJECT that is opened on frame F. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3028 |
90400 | 3029 void |
3030 font_close_object (f, font_object) | |
3031 FRAME_PTR f; | |
3032 Lisp_Object font_object; | |
3033 { | |
94926 | 3034 struct font *font = XFONT_OBJECT (font_object); |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3035 |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3036 if (NILP (AREF (font_object, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3037 /* Already closed. */ |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3038 return; |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
3039 FONT_ADD_LOG ("close", font_object, Qnil); |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3040 font->driver->close (f, font); |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
3041 #ifdef HAVE_WINDOW_SYSTEM |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3042 font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3043 FRAME_X_DISPLAY_INFO (f)->n_fonts--; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
3044 #endif |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
3045 num_fonts--; |
90400 | 3046 } |
3047 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3048 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3049 /* Return 1 if FONT on F has a glyph for character C, 0 if not, -1 if |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3050 FONT is a font-entity and it must be opened to check. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3051 |
90400 | 3052 int |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3053 font_has_char (f, font, c) |
90400 | 3054 FRAME_PTR f; |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3055 Lisp_Object font; |
90400 | 3056 int c; |
3057 { | |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3058 struct font *fontp; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3059 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3060 if (FONT_ENTITY_P (font)) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3061 { |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3062 Lisp_Object type = AREF (font, FONT_TYPE_INDEX); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3063 struct font_driver_list *driver_list; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3064 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3065 for (driver_list = f->font_driver_list; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3066 driver_list && ! EQ (driver_list->driver->type, type); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3067 driver_list = driver_list->next); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3068 if (! driver_list) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3069 return 0; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3070 if (! driver_list->driver->has_char) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3071 return -1; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3072 return driver_list->driver->has_char (font, c); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3073 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3074 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3075 font_assert (FONT_OBJECT_P (font)); |
94926 | 3076 fontp = XFONT_OBJECT (font); |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3077 if (fontp->driver->has_char) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3078 { |
94926 | 3079 int result = fontp->driver->has_char (font, c); |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3080 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3081 if (result >= 0) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3082 return result; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3083 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3084 return (fontp->driver->encode_char (fontp, c) != FONT_INVALID_CODE); |
90400 | 3085 } |
3086 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3087 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3088 /* Return the glyph ID of FONT_OBJECT for character C. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3089 |
90400 | 3090 unsigned |
3091 font_encode_char (font_object, c) | |
3092 Lisp_Object font_object; | |
3093 int c; | |
3094 { | |
94926 | 3095 struct font *font; |
3096 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3097 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 3098 font = XFONT_OBJECT (font_object); |
90400 | 3099 return font->driver->encode_char (font, c); |
3100 } | |
3101 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3102 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3103 /* Return the name of FONT_OBJECT. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3104 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3105 Lisp_Object |
90400 | 3106 font_get_name (font_object) |
3107 Lisp_Object font_object; | |
3108 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3109 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 3110 return AREF (font_object, FONT_NAME_INDEX); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3111 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3112 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3113 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3114 /* Return the specification of FONT_OBJECT. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3115 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3116 Lisp_Object |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3117 font_get_spec (font_object) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3118 Lisp_Object font_object; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3119 { |
94926 | 3120 Lisp_Object spec = font_make_spec (); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3121 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3122 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3123 for (i = 0; i < FONT_SIZE_INDEX; i++) |
94926 | 3124 ASET (spec, i, AREF (font_object, i)); |
3125 ASET (spec, FONT_SIZE_INDEX, | |
3126 make_number (XFONT_OBJECT (font_object)->pixel_size)); | |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3127 return spec; |
90400 | 3128 } |
3129 | |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3130 |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3131 /* Create a new font spec from FONT_NAME, and return it. If FONT_NAME |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3132 could not be parsed by font_parse_name, return Qnil. */ |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3133 |
90400 | 3134 Lisp_Object |
94926 | 3135 font_spec_from_name (font_name) |
3136 Lisp_Object font_name; | |
3137 { | |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3138 Lisp_Object spec = Ffont_spec (0, NULL); |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3139 |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3140 CHECK_STRING (font_name); |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3141 if (font_parse_name ((char *) SDATA (font_name), spec) == -1) |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3142 return Qnil; |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3143 font_put_extra (spec, QCname, font_name); |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3144 return spec; |
94926 | 3145 } |
3146 | |
3147 | |
3148 void | |
3149 font_clear_prop (attrs, prop) | |
3150 Lisp_Object *attrs; | |
3151 enum font_property_index prop; | |
3152 { | |
3153 Lisp_Object font = attrs[LFACE_FONT_INDEX]; | |
3154 | |
3155 if (! FONTP (font)) | |
3156 return; | |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3157 if (! NILP (Ffont_get (font, QCname))) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3158 { |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3159 font = Fcopy_font_spec (font); |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3160 font_put_extra (font, QCname, Qnil); |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3161 } |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3162 |
94926 | 3163 if (NILP (AREF (font, prop)) |
98717
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3164 && prop != FONT_FAMILY_INDEX |
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3165 && prop != FONT_FOUNDRY_INDEX |
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3166 && prop != FONT_WIDTH_INDEX |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3167 && prop != FONT_SIZE_INDEX) |
94926 | 3168 return; |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3169 if (EQ (font, attrs[LFACE_FONT_INDEX])) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3170 font = Fcopy_font_spec (font); |
94926 | 3171 ASET (font, prop, Qnil); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3172 if (prop == FONT_FAMILY_INDEX || prop == FONT_FOUNDRY_INDEX) |
94926 | 3173 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3174 if (prop == FONT_FAMILY_INDEX) |
101156
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3175 { |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3176 ASET (font, FONT_FOUNDRY_INDEX, Qnil); |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3177 /* If we are setting the font family, we must also clear |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3178 FONT_WIDTH_INDEX to avoid rejecting families that lack |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3179 support for some widths. */ |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3180 ASET (font, FONT_WIDTH_INDEX, Qnil); |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3181 } |
94926 | 3182 ASET (font, FONT_ADSTYLE_INDEX, Qnil); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3183 ASET (font, FONT_REGISTRY_INDEX, Qnil); |
94926 | 3184 ASET (font, FONT_SIZE_INDEX, Qnil); |
3185 ASET (font, FONT_DPI_INDEX, Qnil); | |
3186 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3187 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3188 } | |
3189 else if (prop == FONT_SIZE_INDEX) | |
3190 { | |
3191 ASET (font, FONT_DPI_INDEX, Qnil); | |
3192 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3193 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3194 } | |
98717
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3195 else if (prop == FONT_WIDTH_INDEX) |
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3196 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); |
94926 | 3197 attrs[LFACE_FONT_INDEX] = font; |
3198 } | |
3199 | |
3200 void | |
3201 font_update_lface (f, attrs) | |
3202 FRAME_PTR f; | |
3203 Lisp_Object *attrs; | |
90400 | 3204 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3205 Lisp_Object spec; |
94926 | 3206 |
3207 spec = attrs[LFACE_FONT_INDEX]; | |
3208 if (! FONT_SPEC_P (spec)) | |
3209 return; | |
3210 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3211 if (! NILP (AREF (spec, FONT_FOUNDRY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3212 attrs[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (spec, FONT_FOUNDRY_INDEX)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3213 if (! NILP (AREF (spec, FONT_FAMILY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3214 attrs[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (spec, FONT_FAMILY_INDEX)); |
94926 | 3215 if (! NILP (AREF (spec, FONT_WEIGHT_INDEX))) |
3216 attrs[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (spec); | |
3217 if (! NILP (AREF (spec, FONT_SLANT_INDEX))) | |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101806
diff
changeset
|
3218 attrs[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (spec); |
94926 | 3219 if (! NILP (AREF (spec, FONT_WIDTH_INDEX))) |
3220 attrs[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (spec); | |
3221 if (! NILP (AREF (spec, FONT_SIZE_INDEX))) | |
3222 { | |
3223 int point; | |
3224 | |
3225 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) | |
3226 { | |
3227 Lisp_Object val; | |
3228 int dpi = f->resy; | |
3229 | |
3230 val = Ffont_get (spec, QCdpi); | |
3231 if (! NILP (val)) | |
3232 dpi = XINT (val); | |
3233 point = PIXEL_TO_POINT (XINT (AREF (spec, FONT_SIZE_INDEX)) * 10, | |
3234 dpi); | |
100167
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3235 attrs[LFACE_HEIGHT_INDEX] = make_number (point); |
94926 | 3236 } |
3237 else if (FLOATP (AREF (spec, FONT_SIZE_INDEX))) | |
100167
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3238 { |
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3239 point = XFLOAT_DATA (AREF (spec, FONT_SIZE_INDEX)) * 10; |
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3240 attrs[LFACE_HEIGHT_INDEX] = make_number (point); |
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3241 } |
94926 | 3242 } |
90400 | 3243 } |
3244 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3245 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3246 /* Selecte a font from ENTITIES (list of font-entity vectors) that |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3247 supports C and matches best with ATTRS and PIXEL_SIZE. */ |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3248 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3249 static Lisp_Object |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3250 font_select_entity (frame, entities, attrs, pixel_size, c) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3251 Lisp_Object frame, entities, *attrs; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3252 int pixel_size, c; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3253 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3254 Lisp_Object font_entity; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3255 Lisp_Object prefer; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3256 int result, i; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3257 FRAME_PTR f = XFRAME (frame); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3258 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3259 if (NILP (XCDR (entities)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3260 && ASIZE (XCAR (entities)) == 1) |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3261 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3262 font_entity = AREF (XCAR (entities), 0); |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3263 if (c < 0 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3264 || (result = font_has_char (f, font_entity, c)) > 0) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3265 return font_entity; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3266 return Qnil; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3267 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3268 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3269 /* Sort fonts by properties specified in ATTRS. */ |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3270 prefer = scratch_font_prefer; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3271 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3272 for (i = FONT_WEIGHT_INDEX; i <= FONT_SIZE_INDEX; i++) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3273 ASET (prefer, i, Qnil); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3274 if (FONTP (attrs[LFACE_FONT_INDEX])) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3275 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3276 Lisp_Object face_font = attrs[LFACE_FONT_INDEX]; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3277 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3278 for (i = FONT_WEIGHT_INDEX; i <= FONT_SIZE_INDEX; i++) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3279 ASET (prefer, i, AREF (face_font, i)); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3280 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3281 if (NILP (AREF (prefer, FONT_WEIGHT_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3282 FONT_SET_STYLE (prefer, FONT_WEIGHT_INDEX, attrs[LFACE_WEIGHT_INDEX]); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3283 if (NILP (AREF (prefer, FONT_SLANT_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3284 FONT_SET_STYLE (prefer, FONT_SLANT_INDEX, attrs[LFACE_SLANT_INDEX]); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3285 if (NILP (AREF (prefer, FONT_WIDTH_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3286 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3287 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size)); |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
3288 |
103255
a8e08bcfc3ad
(font_sort_entities): Renamed from font_sort_entites.
Kenichi Handa <handa@m17n.org>
parents:
103246
diff
changeset
|
3289 return font_sort_entities (entities, prefer, frame, c); |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3290 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3291 |
94926 | 3292 /* Return a font-entity satisfying SPEC and best matching with face's |
3293 font related attributes in ATTRS. C, if not negative, is a | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3294 character that the entity must support. */ |
90400 | 3295 |
3296 Lisp_Object | |
94926 | 3297 font_find_for_lface (f, attrs, spec, c) |
90400 | 3298 FRAME_PTR f; |
94926 | 3299 Lisp_Object *attrs; |
90400 | 3300 Lisp_Object spec; |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3301 int c; |
90400 | 3302 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3303 Lisp_Object work; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3304 Lisp_Object frame, entities, val; |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3305 Lisp_Object size, foundry[3], *family, registry[3], adstyle[3]; |
95475
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3306 int pixel_size; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3307 int i, j, k, l; |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3308 |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3309 registry[0] = AREF (spec, FONT_REGISTRY_INDEX); |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3310 if (NILP (registry[0])) |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3311 { |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
3312 registry[0] = DEFAULT_ENCODING; |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3313 registry[1] = Qascii_0; |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3314 registry[2] = null_vector; |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3315 } |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3316 else |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3317 registry[1] = null_vector; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3318 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3319 if (c >= 0 && ! NILP (AREF (spec, FONT_REGISTRY_INDEX))) |
94926 | 3320 { |
3321 struct charset *encoding, *repertory; | |
3322 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3323 if (font_registry_charsets (AREF (spec, FONT_REGISTRY_INDEX), |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3324 &encoding, &repertory) < 0) |
94926 | 3325 return Qnil; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3326 if (repertory |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3327 && ENCODE_CHAR (repertory, c) == CHARSET_INVALID_CODE (repertory)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3328 return Qnil; |
94926 | 3329 else if (c > encoding->max_char) |
3330 return Qnil; | |
3331 } | |
3332 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3333 work = Fcopy_font_spec (spec); |
103246
94e71fa6e9ac
(font_find_for_lface): Copy SPEC's FONT_TYPE too.
Kenichi Handa <handa@m17n.org>
parents:
103229
diff
changeset
|
3334 ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX)); |
90507
4a6034a7c870
(font_find_for_lface): Code optimized.
Kenichi Handa <handa@m17n.org>
parents:
90503
diff
changeset
|
3335 XSETFRAME (frame, f); |
94926 | 3336 size = AREF (spec, FONT_SIZE_INDEX); |
95475
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3337 pixel_size = font_pixel_size (f, spec); |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3338 if (pixel_size == 0) |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3339 { |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3340 double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3341 |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3342 pixel_size = POINT_TO_PIXEL (pt / 10, f->resy); |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3343 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3344 ASET (work, FONT_SIZE_INDEX, Qnil); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3345 foundry[0] = AREF (work, FONT_FOUNDRY_INDEX); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3346 if (! NILP (foundry[0])) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3347 foundry[1] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3348 else if (STRINGP (attrs[LFACE_FOUNDRY_INDEX])) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3349 { |
97822 | 3350 val = attrs[LFACE_FOUNDRY_INDEX]; |
3351 foundry[0] = font_intern_prop ((char *) SDATA (val), SBYTES (val), 1); | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3352 foundry[1] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3353 foundry[2] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3354 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3355 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3356 foundry[0] = Qnil, foundry[1] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3357 |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3358 adstyle[0] = AREF (work, FONT_ADSTYLE_INDEX); |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3359 if (! NILP (adstyle[0])) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3360 adstyle[1] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3361 else if (FONTP (attrs[LFACE_FONT_INDEX])) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3362 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3363 Lisp_Object face_font = attrs[LFACE_FONT_INDEX]; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3364 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3365 if (! NILP (AREF (face_font, FONT_ADSTYLE_INDEX))) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3366 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3367 adstyle[0] = AREF (face_font, FONT_ADSTYLE_INDEX); |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3368 adstyle[1] = Qnil; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3369 adstyle[2] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3370 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3371 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3372 adstyle[0] = Qnil, adstyle[1] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3373 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3374 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3375 adstyle[0] = Qnil, adstyle[1] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3376 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3377 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3378 val = AREF (work, FONT_FAMILY_INDEX); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3379 if (NILP (val) && STRINGP (attrs[LFACE_FAMILY_INDEX])) |
97822 | 3380 { |
3381 val = attrs[LFACE_FAMILY_INDEX]; | |
3382 val = font_intern_prop ((char *) SDATA (val), SBYTES (val), 1); | |
3383 } | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3384 if (NILP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3385 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3386 family = alloca ((sizeof family[0]) * 2); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3387 family[0] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3388 family[1] = null_vector; /* terminator. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3389 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3390 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3391 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3392 Lisp_Object alters |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3393 = Fassoc_string (val, Vface_alternative_font_family_alist, |
105095
4adac4895f0f
Update comment for HAVE_NS code in font_find_for_lface().
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104091
diff
changeset
|
3394 /* Font family names are case-sensitive under NS. */ |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3395 #ifndef HAVE_NS |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3396 Qt |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3397 #else |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3398 Qnil |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3399 #endif |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3400 ); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3401 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3402 if (! NILP (alters)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3403 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3404 family = alloca ((sizeof family[0]) * (XINT (Flength (alters)) + 2)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3405 for (i = 0; CONSP (alters); i++, alters = XCDR (alters)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3406 family[i] = XCAR (alters); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3407 if (NILP (AREF (spec, FONT_FAMILY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3408 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3409 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3410 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3411 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3412 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3413 family = alloca ((sizeof family[0]) * 3); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3414 i = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3415 family[i++] = val; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3416 if (NILP (AREF (spec, FONT_FAMILY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3417 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3418 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3419 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3420 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3421 |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3422 for (i = 0; SYMBOLP (family[i]); i++) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3423 { |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3424 ASET (work, FONT_FAMILY_INDEX, family[i]); |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3425 for (j = 0; SYMBOLP (foundry[j]); j++) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3426 { |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3427 ASET (work, FONT_FOUNDRY_INDEX, foundry[j]); |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3428 for (k = 0; SYMBOLP (registry[k]); k++) |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3429 { |
95890
e6e6c351339d
(font_find_for_lface): Fix typo of the previous change.
Kenichi Handa <handa@m17n.org>
parents:
95888
diff
changeset
|
3430 ASET (work, FONT_REGISTRY_INDEX, registry[k]); |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3431 for (l = 0; SYMBOLP (adstyle[l]); l++) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3432 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3433 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]); |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3434 entities = font_list_entities (frame, work); |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3435 if (! NILP (entities)) |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3436 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3437 val = font_select_entity (frame, entities, |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3438 attrs, pixel_size, c); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3439 if (! NILP (val)) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3440 return val; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3441 } |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3442 } |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3443 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3444 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3445 } |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3446 return Qnil; |
90400 | 3447 } |
3448 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3449 |
90400 | 3450 Lisp_Object |
94926 | 3451 font_open_for_lface (f, entity, attrs, spec) |
90400 | 3452 FRAME_PTR f; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3453 Lisp_Object entity; |
94926 | 3454 Lisp_Object *attrs; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3455 Lisp_Object spec; |
90400 | 3456 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3457 int size; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3458 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3459 if (INTEGERP (AREF (entity, FONT_SIZE_INDEX)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3460 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3461 size = XINT (AREF (entity, FONT_SIZE_INDEX)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3462 else if (FONT_SPEC_P (spec) && ! NILP (AREF (spec, FONT_SIZE_INDEX))) |
95475
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3463 size = font_pixel_size (f, spec); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3464 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3465 { |
100985
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3466 double pt; |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3467 if (INTEGERP (attrs[LFACE_HEIGHT_INDEX])) |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3468 pt = XINT (attrs[LFACE_HEIGHT_INDEX]); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3469 else |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3470 { |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3471 struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3472 Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX]; |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3473 if (INTEGERP (height)) |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3474 pt = XINT (height); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3475 else |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3476 abort(); /* We should never end up here. */ |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3477 } |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3478 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3479 pt /= 10; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3480 size = POINT_TO_PIXEL (pt, f->resy); |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3481 #ifdef HAVE_NS |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3482 if (size == 0) |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3483 { |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3484 Lisp_Object ffsize = get_frame_param(f, Qfontsize); |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3485 size = NUMBERP (ffsize) ? POINT_TO_PIXEL (XINT (ffsize), f->resy) : 0; |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3486 } |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3487 #endif |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3488 } |
90400 | 3489 return font_open_entity (f, entity, size); |
3490 } | |
3491 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3492 |
94926 | 3493 /* Find a font satisfying SPEC and best matching with face's |
3494 attributes in ATTRS on FRAME, and return the opened | |
3495 font-object. */ | |
3496 | |
3497 Lisp_Object | |
3498 font_load_for_lface (f, attrs, spec) | |
90400 | 3499 FRAME_PTR f; |
94926 | 3500 Lisp_Object *attrs, spec; |
90400 | 3501 { |
94926 | 3502 Lisp_Object entity; |
3503 | |
103037
e04bcedc08be
(font_load_for_lface): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
103019
diff
changeset
|
3504 entity = font_find_for_lface (f, attrs, spec, -1); |
94926 | 3505 if (NILP (entity)) |
91350
9673276f310c
(font_load_for_face): Handle the case that the font in
Kenichi Handa <handa@m17n.org>
parents:
91337
diff
changeset
|
3506 { |
94926 | 3507 /* No font is listed for SPEC, but each font-backend may have |
3508 the different criteria about "font matching". So, try | |
3509 it. */ | |
3510 entity = font_matching_entity (f, attrs, spec); | |
3511 if (NILP (entity)) | |
3512 return Qnil; | |
91350
9673276f310c
(font_load_for_face): Handle the case that the font in
Kenichi Handa <handa@m17n.org>
parents:
91337
diff
changeset
|
3513 } |
94926 | 3514 return font_open_for_lface (f, entity, attrs, spec); |
90400 | 3515 } |
3516 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3517 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3518 /* Make FACE on frame F ready to use the font opened for FACE. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3519 |
90400 | 3520 void |
3521 font_prepare_for_face (f, face) | |
3522 FRAME_PTR f; | |
3523 struct face *face; | |
3524 { | |
94926 | 3525 if (face->font->driver->prepare_face) |
3526 face->font->driver->prepare_face (f, face); | |
90400 | 3527 } |
3528 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3529 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3530 /* Make FACE on frame F stop using the font opened for FACE. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3531 |
90400 | 3532 void |
3533 font_done_for_face (f, face) | |
3534 FRAME_PTR f; | |
3535 struct face *face; | |
3536 { | |
94926 | 3537 if (face->font->driver->done_face) |
3538 face->font->driver->done_face (f, face); | |
90400 | 3539 face->extra = NULL; |
3540 } | |
3541 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3542 |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3543 /* Open a font matching with font-spec SPEC on frame F. If no proper |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3544 font is found, return Qnil. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3545 |
90400 | 3546 Lisp_Object |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3547 font_open_by_spec (f, spec) |
90400 | 3548 FRAME_PTR f; |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3549 Lisp_Object spec; |
90400 | 3550 { |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3551 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3552 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3553 /* We set up the default font-related attributes of a face to prefer |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3554 a moderate font. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3555 attrs[LFACE_FAMILY_INDEX] = attrs[LFACE_FOUNDRY_INDEX] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3556 attrs[LFACE_SWIDTH_INDEX] = attrs[LFACE_WEIGHT_INDEX] |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3557 = attrs[LFACE_SLANT_INDEX] = Qnormal; |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3558 #ifndef HAVE_NS |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3559 attrs[LFACE_HEIGHT_INDEX] = make_number (120); |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3560 #else |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3561 attrs[LFACE_HEIGHT_INDEX] = make_number (0); |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3562 #endif |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3563 attrs[LFACE_FONT_INDEX] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3564 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3565 return font_load_for_lface (f, attrs, spec); |
90400 | 3566 } |
3567 | |
3568 | |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3569 /* Open a font matching with NAME on frame F. If no proper font is |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3570 found, return Qnil. */ |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3571 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3572 Lisp_Object |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3573 font_open_by_name (f, name) |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3574 FRAME_PTR f; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3575 char *name; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3576 { |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3577 Lisp_Object args[2]; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3578 Lisp_Object spec; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3579 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3580 args[0] = QCname; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3581 args[1] = make_unibyte_string (name, strlen (name)); |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3582 spec = Ffont_spec (2, args); |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3583 return font_open_by_spec (f, spec); |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3584 } |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3585 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3586 |
90400 | 3587 /* Register font-driver DRIVER. This function is used in two ways. |
3588 | |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3589 The first is with frame F non-NULL. In this case, make DRIVER |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3590 available (but not yet activated) on F. All frame creaters |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3591 (e.g. Fx_create_frame) must call this function at least once with |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3592 an available font-driver. |
90400 | 3593 |
3594 The second is with frame F NULL. In this case, DRIVER is globally | |
3595 registered in the variable `font_driver_list'. All font-driver | |
3596 implementations must call this function in its syms_of_XXXX | |
3597 (e.g. syms_of_xfont). */ | |
3598 | |
3599 void | |
3600 register_font_driver (driver, f) | |
3601 struct font_driver *driver; | |
3602 FRAME_PTR f; | |
3603 { | |
3604 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; | |
3605 struct font_driver_list *prev, *list; | |
3606 | |
3607 if (f && ! driver->draw) | |
92113
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
3608 error ("Unusable font driver for a frame: %s", |
90400 | 3609 SDATA (SYMBOL_NAME (driver->type))); |
3610 | |
3611 for (prev = NULL, list = root; list; prev = list, list = list->next) | |
90695
a1cd7344d6a2
(font_parse_xlfd): Fix the array size of `f'.
Kenichi Handa <handa@m17n.org>
parents:
90677
diff
changeset
|
3612 if (EQ (list->driver->type, driver->type)) |
90400 | 3613 error ("Duplicated font driver: %s", SDATA (SYMBOL_NAME (driver->type))); |
3614 | |
100103
c2ef1c8b2d64
(register_font_driver): Use xmalloc.
Andreas Schwab <schwab@suse.de>
parents:
99076
diff
changeset
|
3615 list = xmalloc (sizeof (struct font_driver_list)); |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3616 list->on = 0; |
90400 | 3617 list->driver = driver; |
3618 list->next = NULL; | |
3619 if (prev) | |
3620 prev->next = list; | |
3621 else if (f) | |
3622 f->font_driver_list = list; | |
3623 else | |
3624 font_driver_list = list; | |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
3625 if (! f) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
3626 num_font_drivers++; |
90400 | 3627 } |
3628 | |
100406
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3629 void |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3630 free_font_driver_list (f) |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3631 FRAME_PTR f; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3632 { |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3633 struct font_driver_list *list, *next; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3634 |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3635 for (list = f->font_driver_list; list; list = next) |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3636 { |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3637 next = list->next; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3638 xfree (list); |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3639 } |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3640 f->font_driver_list = NULL; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3641 } |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3642 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3643 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3644 /* Make the frame F use font backends listed in NEW_DRIVERS (list of |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3645 symbols, e.g. xft, x). If NEW_DRIVERS is t, make F use all |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3646 available font drivers. If NEW_DRIVERS is nil, finalize all drivers. |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3647 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3648 A caller must free all realized faces if any in advance. The |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3649 return value is a list of font backends actually made used on |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3650 F. */ |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3651 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3652 Lisp_Object |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3653 font_update_drivers (f, new_drivers) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3654 FRAME_PTR f; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3655 Lisp_Object new_drivers; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3656 { |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3657 Lisp_Object active_drivers = Qnil; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3658 struct font_driver *driver; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3659 struct font_driver_list *list; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3660 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3661 /* At first, turn off non-requested drivers, and turn on requested |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3662 drivers. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3663 for (list = f->font_driver_list; list; list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3664 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3665 driver = list->driver; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3666 if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3667 != list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3668 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3669 if (list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3670 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3671 if (driver->end_for_frame) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3672 driver->end_for_frame (f); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3673 font_finish_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3674 list->on = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3675 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3676 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3677 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3678 if (! driver->start_for_frame |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3679 || driver->start_for_frame (f) == 0) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3680 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3681 font_prepare_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3682 list->on = 1; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3683 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3684 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3685 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3686 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3687 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3688 if (NILP (new_drivers)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3689 return Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3690 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3691 if (! EQ (new_drivers, Qt)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3692 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3693 /* Re-order the driver list according to new_drivers. */ |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3694 struct font_driver_list **list_table, **next; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3695 Lisp_Object tail; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3696 int i; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3697 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3698 list_table = alloca (sizeof list_table[0] * (num_font_drivers + 1)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3699 for (i = 0, tail = new_drivers; ! NILP (tail); tail = XCDR (tail)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3700 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3701 for (list = f->font_driver_list; list; list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3702 if (list->on && EQ (list->driver->type, XCAR (tail))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3703 break; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3704 if (list) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3705 list_table[i++] = list; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3706 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3707 for (list = f->font_driver_list; list; list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3708 if (! list->on) |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
3709 list_table[i++] = list; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3710 list_table[i] = NULL; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3711 |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3712 next = &f->font_driver_list; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3713 for (i = 0; list_table[i]; i++) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3714 { |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3715 *next = list_table[i]; |
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3716 next = &(*next)->next; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3717 } |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3718 *next = NULL; |
103162
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3719 |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3720 if (! f->font_driver_list->on) |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3721 { /* None of the drivers is enabled: enable them all. |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3722 Happens if you set the list of drivers to (xft x) in your .emacs |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3723 and then use it under w32 or ns. */ |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3724 for (list = f->font_driver_list; list; list = list->next) |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3725 { |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3726 struct font_driver *driver = list->driver; |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3727 eassert (! list->on); |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3728 if (! driver->start_for_frame |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3729 || driver->start_for_frame (f) == 0) |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3730 { |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3731 font_prepare_cache (f, driver); |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3732 list->on = 1; |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3733 } |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3734 } |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3735 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3736 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3737 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3738 for (list = f->font_driver_list; list; list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3739 if (list->on) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3740 active_drivers = nconc2 (active_drivers, |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3741 Fcons (list->driver->type, Qnil)); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3742 return active_drivers; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3743 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3744 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3745 int |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3746 font_put_frame_data (f, driver, data) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3747 FRAME_PTR f; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3748 struct font_driver *driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3749 void *data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3750 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3751 struct font_data_list *list, *prev; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3752 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3753 for (prev = NULL, list = f->font_data_list; list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3754 prev = list, list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3755 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3756 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3757 if (! data) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3758 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3759 if (list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3760 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3761 if (prev) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3762 prev->next = list->next; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3763 else |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3764 f->font_data_list = list->next; |
103019
413229f94ec7
(font_put_frame_data): Use xfree instead of free.
Andreas Schwab <schwab@linux-m68k.org>
parents:
103011
diff
changeset
|
3765 xfree (list); |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3766 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3767 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3768 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3769 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3770 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3771 { |
100103
c2ef1c8b2d64
(register_font_driver): Use xmalloc.
Andreas Schwab <schwab@suse.de>
parents:
99076
diff
changeset
|
3772 list = xmalloc (sizeof (struct font_data_list)); |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3773 list->driver = driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3774 list->next = f->font_data_list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3775 f->font_data_list = list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3776 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3777 list->data = data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3778 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3779 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3780 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3781 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3782 void * |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3783 font_get_frame_data (f, driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3784 FRAME_PTR f; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3785 struct font_driver *driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3786 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3787 struct font_data_list *list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3788 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3789 for (list = f->font_data_list; list; list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3790 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3791 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3792 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3793 return NULL; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3794 return list->data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3795 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3796 |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3797 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3798 /* Return the font used to draw character C by FACE at buffer position |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3799 POS in window W. If STRING is non-nil, it is a string containing C |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3800 at index POS. If C is negative, get C from the current buffer or |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3801 STRING. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3802 |
90541 | 3803 Lisp_Object |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3804 font_at (c, pos, face, w, string) |
90541 | 3805 int c; |
3806 EMACS_INT pos; | |
3807 struct face *face; | |
3808 struct window *w; | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3809 Lisp_Object string; |
90541 | 3810 { |
3811 FRAME_PTR f; | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3812 int multibyte; |
94926 | 3813 Lisp_Object font_object; |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3814 |
100173
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3815 multibyte = (NILP (string) |
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3816 ? ! NILP (current_buffer->enable_multibyte_characters) |
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3817 : STRING_MULTIBYTE (string)); |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3818 if (c < 0) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3819 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3820 if (NILP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3821 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3822 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3823 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3824 EMACS_INT pos_byte = CHAR_TO_BYTE (pos); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3825 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3826 c = FETCH_CHAR (pos_byte); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3827 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3828 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3829 c = FETCH_BYTE (pos); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3830 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3831 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3832 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3833 unsigned char *str; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3834 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3835 multibyte = STRING_MULTIBYTE (string); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3836 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3837 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3838 EMACS_INT pos_byte = string_char_to_byte (string, pos); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3839 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3840 str = SDATA (string) + pos_byte; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3841 c = STRING_CHAR (str, 0); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3842 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3843 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3844 c = SDATA (string)[pos]; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3845 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3846 } |
90541 | 3847 |
3848 f = XFRAME (w->frame); | |
90811
c1ed0fd37416
(font_at): If the window W is not on a window system,
Kenichi Handa <handa@m17n.org>
parents:
90695
diff
changeset
|
3849 if (! FRAME_WINDOW_P (f)) |
c1ed0fd37416
(font_at): If the window W is not on a window system,
Kenichi Handa <handa@m17n.org>
parents:
90695
diff
changeset
|
3850 return Qnil; |
90541 | 3851 if (! face) |
3852 { | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3853 int face_id; |
92237
ce06567a933d
* dispextern.h (face_at_buffer_position, face_for_overlay_string)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92233
diff
changeset
|
3854 EMACS_INT endptr; |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3855 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3856 if (STRINGP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3857 face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr, |
90541 | 3858 DEFAULT_FACE_ID, 0); |
3859 else | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3860 face_id = face_at_buffer_position (w, pos, -1, -1, &endptr, |
103114
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103041
diff
changeset
|
3861 pos + 100, 0, -1); |
90541 | 3862 face = FACE_FROM_ID (f, face_id); |
3863 } | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3864 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3865 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3866 int face_id = FACE_FOR_CHAR (f, face, c, pos, string); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3867 face = FACE_FROM_ID (f, face_id); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3868 } |
94926 | 3869 if (! face->font) |
90541 | 3870 return Qnil; |
94926 | 3871 |
3872 XSETFONT (font_object, face->font); | |
3873 return font_object; | |
3874 } | |
3875 | |
3876 | |
97822 | 3877 #ifdef HAVE_WINDOW_SYSTEM |
3878 | |
3879 /* Check how many characters after POS (at most to *LIMIT) can be | |
3880 displayed by the same font on the window W. FACE, if non-NULL, is | |
3881 the face selected for the character at POS. If STRING is not nil, | |
3882 it is the string to check instead of the current buffer. In that | |
3883 case, FACE must be not NULL. | |
3884 | |
3885 The return value is the font-object for the character at POS. | |
3886 *LIMIT is set to the position where that font can't be used. | |
3887 | |
3888 It is assured that the current buffer (or STRING) is multibyte. */ | |
3889 | |
3890 Lisp_Object | |
3891 font_range (pos, limit, w, face, string) | |
3892 EMACS_INT pos, *limit; | |
3893 struct window *w; | |
94926 | 3894 struct face *face; |
3895 Lisp_Object string; | |
3896 { | |
97822 | 3897 EMACS_INT pos_byte, ignore, start, start_byte; |
94926 | 3898 int c; |
97822 | 3899 Lisp_Object font_object = Qnil; |
94926 | 3900 |
3901 if (NILP (string)) | |
3902 { | |
3903 pos_byte = CHAR_TO_BYTE (pos); | |
97822 | 3904 if (! face) |
3905 { | |
3906 int face_id; | |
3907 | |
103114
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103041
diff
changeset
|
3908 face_id = face_at_buffer_position (w, pos, 0, 0, &ignore, |
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103041
diff
changeset
|
3909 *limit, 0, -1); |
97822 | 3910 face = FACE_FROM_ID (XFRAME (w->frame), face_id); |
3911 } | |
94926 | 3912 } |
3913 else | |
3914 { | |
97822 | 3915 font_assert (face); |
94926 | 3916 pos_byte = string_char_to_byte (string, pos); |
3917 } | |
3918 | |
97822 | 3919 start = pos, start_byte = pos_byte; |
3920 while (pos < *limit) | |
94926 | 3921 { |
97822 | 3922 Lisp_Object category; |
94926 | 3923 |
3924 if (NILP (string)) | |
3925 FETCH_CHAR_ADVANCE_NO_CHECK (c, pos, pos_byte); | |
3926 else | |
3927 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, pos, pos_byte); | |
97822 | 3928 if (NILP (font_object)) |
94926 | 3929 { |
97822 | 3930 font_object = font_for_char (face, c, pos - 1, string); |
3931 if (NILP (font_object)) | |
3932 return Qnil; | |
94926 | 3933 continue; |
3934 } | |
97822 | 3935 |
3936 category = CHAR_TABLE_REF (Vunicode_category_table, c); | |
3937 if (! EQ (category, QCf) | |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
3938 && ! CHAR_VARIATION_SELECTOR_P (c) |
97822 | 3939 && font_encode_char (font_object, c) == FONT_INVALID_CODE) |
94926 | 3940 { |
97822 | 3941 Lisp_Object f = font_for_char (face, c, pos - 1, string); |
3942 EMACS_INT i, i_byte; | |
3943 | |
3944 | |
3945 if (NILP (f)) | |
3946 { | |
3947 *limit = pos - 1; | |
3948 return font_object; | |
3949 } | |
3950 i = start, i_byte = start_byte; | |
3951 while (i < pos - 1) | |
3952 { | |
3953 | |
3954 if (NILP (string)) | |
3955 FETCH_CHAR_ADVANCE_NO_CHECK (c, i, i_byte); | |
3956 else | |
3957 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, i, i_byte); | |
3958 category = CHAR_TABLE_REF (Vunicode_category_table, c); | |
3959 if (! EQ (category, QCf) | |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
3960 && ! CHAR_VARIATION_SELECTOR_P (c) |
97822 | 3961 && font_encode_char (f, c) == FONT_INVALID_CODE) |
3962 { | |
3963 *limit = pos - 1; | |
3964 return font_object; | |
3965 } | |
3966 } | |
3967 font_object = f; | |
94926 | 3968 } |
3969 } | |
97822 | 3970 return font_object; |
90541 | 3971 } |
97822 | 3972 #endif |
90541 | 3973 |
90400 | 3974 |
3975 /* Lisp API */ | |
3976 | |
94926 | 3977 DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0, |
91353
b93ade1a3602
(font_find_for_lface): Check if the character C is
Kenichi Handa <handa@m17n.org>
parents:
91350
diff
changeset
|
3978 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. |
94926 | 3979 Return nil otherwise. |
3980 Optional 2nd argument EXTRA-TYPE, if non-nil, specifies to check | |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
3981 which kind of font it is. It must be one of `font-spec', `font-entity', |
94926 | 3982 `font-object'. */) |
3983 (object, extra_type) | |
3984 Lisp_Object object, extra_type; | |
90400 | 3985 { |
94926 | 3986 if (NILP (extra_type)) |
3987 return (FONTP (object) ? Qt : Qnil); | |
3988 if (EQ (extra_type, Qfont_spec)) | |
3989 return (FONT_SPEC_P (object) ? Qt : Qnil); | |
3990 if (EQ (extra_type, Qfont_entity)) | |
3991 return (FONT_ENTITY_P (object) ? Qt : Qnil); | |
3992 if (EQ (extra_type, Qfont_object)) | |
3993 return (FONT_OBJECT_P (object) ? Qt : Qnil); | |
3994 wrong_type_argument (intern ("font-extra-type"), extra_type); | |
90400 | 3995 } |
3996 | |
3997 DEFUN ("font-spec", Ffont_spec, Sfont_spec, 0, MANY, 0, | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3998 doc: /* Return a newly created font-spec with arguments as properties. |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3999 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4000 ARGS must come in pairs KEY VALUE of font properties. KEY must be a |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4001 valid font property name listed below: |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4002 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4003 `:family', `:weight', `:slant', `:width' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4004 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4005 They are the same as face attributes of the same name. See |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4006 `set-face-attribute'. |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4007 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4008 `:foundry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4009 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4010 VALUE must be a string or a symbol specifying the font foundry, e.g. ``misc''. |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4011 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4012 `:adstyle' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4013 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4014 VALUE must be a string or a symbol specifying the additional |
94926 | 4015 typographic style information of a font, e.g. ``sans''. |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4016 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4017 `:registry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4018 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4019 VALUE must be a string or a symbol specifying the charset registry and |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4020 encoding of a font, e.g. ``iso8859-1''. |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4021 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4022 `:size' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4023 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4024 VALUE must be a non-negative integer or a floating point number |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4025 specifying the font size. It specifies the font size in pixels (if |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4026 VALUE is an integer), or in points (if VALUE is a float). |
96010
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
4027 |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
4028 `:name' |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
4029 |
96013
04be82e0cbd3
(Ffont_spec): Fix usage in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96012
diff
changeset
|
4030 VALUE must be a string of XLFD-style or fontconfig-style font name. |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4031 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4032 `:script' |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4033 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4034 VALUE must be a symbol representing a script that the font must |
101806
73703b41e43a
(Ffont_spec): Docstring modified.
Kenichi Handa <handa@m17n.org>
parents:
101422
diff
changeset
|
4035 support. It may be a symbol representing a subgroup of a script |
73703b41e43a
(Ffont_spec): Docstring modified.
Kenichi Handa <handa@m17n.org>
parents:
101422
diff
changeset
|
4036 listed in the variable `script-representative-chars'. |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4037 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4038 `:lang' |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4039 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4040 VALUE must be a symbol of two-letter ISO-639 language names, |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4041 e.g. `ja'. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4042 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4043 `:otf' |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4044 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4045 VALUE must be a list (SCRIPT-TAG LANGSYS-TAG GSUB [ GPOS ]) to specify |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4046 required OpenType features. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4047 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4048 SCRIPT-TAG: OpenType script tag symbol (e.g. `deva'). |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4049 LANGSYS-TAG: OpenType language system tag symbol, |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4050 or nil for the default language system. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4051 GSUB: List of OpenType GSUB feature tag symbols, or nil if none required. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4052 GPOS: List of OpenType GPOS feature tag symbols, or nil if none required. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4053 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4054 GSUB and GPOS may contain `nil' element. In such a case, the font |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4055 must not have any of the remaining elements. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4056 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4057 For instance, if the VALUE is `(thai nil nil (mark))', the font must |
102085 | 4058 be an OpenType font, and whose GPOS table of `thai' script's default |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4059 language system must contain `mark' feature. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
4060 |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4061 usage: (font-spec ARGS...) */) |
90400 | 4062 (nargs, args) |
4063 int nargs; | |
4064 Lisp_Object *args; | |
4065 { | |
94926 | 4066 Lisp_Object spec = font_make_spec (); |
90400 | 4067 int i; |
4068 | |
4069 for (i = 0; i < nargs; i += 2) | |
4070 { | |
103229
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4071 Lisp_Object key = args[i], val; |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4072 |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4073 CHECK_SYMBOL (key); |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4074 if (i + 1 >= nargs) |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4075 error ("No value for key `%s'", SDATA (SYMBOL_NAME (key))); |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4076 val = args[i + 1]; |
90400 | 4077 |
94926 | 4078 if (EQ (key, QCname)) |
4079 { | |
4080 CHECK_STRING (val); | |
4081 font_parse_name ((char *) SDATA (val), spec); | |
4082 font_put_extra (spec, key, val); | |
4083 } | |
90400 | 4084 else |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
4085 { |
94926 | 4086 int idx = get_font_prop_index (key); |
4087 | |
4088 if (idx >= 0) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4089 { |
94926 | 4090 val = font_prop_validate (idx, Qnil, val); |
4091 if (idx < FONT_EXTRA_INDEX) | |
4092 ASET (spec, idx, val); | |
4093 else | |
4094 font_put_extra (spec, key, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4095 } |
94926 | 4096 else |
4097 font_put_extra (spec, key, font_prop_validate (0, key, val)); | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
4098 } |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
4099 } |
90400 | 4100 return spec; |
4101 } | |
4102 | |
94926 | 4103 DEFUN ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, |
4104 doc: /* Return a copy of FONT as a font-spec. */) | |
4105 (font) | |
4106 Lisp_Object font; | |
4107 { | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4108 Lisp_Object new_spec, tail, prev, extra; |
94926 | 4109 int i; |
4110 | |
4111 CHECK_FONT (font); | |
4112 new_spec = font_make_spec (); | |
4113 for (i = 1; i < FONT_EXTRA_INDEX; i++) | |
4114 ASET (new_spec, i, AREF (font, i)); | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4115 extra = Fcopy_sequence (AREF (font, FONT_EXTRA_INDEX)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4116 /* We must remove :font-entity property. */ |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4117 for (prev = Qnil, tail = extra; CONSP (tail); prev = tail, tail = XCDR (tail)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4118 if (EQ (XCAR (XCAR (tail)), QCfont_entity)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4119 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4120 if (NILP (prev)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4121 extra = XCDR (extra); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4122 else |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4123 XSETCDR (prev, XCDR (tail)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4124 break; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4125 } |
94926 | 4126 ASET (new_spec, FONT_EXTRA_INDEX, extra); |
4127 return new_spec; | |
4128 } | |
4129 | |
4130 DEFUN ("merge-font-spec", Fmerge_font_spec, Smerge_font_spec, 2, 2, 0, | |
4131 doc: /* Merge font-specs FROM and TO, and return a new font-spec. | |
4132 Every specified properties in FROM override the corresponding | |
4133 properties in TO. */) | |
4134 (from, to) | |
4135 Lisp_Object from, to; | |
4136 { | |
4137 Lisp_Object extra, tail; | |
4138 int i; | |
4139 | |
4140 CHECK_FONT (from); | |
4141 CHECK_FONT (to); | |
4142 to = Fcopy_font_spec (to); | |
4143 for (i = 0; i < FONT_EXTRA_INDEX; i++) | |
4144 ASET (to, i, AREF (from, i)); | |
4145 extra = AREF (to, FONT_EXTRA_INDEX); | |
4146 for (tail = AREF (from, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) | |
4147 if (! EQ (XCAR (XCAR (tail)), Qfont_entity)) | |
4148 { | |
4149 Lisp_Object slot = assq_no_quit (XCAR (XCAR (tail)), extra); | |
4150 | |
4151 if (! NILP (slot)) | |
4152 XSETCDR (slot, XCDR (XCAR (tail))); | |
4153 else | |
4154 extra = Fcons (Fcons (XCAR (XCAR (tail)), XCDR (XCAR (tail))), extra); | |
4155 } | |
4156 ASET (to, FONT_EXTRA_INDEX, extra); | |
4157 return to; | |
4158 } | |
90400 | 4159 |
4160 DEFUN ("font-get", Ffont_get, Sfont_get, 2, 2, 0, | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4161 doc: /* Return the value of FONT's property KEY. |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4162 FONT is a font-spec, a font-entity, or a font-object. |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4163 KEY must be one of these symbols: |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4164 :family, :weight, :slant, :width, :foundry, :adstyle, :registry, |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4165 :size, :name, :script |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4166 See the documentation of `font-spec' for their meanings. |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4167 If FONT is a font-entity or font-object, the value of :script may be |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4168 a list of scripts that are supported by the font. */) |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4169 (font, key) |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4170 Lisp_Object font, key; |
90400 | 4171 { |
94926 | 4172 int idx; |
4173 | |
4174 CHECK_FONT (font); | |
4175 CHECK_SYMBOL (key); | |
4176 | |
4177 idx = get_font_prop_index (key); | |
96010
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
4178 if (idx >= FONT_WEIGHT_INDEX && idx <= FONT_WIDTH_INDEX) |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
4179 return font_style_symbolic (font, idx, 0); |
94926 | 4180 if (idx >= 0 && idx < FONT_EXTRA_INDEX) |
90400 | 4181 return AREF (font, idx); |
94926 | 4182 return Fcdr (Fassq (key, AREF (font, FONT_EXTRA_INDEX))); |
90400 | 4183 } |
4184 | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4185 #ifdef HAVE_WINDOW_SYSTEM |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4186 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4187 DEFUN ("font-face-attributes", Ffont_face_attributes, Sfont_face_attributes, 1, 2, 0, |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4188 doc: /* Return a plist of face attributes generated by FONT. |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4189 FONT is a font name, a font-spec, a font-entity, or a font-object. |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4190 The return value is a list of the form |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4191 |
96012
c04088bb7b0d
(Ffont_face_attributes): Fix definition.
Andreas Schwab <schwab@suse.de>
parents:
96010
diff
changeset
|
4192 \(:family FAMILY :height HEIGHT :weight WEIGHT :slant SLANT :width WIDTH) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4193 |
96014
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4194 where FAMILY, HEIGHT, WEIGHT, SLANT, and WIDTH are face attribute values |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4195 compatible with `set-face-attribute'. Some of these key-attribute pairs |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4196 may be omitted from the list if they are not specified by FONT. |
96014
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4197 |
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4198 The optional argument FRAME specifies the frame that the face attributes |
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4199 are to be displayed on. If omitted, the selected frame is used. */) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4200 (font, frame) |
96012
c04088bb7b0d
(Ffont_face_attributes): Fix definition.
Andreas Schwab <schwab@suse.de>
parents:
96010
diff
changeset
|
4201 Lisp_Object font, frame; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4202 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4203 struct frame *f; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4204 Lisp_Object plist[10]; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4205 Lisp_Object val; |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4206 int n = 0; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4207 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4208 if (NILP (frame)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4209 frame = selected_frame; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4210 CHECK_LIVE_FRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4211 f = XFRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4212 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4213 if (STRINGP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4214 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4215 int fontset = fs_query_fontset (font, 0); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4216 Lisp_Object name = font; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4217 if (fontset >= 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4218 font = fontset_ascii (fontset); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4219 font = font_spec_from_name (name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4220 if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4221 signal_error ("Invalid font name", name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4222 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4223 else if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4224 signal_error ("Invalid font object", font); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4225 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4226 val = AREF (font, FONT_FAMILY_INDEX); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4227 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4228 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4229 plist[n++] = QCfamily; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4230 plist[n++] = SYMBOL_NAME (val); |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4231 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4232 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4233 val = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4234 if (INTEGERP (val)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4235 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4236 Lisp_Object font_dpi = AREF (font, FONT_DPI_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4237 int dpi = INTEGERP (font_dpi) ? XINT (font_dpi) : f->resy; |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4238 plist[n++] = QCheight; |
96227
f9eb9f0d6678
(Ffont_face_attributes): Multiply pixel size before point
Jason Rumney <jasonr@gnu.org>
parents:
96224
diff
changeset
|
4239 plist[n++] = make_number (PIXEL_TO_POINT (XINT (val) * 10, dpi)); |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4240 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4241 else if (FLOATP (val)) |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4242 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4243 plist[n++] = QCheight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4244 plist[n++] = make_number (10 * (int) XFLOAT_DATA (val)); |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4245 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4246 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4247 val = FONT_WEIGHT_FOR_FACE (font); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4248 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4249 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4250 plist[n++] = QCweight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4251 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4252 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4253 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4254 val = FONT_SLANT_FOR_FACE (font); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4255 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4256 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4257 plist[n++] = QCslant; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4258 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4259 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4260 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4261 val = FONT_WIDTH_FOR_FACE (font); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4262 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4263 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4264 plist[n++] = QCwidth; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4265 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4266 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4267 |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4268 return Flist (n, plist); |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4269 } |
90400 | 4270 |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4271 #endif |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4272 |
90400 | 4273 DEFUN ("font-put", Ffont_put, Sfont_put, 3, 3, 0, |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4274 doc: /* Set one property of FONT-SPEC: give property PROP value VAL. */) |
90400 | 4275 (font_spec, prop, val) |
4276 Lisp_Object font_spec, prop, val; | |
4277 { | |
94926 | 4278 int idx; |
90400 | 4279 |
4280 CHECK_FONT_SPEC (font_spec); | |
94926 | 4281 idx = get_font_prop_index (prop); |
4282 if (idx >= 0 && idx < FONT_EXTRA_INDEX) | |
95573
0da1a8e03099
(Ffont_put): Don't use font_parse_family_registry for
Kenichi Handa <handa@m17n.org>
parents:
95572
diff
changeset
|
4283 ASET (font_spec, idx, font_prop_validate (idx, Qnil, val)); |
90400 | 4284 else |
94926 | 4285 font_put_extra (font_spec, prop, font_prop_validate (0, prop, val)); |
90400 | 4286 return val; |
4287 } | |
4288 | |
4289 DEFUN ("list-fonts", Flist_fonts, Slist_fonts, 1, 4, 0, | |
4290 doc: /* List available fonts matching FONT-SPEC on the current frame. | |
4291 Optional 2nd argument FRAME specifies the target frame. | |
4292 Optional 3rd argument NUM, if non-nil, limits the number of returned fonts. | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4293 Optional 4th argument PREFER, if non-nil, is a font-spec to |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4294 control the order of the returned list. Fonts are sorted by |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4295 how close they are to PREFER. */) |
90400 | 4296 (font_spec, frame, num, prefer) |
4297 Lisp_Object font_spec, frame, num, prefer; | |
4298 { | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4299 Lisp_Object vec, list; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4300 int n = 0; |
90400 | 4301 |
4302 if (NILP (frame)) | |
4303 frame = selected_frame; | |
4304 CHECK_LIVE_FRAME (frame); | |
94926 | 4305 CHECK_FONT_SPEC (font_spec); |
90400 | 4306 if (! NILP (num)) |
4307 { | |
4308 CHECK_NUMBER (num); | |
4309 n = XINT (num); | |
4310 if (n <= 0) | |
4311 return Qnil; | |
4312 } | |
4313 if (! NILP (prefer)) | |
94926 | 4314 CHECK_FONT_SPEC (prefer); |
90400 | 4315 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4316 list = font_list_entities (frame, font_spec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4317 if (NILP (list)) |
90400 | 4318 return Qnil; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4319 if (NILP (XCDR (list)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4320 && ASIZE (XCAR (list)) == 1) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4321 return Fcons (AREF (XCAR (list), 0), Qnil); |
90400 | 4322 |
4323 if (! NILP (prefer)) | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4324 vec = font_sort_entities (list, prefer, frame, 0); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4325 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4326 vec = font_vconcat_entity_vectors (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4327 if (n == 0 || n >= ASIZE (vec)) |
90400 | 4328 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4329 Lisp_Object args[2]; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4330 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4331 args[0] = vec; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4332 args[1] = Qnil; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4333 list = Fappend (2, args); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4334 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4335 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4336 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4337 for (list = Qnil, n--; n >= 0; n--) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4338 list = Fcons (AREF (vec, n), list); |
90400 | 4339 } |
4340 return list; | |
4341 } | |
4342 | |
94926 | 4343 DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0, |
90400 | 4344 doc: /* List available font families on the current frame. |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4345 Optional argument FRAME, if non-nil, specifies the target frame. */) |
90400 | 4346 (frame) |
4347 Lisp_Object frame; | |
4348 { | |
4349 FRAME_PTR f; | |
4350 struct font_driver_list *driver_list; | |
4351 Lisp_Object list; | |
4352 | |
4353 if (NILP (frame)) | |
4354 frame = selected_frame; | |
4355 CHECK_LIVE_FRAME (frame); | |
4356 f = XFRAME (frame); | |
4357 list = Qnil; | |
4358 for (driver_list = f->font_driver_list; driver_list; | |
4359 driver_list = driver_list->next) | |
4360 if (driver_list->driver->list_family) | |
4361 { | |
4362 Lisp_Object val = driver_list->driver->list_family (frame); | |
101028
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4363 Lisp_Object tail = list; |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4364 |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4365 for (; CONSP (val); val = XCDR (val)) |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4366 if (NILP (Fmemq (XCAR (val), tail)) |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4367 && SYMBOLP (XCAR (val))) |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4368 list = Fcons (SYMBOL_NAME (XCAR (val)), list); |
90400 | 4369 } |
4370 return list; | |
4371 } | |
4372 | |
4373 DEFUN ("find-font", Ffind_font, Sfind_font, 1, 2, 0, | |
4374 doc: /* Return a font-entity matching with FONT-SPEC on the current frame. | |
4375 Optional 2nd argument FRAME, if non-nil, specifies the target frame. */) | |
4376 (font_spec, frame) | |
4377 Lisp_Object font_spec, frame; | |
4378 { | |
4379 Lisp_Object val = Flist_fonts (font_spec, frame, make_number (1), Qnil); | |
4380 | |
4381 if (CONSP (val)) | |
4382 val = XCAR (val); | |
4383 return val; | |
4384 } | |
4385 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4386 DEFUN ("font-xlfd-name", Ffont_xlfd_name, Sfont_xlfd_name, 1, 2, 0, |
90400 | 4387 doc: /* Return XLFD name of FONT. |
4388 FONT is a font-spec, font-entity, or font-object. | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4389 If the name is too long for XLFD (maximum 255 chars), return nil. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4390 If the 2nd optional arg FOLD-WILDCARDS is non-nil, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4391 the consecutive wildcards are folded to one. */) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4392 (font, fold_wildcards) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4393 Lisp_Object font, fold_wildcards; |
90400 | 4394 { |
4395 char name[256]; | |
4396 int pixel_size = 0; | |
4397 | |
94926 | 4398 CHECK_FONT (font); |
4399 | |
4400 if (FONT_OBJECT_P (font)) | |
90400 | 4401 { |
94926 | 4402 Lisp_Object font_name = AREF (font, FONT_NAME_INDEX); |
4403 | |
4404 if (STRINGP (font_name) | |
4405 && SDATA (font_name)[0] == '-') | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4406 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4407 if (NILP (fold_wildcards)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4408 return font_name; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4409 strcpy (name, (char *) SDATA (font_name)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4410 goto done; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4411 } |
94926 | 4412 pixel_size = XFONT_OBJECT (font)->pixel_size; |
90400 | 4413 } |
4414 if (font_unparse_xlfd (font, pixel_size, name, 256) < 0) | |
4415 return Qnil; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4416 done: |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4417 if (! NILP (fold_wildcards)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4418 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4419 char *p0 = name, *p1; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4420 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4421 while ((p1 = strstr (p0, "-*-*"))) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4422 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4423 strcpy (p1, p1 + 2); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4424 p0 = p1; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4425 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4426 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4427 |
90400 | 4428 return build_string (name); |
4429 } | |
4430 | |
4431 DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0, | |
4432 doc: /* Clear font cache. */) | |
4433 () | |
4434 { | |
4435 Lisp_Object list, frame; | |
4436 | |
4437 FOR_EACH_FRAME (list, frame) | |
4438 { | |
4439 FRAME_PTR f = XFRAME (frame); | |
4440 struct font_driver_list *driver_list = f->font_driver_list; | |
4441 | |
4442 for (; driver_list; driver_list = driver_list->next) | |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4443 if (driver_list->on) |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4444 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4445 Lisp_Object cache = driver_list->driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4446 Lisp_Object val; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4447 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4448 val = XCDR (cache); |
91909 | 4449 while (! NILP (val) |
4450 && ! EQ (XCAR (XCAR (val)), driver_list->driver->type)) | |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4451 val = XCDR (val); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4452 font_assert (! NILP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4453 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4454 if (XINT (XCAR (val)) == 0) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4455 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4456 font_clear_cache (f, XCAR (val), driver_list->driver); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4457 XSETCDR (cache, XCDR (val)); |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4458 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4459 } |
90400 | 4460 } |
4461 | |
4462 return Qnil; | |
4463 } | |
4464 | |
97822 | 4465 |
4466 void | |
4467 font_fill_lglyph_metrics (glyph, font_object) | |
4468 Lisp_Object glyph, font_object; | |
90400 | 4469 { |
97822 | 4470 struct font *font = XFONT_OBJECT (font_object); |
97853
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4471 unsigned code; |
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4472 /* ecode used in LGLYPH_SET_CODE to avoid compiler warnings. */ |
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4473 EMACS_INT ecode = font->driver->encode_char (font, LGLYPH_CHAR (glyph)); |
97822 | 4474 struct font_metrics metrics; |
4475 | |
97853
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4476 LGLYPH_SET_CODE (glyph, ecode); |
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4477 code = ecode; |
97822 | 4478 font->driver->text_extents (font, &code, 1, &metrics); |
4479 LGLYPH_SET_LBEARING (glyph, metrics.lbearing); | |
4480 LGLYPH_SET_RBEARING (glyph, metrics.rbearing); | |
4481 LGLYPH_SET_WIDTH (glyph, metrics.width); | |
4482 LGLYPH_SET_ASCENT (glyph, metrics.ascent); | |
4483 LGLYPH_SET_DESCENT (glyph, metrics.descent); | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4484 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4485 |
97822 | 4486 |
4487 DEFUN ("font-shape-gstring", Ffont_shape_gstring, Sfont_shape_gstring, 1, 1, 0, | |
4488 doc: /* Shape the glyph-string GSTRING. | |
4489 Shaping means substituting glyphs and/or adjusting positions of glyphs | |
4490 to get the correct visual image of character sequences set in the | |
4491 header of the glyph-string. | |
4492 | |
4493 If the shaping was successful, the value is GSTRING itself or a newly | |
4494 created glyph-string. Otherwise, the value is nil. */) | |
4495 (gstring) | |
4496 Lisp_Object gstring; | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4497 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4498 struct font *font; |
97822 | 4499 Lisp_Object font_object, n, glyph; |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4500 int i, j, from, to; |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4501 |
97822 | 4502 if (! composition_gstring_p (gstring)) |
4503 signal_error ("Invalid glyph-string: ", gstring); | |
4504 if (! NILP (LGSTRING_ID (gstring))) | |
4505 return gstring; | |
4506 font_object = LGSTRING_FONT (gstring); | |
4507 CHECK_FONT_OBJECT (font_object); | |
94926 | 4508 font = XFONT_OBJECT (font_object); |
92183
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4509 if (! font->driver->shape) |
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4510 return Qnil; |
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4511 |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4512 /* Try at most three times with larger gstring each time. */ |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4513 for (i = 0; i < 3; i++) |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4514 { |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4515 n = font->driver->shape (gstring); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4516 if (INTEGERP (n)) |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4517 break; |
97822 | 4518 gstring = larger_vector (gstring, |
4519 ASIZE (gstring) + LGSTRING_GLYPH_LEN (gstring), | |
4520 Qnil); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4521 } |
97822 | 4522 if (i == 3 || XINT (n) == 0) |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4523 return Qnil; |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4524 |
97822 | 4525 glyph = LGSTRING_GLYPH (gstring, 0); |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4526 from = LGLYPH_FROM (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4527 to = LGLYPH_TO (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4528 for (i = 1, j = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4529 { |
97822 | 4530 Lisp_Object this = LGSTRING_GLYPH (gstring, i); |
4531 | |
4532 if (NILP (this)) | |
4533 break; | |
4534 if (NILP (LGLYPH_ADJUSTMENT (this))) | |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4535 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4536 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4537 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4538 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4539 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4540 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4541 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4542 } |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4543 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4544 to = LGLYPH_TO (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4545 j = i; |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4546 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4547 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4548 { |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4549 if (from > LGLYPH_FROM (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4550 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4551 if (to < LGLYPH_TO (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4552 to = LGLYPH_TO (this); |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4553 } |
90541 | 4554 } |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4555 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4556 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4557 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4558 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4559 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4560 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4561 } |
97822 | 4562 return composition_gstring_put_cache (gstring, XINT (n)); |
90400 | 4563 } |
4564 | |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4565 DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs, |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4566 2, 2, 0, |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4567 doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT. |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4568 Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID), |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4569 where |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4570 VARIATION-SELECTOR is a chracter code of variation selection |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4571 (#xFE00..#xFE0F or #xE0100..#xE01EF) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4572 GLYPH-ID is a glyph code of the corresponding variation glyph. */) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4573 (font_object, character) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4574 Lisp_Object font_object, character; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4575 { |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4576 unsigned variations[256]; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4577 struct font *font; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4578 int i, n; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4579 Lisp_Object val; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4580 |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4581 CHECK_FONT_OBJECT (font_object); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4582 CHECK_CHARACTER (character); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4583 font = XFONT_OBJECT (font_object); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4584 if (! font->driver->get_variation_glyphs) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4585 return Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4586 n = font->driver->get_variation_glyphs (font, XINT (character), variations); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4587 if (! n) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4588 return Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4589 val = Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4590 for (i = 0; i < 255; i++) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4591 if (variations[i]) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4592 { |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4593 Lisp_Object code; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4594 int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16)); |
101226
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4595 /* Stops GCC whining about limited range of data type. */ |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4596 EMACS_INT var = variations[i]; |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4597 |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4598 if (var > MOST_POSITIVE_FIXNUM) |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4599 code = Fcons (make_number ((variations[i]) >> 16), |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4600 make_number ((variations[i]) & 0xFFFF)); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4601 else |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4602 code = make_number (variations[i]); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4603 val = Fcons (Fcons (make_number (vs), code), val); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4604 } |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4605 return val; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4606 } |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4607 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4608 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4609 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4610 DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4611 doc: /* Apply OpenType features on glyph-string GSTRING-IN. |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4612 OTF-FEATURES specifies which features to apply in this format: |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4613 (SCRIPT LANGSYS GSUB GPOS) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4614 where |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4615 SCRIPT is a symbol specifying a script tag of OpenType, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4616 LANGSYS is a symbol specifying a langsys tag of OpenType, |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4617 GSUB and GPOS, if non-nil, are lists of symbols specifying feature tags. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4618 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4619 If LANGYS is nil, the default langsys is selected. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4620 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4621 The features are applied in the order they appear in the list. The |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4622 symbol `*' means to apply all available features not present in this |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4623 list, and the remaining features are ignored. For instance, (vatu |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4624 pstf * haln) is to apply vatu and pstf in this order, then to apply |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4625 all available features other than vatu, pstf, and haln. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4626 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4627 The features are applied to the glyphs in the range FROM and TO of |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4628 the glyph-string GSTRING-IN. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4629 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4630 If some feature is actually applicable, the resulting glyphs are |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4631 produced in the glyph-string GSTRING-OUT from the index INDEX. In |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4632 this case, the value is the number of produced glyphs. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4633 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4634 If no feature is applicable, no glyph is produced in GSTRING-OUT, and |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4635 the value is 0. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4636 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4637 If GSTRING-OUT is too short to hold produced glyphs, no glyphs are |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4638 produced in GSTRING-OUT, and the value is nil. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4639 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4640 See the documentation of `font-make-gstring' for the format of |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4641 glyph-string. */) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4642 (otf_features, gstring_in, from, to, gstring_out, index) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4643 Lisp_Object otf_features, gstring_in, from, to, gstring_out, index; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4644 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4645 Lisp_Object font_object = LGSTRING_FONT (gstring_in); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4646 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4647 struct font *font; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4648 int len, num; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4649 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4650 check_otf_features (otf_features); |
94926 | 4651 CHECK_FONT_OBJECT (font_object); |
4652 font = XFONT_OBJECT (font_object); | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4653 if (! font->driver->otf_drive) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4654 error ("Font backend %s can't drive OpenType GSUB table", |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4655 SDATA (SYMBOL_NAME (font->driver->type))); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4656 CHECK_CONS (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4657 CHECK_SYMBOL (XCAR (otf_features)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4658 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4659 CHECK_SYMBOL (XCAR (val)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4660 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4661 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4662 CHECK_CONS (val); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4663 len = check_gstring (gstring_in); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4664 CHECK_VECTOR (gstring_out); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4665 CHECK_NATNUM (from); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4666 CHECK_NATNUM (to); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4667 CHECK_NATNUM (index); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4668 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4669 if (XINT (from) >= XINT (to) || XINT (to) > len) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4670 args_out_of_range_3 (from, to, make_number (len)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4671 if (XINT (index) >= ASIZE (gstring_out)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4672 args_out_of_range (index, make_number (ASIZE (gstring_out))); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4673 num = font->driver->otf_drive (font, otf_features, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4674 gstring_in, XINT (from), XINT (to), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4675 gstring_out, XINT (index), 0); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4676 if (num < 0) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4677 return Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4678 return make_number (num); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4679 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4680 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4681 DEFUN ("font-otf-alternates", Ffont_otf_alternates, Sfont_otf_alternates, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4682 3, 3, 0, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4683 doc: /* Return a list of alternate glyphs of CHARACTER in FONT-OBJECT. |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4684 OTF-FEATURES specifies which features of the font FONT-OBJECT to apply |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4685 in this format: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4686 (SCRIPT LANGSYS FEATURE ...) |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4687 See the documentation of `font-drive-otf' for more detail. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4688 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4689 The value is a list of cons cells of the format (GLYPH-ID . CHARACTER), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4690 where GLYPH-ID is a glyph index of the font, and CHARACTER is a |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4691 character code corresponding to the glyph or nil if there's no |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4692 corresponding character. */) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4693 (font_object, character, otf_features) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4694 Lisp_Object font_object, character, otf_features; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4695 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4696 struct font *font; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4697 Lisp_Object gstring_in, gstring_out, g; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4698 Lisp_Object alternates; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4699 int i, num; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4700 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4701 CHECK_FONT_GET_OBJECT (font_object, font); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4702 if (! font->driver->otf_drive) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
4703 error ("Font backend %s can't drive OpenType GSUB table", |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
4704 SDATA (SYMBOL_NAME (font->driver->type))); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4705 CHECK_CHARACTER (character); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4706 CHECK_CONS (otf_features); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4707 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4708 gstring_in = Ffont_make_gstring (font_object, make_number (1)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4709 g = LGSTRING_GLYPH (gstring_in, 0); |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
4710 LGLYPH_SET_CHAR (g, XINT (character)); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4711 gstring_out = Ffont_make_gstring (font_object, make_number (10)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4712 while ((num = font->driver->otf_drive (font, otf_features, gstring_in, 0, 1, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4713 gstring_out, 0, 1)) < 0) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4714 gstring_out = Ffont_make_gstring (font_object, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4715 make_number (ASIZE (gstring_out) * 2)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4716 alternates = Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4717 for (i = 0; i < num; i++) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4718 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4719 Lisp_Object g = LGSTRING_GLYPH (gstring_out, i); |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
4720 int c = LGLYPH_CHAR (g); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
4721 unsigned code = LGLYPH_CODE (g); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4722 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4723 alternates = Fcons (Fcons (make_number (code), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4724 c > 0 ? make_number (c) : Qnil), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4725 alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4726 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4727 return Fnreverse (alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4728 } |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4729 #endif /* 0 */ |
90400 | 4730 |
4731 #ifdef FONT_DEBUG | |
4732 | |
4733 DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, | |
4734 doc: /* Open FONT-ENTITY. */) | |
4735 (font_entity, size, frame) | |
4736 Lisp_Object font_entity; | |
4737 Lisp_Object size; | |
4738 Lisp_Object frame; | |
4739 { | |
4740 int isize; | |
4741 | |
4742 CHECK_FONT_ENTITY (font_entity); | |
4743 if (NILP (frame)) | |
4744 frame = selected_frame; | |
4745 CHECK_LIVE_FRAME (frame); | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4746 |
94926 | 4747 if (NILP (size)) |
4748 isize = XINT (AREF (font_entity, FONT_SIZE_INDEX)); | |
4749 else | |
4750 { | |
4751 CHECK_NUMBER_OR_FLOAT (size); | |
4752 if (FLOATP (size)) | |
100165
7add351b47c9
(Fopen_font): Compute pixel size correctly.
Chong Yidong <cyd@stupidchicken.com>
parents:
100126
diff
changeset
|
4753 isize = POINT_TO_PIXEL (XFLOAT_DATA (size), XFRAME (frame)->resy); |
94926 | 4754 else |
4755 isize = XINT (size); | |
4756 if (isize == 0) | |
4757 isize = 120; | |
4758 } | |
90400 | 4759 return font_open_entity (XFRAME (frame), font_entity, isize); |
4760 } | |
4761 | |
4762 DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, | |
4763 doc: /* Close FONT-OBJECT. */) | |
4764 (font_object, frame) | |
4765 Lisp_Object font_object, frame; | |
4766 { | |
4767 CHECK_FONT_OBJECT (font_object); | |
4768 if (NILP (frame)) | |
4769 frame = selected_frame; | |
4770 CHECK_LIVE_FRAME (frame); | |
4771 font_close_object (XFRAME (frame), font_object); | |
4772 return Qnil; | |
4773 } | |
4774 | |
4775 DEFUN ("query-font", Fquery_font, Squery_font, 1, 1, 0, | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4776 doc: /* Return information about FONT-OBJECT. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4777 The value is a vector: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4778 [ NAME FILENAME PIXEL-SIZE SIZE ASCENT DESCENT SPACE-WIDTH AVERAGE-WIDTH |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4779 CAPABILITY ] |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4780 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4781 NAME is a string of the font name (or nil if the font backend doesn't |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4782 provide a name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4783 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4784 FILENAME is a string of the font file (or nil if the font backend |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4785 doesn't provide a file name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4786 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4787 PIXEL-SIZE is a pixel size by which the font is opened. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4788 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4789 SIZE is a maximum advance width of the font in pixels. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4790 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4791 ASCENT, DESCENT, SPACE-WIDTH, AVERAGE-WIDTH are metrics of the font in |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4792 pixels. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4793 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4794 CAPABILITY is a list whose first element is a symbol representing the |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4795 font format \(x, opentype, truetype, type1, pcf, or bdf) and the |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4796 remaining elements describe the details of the font capability. |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4797 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4798 If the font is OpenType font, the form of the list is |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4799 \(opentype GSUB GPOS) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4800 where GSUB shows which "GSUB" features the font supports, and GPOS |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4801 shows which "GPOS" features the font supports. Both GSUB and GPOS are |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4802 lists of the format: |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4803 \((SCRIPT (LANGSYS FEATURE ...) ...) ...) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4804 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4805 If the font is not OpenType font, currently the length of the form is |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4806 one. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4807 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4808 SCRIPT is a symbol representing OpenType script tag. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4809 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4810 LANGSYS is a symbol representing OpenType langsys tag, or nil |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4811 representing the default langsys. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4812 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4813 FEATURE is a symbol representing OpenType feature tag. |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4814 |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4815 If the font is not OpenType font, CAPABILITY is nil. */) |
90400 | 4816 (font_object) |
4817 Lisp_Object font_object; | |
4818 { | |
4819 struct font *font; | |
4820 Lisp_Object val; | |
4821 | |
4822 CHECK_FONT_GET_OBJECT (font_object, font); | |
4823 | |
4824 val = Fmake_vector (make_number (9), Qnil); | |
94926 | 4825 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); |
4826 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); | |
90400 | 4827 ASET (val, 2, make_number (font->pixel_size)); |
94926 | 4828 ASET (val, 3, make_number (font->max_width)); |
90400 | 4829 ASET (val, 4, make_number (font->ascent)); |
4830 ASET (val, 5, make_number (font->descent)); | |
94926 | 4831 ASET (val, 6, make_number (font->space_width)); |
4832 ASET (val, 7, make_number (font->average_width)); | |
90400 | 4833 if (font->driver->otf_capability) |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4834 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font))); |
90400 | 4835 return val; |
4836 } | |
4837 | |
4838 DEFUN ("get-font-glyphs", Fget_font_glyphs, Sget_font_glyphs, 2, 2, 0, | |
4839 doc: /* Return a vector of glyphs of FONT-OBJECT for drawing STRING. | |
4840 Each element is a vector [GLYPH-CODE LBEARING RBEARING WIDTH ASCENT DESCENT]. */) | |
4841 (font_object, string) | |
4842 Lisp_Object font_object, string; | |
4843 { | |
4844 struct font *font; | |
4845 int i, len; | |
4846 Lisp_Object vec; | |
4847 | |
4848 CHECK_FONT_GET_OBJECT (font_object, font); | |
4849 CHECK_STRING (string); | |
4850 len = SCHARS (string); | |
4851 vec = Fmake_vector (make_number (len), Qnil); | |
4852 for (i = 0; i < len; i++) | |
4853 { | |
4854 Lisp_Object ch = Faref (string, make_number (i)); | |
4855 Lisp_Object val; | |
4856 int c = XINT (ch); | |
4857 unsigned code; | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4858 EMACS_INT cod; |
90400 | 4859 struct font_metrics metrics; |
4860 | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4861 cod = code = font->driver->encode_char (font, c); |
90400 | 4862 if (code == FONT_INVALID_CODE) |
4863 continue; | |
4864 val = Fmake_vector (make_number (6), Qnil); | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4865 if (cod <= MOST_POSITIVE_FIXNUM) |
90400 | 4866 ASET (val, 0, make_number (code)); |
4867 else | |
4868 ASET (val, 0, Fcons (make_number (code >> 16), | |
4869 make_number (code & 0xFFFF))); | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4870 font->driver->text_extents (font, &code, 1, &metrics); |
90400 | 4871 ASET (val, 1, make_number (metrics.lbearing)); |
4872 ASET (val, 2, make_number (metrics.rbearing)); | |
4873 ASET (val, 3, make_number (metrics.width)); | |
4874 ASET (val, 4, make_number (metrics.ascent)); | |
4875 ASET (val, 5, make_number (metrics.descent)); | |
4876 ASET (vec, i, val); | |
4877 } | |
4878 return vec; | |
4879 } | |
4880 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4881 DEFUN ("font-match-p", Ffont_match_p, Sfont_match_p, 2, 2, 0, |
94745
a995b289585f
(Ffont_match_p): Don't use `iff' in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
94394
diff
changeset
|
4882 doc: /* Return t if and only if font-spec SPEC matches with FONT. |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4883 FONT is a font-spec, font-entity, or font-object. */) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4884 (spec, font) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4885 Lisp_Object spec, font; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4886 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4887 CHECK_FONT_SPEC (spec); |
94926 | 4888 CHECK_FONT (font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4889 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4890 return (font_match_p (spec, font) ? Qt : Qnil); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4891 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4892 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4893 DEFUN ("font-at", Ffont_at, Sfont_at, 1, 3, 0, |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4894 doc: /* Return a font-object for displaying a character at POSITION. |
90541 | 4895 Optional second arg WINDOW, if non-nil, is a window displaying |
4896 the current buffer. It defaults to the currently selected window. */) | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4897 (position, window, string) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4898 Lisp_Object position, window, string; |
90541 | 4899 { |
4900 struct window *w; | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
4901 EMACS_INT pos; |
90541 | 4902 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4903 if (NILP (string)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4904 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4905 CHECK_NUMBER_COERCE_MARKER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4906 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4907 if (pos < BEGV || pos >= ZV) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4908 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4909 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4910 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4911 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4912 CHECK_NUMBER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4913 CHECK_STRING (string); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4914 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4915 if (pos < 0 || pos >= SCHARS (string)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4916 args_out_of_range (string, position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4917 } |
90541 | 4918 if (NILP (window)) |
4919 window = selected_window; | |
4920 CHECK_LIVE_WINDOW (window); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4921 w = XWINDOW (window); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4922 |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4923 return font_at (-1, pos, NULL, w, string); |
90541 | 4924 } |
4925 | |
90400 | 4926 #if 0 |
4927 DEFUN ("draw-string", Fdraw_string, Sdraw_string, 2, 2, 0, | |
4928 doc: /* Draw STRING by FONT-OBJECT on the top left corner of the current frame. | |
4929 The value is a number of glyphs drawn. | |
4930 Type C-l to recover what previously shown. */) | |
4931 (font_object, string) | |
4932 Lisp_Object font_object, string; | |
4933 { | |
4934 Lisp_Object frame = selected_frame; | |
4935 FRAME_PTR f = XFRAME (frame); | |
4936 struct font *font; | |
4937 struct face *face; | |
4938 int i, len, width; | |
4939 unsigned *code; | |
4940 | |
4941 CHECK_FONT_GET_OBJECT (font_object, font); | |
4942 CHECK_STRING (string); | |
4943 len = SCHARS (string); | |
4944 code = alloca (sizeof (unsigned) * len); | |
4945 for (i = 0; i < len; i++) | |
4946 { | |
4947 Lisp_Object ch = Faref (string, make_number (i)); | |
4948 Lisp_Object val; | |
4949 int c = XINT (ch); | |
4950 | |
4951 code[i] = font->driver->encode_char (font, c); | |
4952 if (code[i] == FONT_INVALID_CODE) | |
4953 break; | |
4954 } | |
4955 face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
4956 face->fontp = font; | |
4957 if (font->driver->prepare_face) | |
4958 font->driver->prepare_face (f, face); | |
4959 width = font->driver->text_extents (font, code, i, NULL); | |
4960 len = font->driver->draw_text (f, face, 0, font->ascent, code, i, width); | |
4961 if (font->driver->done_face) | |
4962 font->driver->done_face (f, face); | |
4963 face->fontp = NULL; | |
4964 return make_number (len); | |
4965 } | |
4966 #endif | |
4967 | |
4968 #endif /* FONT_DEBUG */ | |
4969 | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4970 #ifdef HAVE_WINDOW_SYSTEM |
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4971 |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4972 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4973 doc: /* Return information about a font named NAME on frame FRAME. |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4974 If FRAME is omitted or nil, use the selected frame. |
102963
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
4975 The returned value is a vector of OPENED-NAME, FULL-NAME, SIZE, |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4976 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4977 where |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4978 OPENED-NAME is the name used for opening the font, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4979 FULL-NAME is the full name of the font, |
102963
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
4980 SIZE is the pixelsize of the font, |
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
4981 HEIGHT is the pixel-height of the font (i.e ascent + descent), |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4982 BASELINE-OFFSET is the upward offset pixels from ASCII baseline, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4983 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4984 how to compose characters. |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4985 If the named font is not yet loaded, return nil. */) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4986 (name, frame) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4987 Lisp_Object name, frame; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4988 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4989 FRAME_PTR f; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4990 struct font *font; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4991 Lisp_Object info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4992 Lisp_Object font_object; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4993 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4994 (*check_window_system_func) (); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4995 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4996 if (! FONTP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4997 CHECK_STRING (name); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4998 if (NILP (frame)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4999 frame = selected_frame; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5000 CHECK_LIVE_FRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5001 f = XFRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5002 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5003 if (STRINGP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5004 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5005 int fontset = fs_query_fontset (name, 0); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5006 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5007 if (fontset >= 0) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5008 name = fontset_ascii (fontset); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5009 font_object = font_open_by_name (f, (char *) SDATA (name)); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5010 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5011 else if (FONT_OBJECT_P (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5012 font_object = name; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5013 else if (FONT_ENTITY_P (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5014 font_object = font_open_entity (f, name, 0); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5015 else |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5016 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5017 struct face *face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5018 Lisp_Object entity = font_matching_entity (f, face->lface, name); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5019 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5020 font_object = ! NILP (entity) ? font_open_entity (f, entity, 0) : Qnil; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5021 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5022 if (NILP (font_object)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5023 return Qnil; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5024 font = XFONT_OBJECT (font_object); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5025 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5026 info = Fmake_vector (make_number (7), Qnil); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5027 XVECTOR (info)->contents[0] = AREF (font_object, FONT_NAME_INDEX); |
102963
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
5028 XVECTOR (info)->contents[1] = AREF (font_object, FONT_FULLNAME_INDEX); |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5029 XVECTOR (info)->contents[2] = make_number (font->pixel_size); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5030 XVECTOR (info)->contents[3] = make_number (font->height); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5031 XVECTOR (info)->contents[4] = make_number (font->baseline_offset); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5032 XVECTOR (info)->contents[5] = make_number (font->relative_compose); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5033 XVECTOR (info)->contents[6] = make_number (font->default_ascent); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5034 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5035 #if 0 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5036 /* As font_object is still in FONT_OBJLIST of the entity, we can't |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5037 close it now. Perhaps, we should manage font-objects |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5038 by `reference-count'. */ |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5039 font_close_object (f, font_object); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5040 #endif |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5041 return info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5042 } |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5043 #endif |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5044 |
90400 | 5045 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5046 #define BUILD_STYLE_TABLE(TBL) \ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5047 build_style_table ((TBL), sizeof TBL / sizeof (struct table_entry)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5048 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5049 static Lisp_Object |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5050 build_style_table (entry, nelement) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5051 struct table_entry *entry; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5052 int nelement; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5053 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5054 int i, j; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5055 Lisp_Object table, elt; |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5056 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5057 table = Fmake_vector (make_number (nelement), Qnil); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5058 for (i = 0; i < nelement; i++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5059 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5060 for (j = 0; entry[i].names[j]; j++); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5061 elt = Fmake_vector (make_number (j + 1), Qnil); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5062 ASET (elt, 0, make_number (entry[i].numeric)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5063 for (j = 0; entry[i].names[j]; j++) |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5064 ASET (elt, j + 1, intern (entry[i].names[j])); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5065 ASET (table, i, elt); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5066 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5067 return table; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5068 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5069 |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5070 Lisp_Object Vfont_log; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5071 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5072 /* The deferred font-log data of the form [ACTION ARG RESULT]. |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5073 If ACTION is not nil, that is added to the log when font_add_log is |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5074 called next time. At that time, ACTION is set back to nil. */ |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5075 static Lisp_Object Vfont_log_deferred; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5076 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5077 /* Prepend the font-related logging data in Vfont_log if it is not |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5078 `t'. ACTION describes a kind of font-related action (e.g. listing, |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5079 opening), ARG is the argument for the action, and RESULT is the |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5080 result of the action. */ |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5081 void |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5082 font_add_log (action, arg, result) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5083 char *action; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5084 Lisp_Object arg, result; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5085 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5086 Lisp_Object tail, val; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5087 int i; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5088 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5089 if (EQ (Vfont_log, Qt)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5090 return; |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5091 if (STRINGP (AREF (Vfont_log_deferred, 0))) |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5092 { |
97822 | 5093 char *str = (char *) SDATA (AREF (Vfont_log_deferred, 0)); |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5094 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5095 ASET (Vfont_log_deferred, 0, Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5096 font_add_log (str, AREF (Vfont_log_deferred, 1), |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5097 AREF (Vfont_log_deferred, 2)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5098 } |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5099 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5100 if (FONTP (arg)) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5101 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5102 Lisp_Object tail, elt; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5103 Lisp_Object equalstr = build_string ("="); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5104 |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5105 val = Ffont_xlfd_name (arg, Qt); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5106 for (tail = AREF (arg, FONT_EXTRA_INDEX); CONSP (tail); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5107 tail = XCDR (tail)) |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5108 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5109 elt = XCAR (tail); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5110 if (EQ (XCAR (elt), QCscript) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5111 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5112 val = concat3 (val, SYMBOL_NAME (QCscript), |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5113 concat2 (equalstr, SYMBOL_NAME (XCDR (elt)))); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5114 else if (EQ (XCAR (elt), QClang) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5115 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5116 val = concat3 (val, SYMBOL_NAME (QClang), |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5117 concat2 (equalstr, SYMBOL_NAME (XCDR (elt)))); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5118 else if (EQ (XCAR (elt), QCotf) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5119 && CONSP (XCDR (elt)) && SYMBOLP (XCAR (XCDR (elt)))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5120 val = concat3 (val, SYMBOL_NAME (QCotf), |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5121 concat2 (equalstr, |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5122 SYMBOL_NAME (XCAR (XCDR (elt))))); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5123 } |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5124 arg = val; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5125 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5126 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5127 if (CONSP (result) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5128 && VECTORP (XCAR (result)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5129 && ASIZE (XCAR (result)) > 0 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5130 && FONTP (AREF (XCAR (result), 0))) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5131 result = font_vconcat_entity_vectors (result); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5132 if (FONTP (result)) |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5133 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5134 val = Ffont_xlfd_name (result, Qt); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5135 if (! FONT_SPEC_P (result)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5136 val = concat3 (SYMBOL_NAME (AREF (result, FONT_TYPE_INDEX)), |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5137 build_string (":"), val); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5138 result = val; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5139 } |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5140 else if (CONSP (result)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5141 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5142 result = Fcopy_sequence (result); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5143 for (tail = result; CONSP (tail); tail = XCDR (tail)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5144 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5145 val = XCAR (tail); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5146 if (FONTP (val)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5147 val = Ffont_xlfd_name (val, Qt); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5148 XSETCAR (tail, val); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5149 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5150 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5151 else if (VECTORP (result)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5152 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5153 result = Fcopy_sequence (result); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5154 for (i = 0; i < ASIZE (result); i++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5155 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5156 val = AREF (result, i); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5157 if (FONTP (val)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5158 val = Ffont_xlfd_name (val, Qt); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5159 ASET (result, i, val); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5160 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5161 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5162 Vfont_log = Fcons (list3 (intern (action), arg, result), Vfont_log); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5163 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5164 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5165 /* Record a font-related logging data to be added to Vfont_log when |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5166 font_add_log is called next time. ACTION, ARG, RESULT are the same |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5167 as font_add_log. */ |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5168 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5169 void |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5170 font_deferred_log (action, arg, result) |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5171 char *action; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5172 Lisp_Object arg, result; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5173 { |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5174 if (EQ (Vfont_log, Qt)) |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5175 return; |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5176 ASET (Vfont_log_deferred, 0, build_string (action)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5177 ASET (Vfont_log_deferred, 1, arg); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5178 ASET (Vfont_log_deferred, 2, result); |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
5179 } |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5180 |
90400 | 5181 extern void syms_of_ftfont P_ (()); |
5182 extern void syms_of_xfont P_ (()); | |
5183 extern void syms_of_xftfont P_ (()); | |
5184 extern void syms_of_ftxfont P_ (()); | |
5185 extern void syms_of_bdffont P_ (()); | |
5186 extern void syms_of_w32font P_ (()); | |
5187 extern void syms_of_atmfont P_ (()); | |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5188 extern void syms_of_nsfont P_ (()); |
90400 | 5189 |
5190 void | |
5191 syms_of_font () | |
5192 { | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5193 sort_shift_bits[FONT_TYPE_INDEX] = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5194 sort_shift_bits[FONT_SLANT_INDEX] = 2; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5195 sort_shift_bits[FONT_WEIGHT_INDEX] = 9; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5196 sort_shift_bits[FONT_SIZE_INDEX] = 16; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5197 sort_shift_bits[FONT_WIDTH_INDEX] = 23; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5198 /* Note that the other elements in sort_shift_bits are not used. */ |
90400 | 5199 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5200 staticpro (&font_charset_alist); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5201 font_charset_alist = Qnil; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5202 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
5203 DEFSYM (Qopentype, "opentype"); |
90400 | 5204 |
95699 | 5205 DEFSYM (Qascii_0, "ascii-0"); |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5206 DEFSYM (Qiso8859_1, "iso8859-1"); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5207 DEFSYM (Qiso10646_1, "iso10646-1"); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5208 DEFSYM (Qunicode_bmp, "unicode-bmp"); |
90622
bb9362e3a03b
(Qunicode_sip): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90590
diff
changeset
|
5209 DEFSYM (Qunicode_sip, "unicode-sip"); |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5210 |
97822 | 5211 DEFSYM (QCf, "Cf"); |
5212 | |
90400 | 5213 DEFSYM (QCotf, ":otf"); |
94926 | 5214 DEFSYM (QClang, ":lang"); |
90400 | 5215 DEFSYM (QCscript, ":script"); |
91125
6c9a19ff6c55
(Qfontp): Remove unused symbol.
Jason Rumney <jasonr@gnu.org>
parents:
91112
diff
changeset
|
5216 DEFSYM (QCantialias, ":antialias"); |
90400 | 5217 |
5218 DEFSYM (QCfoundry, ":foundry"); | |
5219 DEFSYM (QCadstyle, ":adstyle"); | |
5220 DEFSYM (QCregistry, ":registry"); | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
5221 DEFSYM (QCspacing, ":spacing"); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
5222 DEFSYM (QCdpi, ":dpi"); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5223 DEFSYM (QCscalable, ":scalable"); |
94926 | 5224 DEFSYM (QCavgwidth, ":avgwidth"); |
5225 DEFSYM (QCfont_entity, ":font-entity"); | |
5226 DEFSYM (QCfc_unknown_spec, ":fc-unknown-spec"); | |
90400 | 5227 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5228 DEFSYM (Qc, "c"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5229 DEFSYM (Qm, "m"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5230 DEFSYM (Qp, "p"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5231 DEFSYM (Qd, "d"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5232 |
103011
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5233 DEFSYM (Qja, "ja"); |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5234 DEFSYM (Qko, "ko"); |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5235 |
90400 | 5236 staticpro (&null_vector); |
5237 null_vector = Fmake_vector (make_number (0), Qnil); | |
5238 | |
5239 staticpro (&scratch_font_spec); | |
5240 scratch_font_spec = Ffont_spec (0, NULL); | |
5241 staticpro (&scratch_font_prefer); | |
5242 scratch_font_prefer = Ffont_spec (0, NULL); | |
5243 | |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5244 staticpro (&Vfont_log_deferred); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5245 Vfont_log_deferred = Fmake_vector (make_number (3), Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5246 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5247 #if 0 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5248 #ifdef HAVE_LIBOTF |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5249 staticpro (&otf_list); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5250 otf_list = Qnil; |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5251 #endif /* HAVE_LIBOTF */ |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5252 #endif /* 0 */ |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5253 |
90400 | 5254 defsubr (&Sfontp); |
5255 defsubr (&Sfont_spec); | |
5256 defsubr (&Sfont_get); | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
5257 #ifdef HAVE_WINDOW_SYSTEM |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
5258 defsubr (&Sfont_face_attributes); |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
5259 #endif |
90400 | 5260 defsubr (&Sfont_put); |
5261 defsubr (&Slist_fonts); | |
94926 | 5262 defsubr (&Sfont_family_list); |
90400 | 5263 defsubr (&Sfind_font); |
5264 defsubr (&Sfont_xlfd_name); | |
5265 defsubr (&Sclear_font_cache); | |
97822 | 5266 defsubr (&Sfont_shape_gstring); |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
5267 defsubr (&Sfont_variation_glyphs); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5268 #if 0 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5269 defsubr (&Sfont_drive_otf); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
5270 defsubr (&Sfont_otf_alternates); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5271 #endif /* 0 */ |
90400 | 5272 |
5273 #ifdef FONT_DEBUG | |
5274 defsubr (&Sopen_font); | |
5275 defsubr (&Sclose_font); | |
5276 defsubr (&Squery_font); | |
5277 defsubr (&Sget_font_glyphs); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5278 defsubr (&Sfont_match_p); |
90541 | 5279 defsubr (&Sfont_at); |
90400 | 5280 #if 0 |
5281 defsubr (&Sdraw_string); | |
5282 #endif | |
5283 #endif /* FONT_DEBUG */ | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5284 #ifdef HAVE_WINDOW_SYSTEM |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5285 defsubr (&Sfont_info); |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5286 #endif |
90400 | 5287 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5288 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist, |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5289 doc: /* |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5290 Alist of fontname patterns vs the corresponding encoding and repertory info. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5291 Each element looks like (REGEXP . (ENCODING . REPERTORY)), |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5292 where ENCODING is a charset or a char-table, |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5293 and REPERTORY is a charset, a char-table, or nil. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5294 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
5295 If ENCODING and REPERTORY are the same, the element can have the form |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5296 \(REGEXP . ENCODING). |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5297 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5298 ENCODING is for converting a character to a glyph code of the font. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5299 If ENCODING is a charset, encoding a character by the charset gives |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5300 the corresponding glyph code. If ENCODING is a char-table, looking up |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5301 the table by a character gives the corresponding glyph code. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5302 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5303 REPERTORY specifies a repertory of characters supported by the font. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5304 If REPERTORY is a charset, all characters beloging to the charset are |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5305 supported. If REPERTORY is a char-table, all characters who have a |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
5306 non-nil value in the table are supported. If REPERTORY is nil, Emacs |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5307 gets the repertory information by an opened font and ENCODING. */); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5308 Vfont_encoding_alist = Qnil; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5309 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5310 DEFVAR_LISP_NOPRO ("font-weight-table", &Vfont_weight_table, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5311 doc: /* Vector of valid font weight values. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5312 Each element has the form: |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5313 [NUMERIC-VALUE SYMBOLIC-NAME ALIAS-NAME ...] |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5314 NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. */); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5315 Vfont_weight_table = BUILD_STYLE_TABLE (weight_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5316 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5317 DEFVAR_LISP_NOPRO ("font-slant-table", &Vfont_slant_table, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5318 doc: /* Vector of font slant symbols vs the corresponding numeric values. |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5319 See `font-weight-table' for the format of the vector. */); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5320 Vfont_slant_table = BUILD_STYLE_TABLE (slant_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5321 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5322 DEFVAR_LISP_NOPRO ("font-width-table", &Vfont_width_table, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5323 doc: /* Alist of font width symbols vs the corresponding numeric values. |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5324 See `font-weight-table' for the format of the vector. */); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5325 Vfont_width_table = BUILD_STYLE_TABLE (width_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5326 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5327 staticpro (&font_style_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5328 font_style_table = Fmake_vector (make_number (3), Qnil); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5329 ASET (font_style_table, 0, Vfont_weight_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5330 ASET (font_style_table, 1, Vfont_slant_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5331 ASET (font_style_table, 2, Vfont_width_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5332 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5333 DEFVAR_LISP ("font-log", &Vfont_log, doc: /* |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5334 *Logging list of font related actions and results. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5335 The value t means to suppress the logging. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5336 The initial value is set to nil if the environment variable |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5337 EMACS_FONT_LOG is set. Otherwise, it is set to t. */); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5338 Vfont_log = Qnil; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5339 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5340 #ifdef HAVE_WINDOW_SYSTEM |
90400 | 5341 #ifdef HAVE_FREETYPE |
94926 | 5342 syms_of_ftfont (); |
90400 | 5343 #ifdef HAVE_X_WINDOWS |
94926 | 5344 syms_of_xfont (); |
5345 syms_of_ftxfont (); | |
90400 | 5346 #ifdef HAVE_XFT |
94926 | 5347 syms_of_xftfont (); |
90400 | 5348 #endif /* HAVE_XFT */ |
5349 #endif /* HAVE_X_WINDOWS */ | |
5350 #else /* not HAVE_FREETYPE */ | |
5351 #ifdef HAVE_X_WINDOWS | |
94926 | 5352 syms_of_xfont (); |
90400 | 5353 #endif /* HAVE_X_WINDOWS */ |
5354 #endif /* not HAVE_FREETYPE */ | |
5355 #ifdef HAVE_BDFFONT | |
94926 | 5356 syms_of_bdffont (); |
90400 | 5357 #endif /* HAVE_BDFFONT */ |
5358 #ifdef WINDOWSNT | |
94926 | 5359 syms_of_w32font (); |
90400 | 5360 #endif /* WINDOWSNT */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5361 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5362 syms_of_nsfont (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5363 #endif /* HAVE_NS */ |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5364 #endif /* HAVE_WINDOW_SYSTEM */ |
90400 | 5365 } |
90427 | 5366 |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5367 void |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5368 init_font () |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5369 { |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5370 Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt; |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5371 } |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5372 |
90427 | 5373 /* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846 |
5374 (do not change this comment) */ |