Mercurial > emacs
annotate src/font.c @ 111145:127f4f5efa50
Merge read-color and facemenu-read-color (Bug#7242).
* lisp/facemenu.el (facemenu-read-color): Alias for read-color.
(facemenu-set-foreground, facemenu-set-background): Use
read-color.
* lisp/faces.el (read-color): Use the completion code from
facemenu-read-color. Require match in completion. Doc fix.
* lisp/frame.el (set-background-color, set-foreground-color)
(set-cursor-color, set-mouse-color, set-border-color): Use
read-color.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 24 Oct 2010 14:43:31 -0400 |
parents | b8fde5ef9e14 |
children | de02b794c330 |
rev | line source |
---|---|
90400 | 1 /* font.c -- "Font" primitives. |
106815 | 2 Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008, 2009, 2010 | |
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 <ctype.h> | |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105576
diff
changeset
|
25 #include <setjmp.h> |
90400 | 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 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
50 Lisp_Object Qopentype; |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
51 |
94926 | 52 /* Important character set strings. */ |
95699 | 53 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
|
54 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
55 #define DEFAULT_ENCODING Qiso8859_1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
56 |
97822 | 57 /* Unicode category `Cf'. */ |
58 static Lisp_Object QCf; | |
59 | |
90400 | 60 /* Special vector of zero length. This is repeatedly used by (struct |
61 font_driver *)->list when a specified font is not found. */ | |
94926 | 62 static Lisp_Object null_vector; |
63 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
64 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
|
65 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
66 /* Vector of Vfont_weight_table, Vfont_slant_table, and Vfont_width_table. */ |
90400 | 67 static Lisp_Object font_style_table; |
68 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
69 /* 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
|
70 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
|
71 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
72 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
|
73 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
74 int numeric; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
75 /* 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
|
76 The second one (if any) is a typical name in XLFD field. */ |
105872
89183b6f6e9d
* process.c (socket_options): Make it const.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
77 const char *names[5]; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
78 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
79 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
80 /* 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
|
81 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
|
82 |
105872
89183b6f6e9d
* process.c (socket_options): Make it const.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
83 static const struct table_entry weight_table[] = |
95176
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 { 0, { "thin" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
86 { 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
|
87 { 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
|
88 { 50, { "light" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
89 { 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
|
90 { 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
|
91 { 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
|
92 { 200, { "bold" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
93 { 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
|
94 { 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
|
95 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
96 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
97 /* 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
|
98 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
|
99 |
105872
89183b6f6e9d
* process.c (socket_options): Make it const.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
100 static const struct table_entry slant_table[] = |
95176
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 { 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
|
103 { 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
|
104 { 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
|
105 { 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
|
106 { 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
|
107 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
108 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
109 /* 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
|
110 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
|
111 |
105872
89183b6f6e9d
* process.c (socket_options): Make it const.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
112 static const struct table_entry width_table[] = |
95176
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 { 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
|
115 { 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
|
116 { 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
|
117 { 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
|
118 { 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
|
119 { 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
|
120 { 125, { "expanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
121 { 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
|
122 { 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
|
123 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
124 |
94926 | 125 Lisp_Object QCfoundry, QCadstyle, QCregistry; |
90400 | 126 /* Symbols representing keys of font extra info. */ |
94926 | 127 Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript, QCavgwidth; |
128 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
|
129 /* Symbols representing values of font spacing property. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
130 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
|
131 /* 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
|
132 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
|
133 Lisp_Object Qja, Qko; |
90400 | 134 |
106750
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
135 Lisp_Object QCuser_spec; |
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
136 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
137 Lisp_Object Vfont_encoding_alist; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
138 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
139 /* 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
|
140 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
|
141 Vfont_encoding_alist on demand. |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
142 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
143 Eash element has the form: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
144 (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
|
145 or |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
146 (REGISTRY . nil) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
147 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
148 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
|
149 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
|
150 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
|
151 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
|
152 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
153 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
|
154 retrieved. */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
155 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
|
156 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
157 /* 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
|
158 register_font_driver in syms_of_XXXfont to register its font-driver |
90400 | 159 here. */ |
160 static struct font_driver_list *font_driver_list; | |
161 | |
94926 | 162 |
163 | |
164 /* Creaters of font-related Lisp object. */ | |
165 | |
166 Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
167 font_make_spec (void) |
94926 | 168 { |
169 Lisp_Object font_spec; | |
170 struct font_spec *spec | |
171 = ((struct font_spec *) | |
172 allocate_pseudovector (VECSIZE (struct font_spec), | |
173 FONT_SPEC_MAX, PVEC_FONT)); | |
174 XSETFONT (font_spec, spec); | |
175 return font_spec; | |
176 } | |
177 | |
178 Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
179 font_make_entity (void) |
94926 | 180 { |
181 Lisp_Object font_entity; | |
182 struct font_entity *entity | |
183 = ((struct font_entity *) | |
184 allocate_pseudovector (VECSIZE (struct font_entity), | |
185 FONT_ENTITY_MAX, PVEC_FONT)); | |
186 XSETFONT (font_entity, entity); | |
187 return font_entity; | |
188 } | |
189 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
190 /* 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
|
191 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
|
192 PIXELSIZE is positive, set the `size' property to PIXELSIZE. */ |
94926 | 193 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
194 font_make_object (int size, Lisp_Object entity, int pixelsize) |
94926 | 195 { |
196 Lisp_Object font_object; | |
197 struct font *font | |
198 = (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
|
199 int i; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
200 |
94926 | 201 XSETFONT (font_object, font); |
202 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
203 if (! NILP (entity)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
204 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
205 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
|
206 font->props[i] = AREF (entity, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
207 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
|
208 font->props[FONT_EXTRA_INDEX] |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
209 = Fcopy_alist (AREF (entity, FONT_EXTRA_INDEX)); |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
210 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
211 if (size > 0) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
212 font->props[FONT_SIZE_INDEX] = make_number (pixelsize); |
94926 | 213 return font_object; |
214 } | |
215 | |
216 | |
217 | |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
218 static int font_pixel_size (FRAME_PTR f, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
219 static Lisp_Object font_open_entity (FRAME_PTR, Lisp_Object, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
220 static Lisp_Object font_matching_entity (FRAME_PTR, Lisp_Object *, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
221 Lisp_Object); |
90400 | 222 |
223 /* Number of registered font drivers. */ | |
224 static int num_font_drivers; | |
225 | |
94926 | 226 |
227 /* Return a Lispy value of a font property value at STR and LEN bytes. | |
228 If STR is "*", it returns nil. | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
229 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
|
230 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
|
231 STR. */ |
94926 | 232 |
233 Lisp_Object | |
109717
8949aad5e992
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109637
diff
changeset
|
234 font_intern_prop (const char *str, int len, int force_symbol) |
94926 | 235 { |
236 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
|
237 Lisp_Object tem; |
94926 | 238 Lisp_Object obarray; |
110503
fda36a325177
Fix some more uses of int instead of EMACS_INT.
Eli Zaretskii <eliz@gnu.org>
parents:
109748
diff
changeset
|
239 EMACS_INT nbytes, nchars; |
94926 | 240 |
241 if (len == 1 && *str == '*') | |
242 return Qnil; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
243 if (!force_symbol && len >=1 && isdigit (*str)) |
94926 | 244 { |
245 for (i = 1; i < len; i++) | |
246 if (! isdigit (str[i])) | |
247 break; | |
248 if (i == len) | |
249 return make_number (atoi (str)); | |
250 } | |
251 | |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
252 /* 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
|
253 lread.c), and modified to suite our purpose. */ |
94926 | 254 obarray = Vobarray; |
255 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) | |
256 obarray = check_obarray (obarray); | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
257 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
|
258 if (len == nchars || len != nbytes) |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
259 /* 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
|
260 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
|
261 tem = oblookup (obarray, str, len, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
262 else |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
263 tem = oblookup (obarray, str, nchars, len); |
94926 | 264 if (SYMBOLP (tem)) |
265 return tem; | |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
266 if (len == nchars || len != nbytes) |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
267 tem = make_unibyte_string (str, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
268 else |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
269 tem = make_multibyte_string (str, nchars, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
270 return Fintern (tem, obarray); |
94926 | 271 } |
272 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
273 /* 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
|
274 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
275 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
276 font_pixel_size (FRAME_PTR f, Lisp_Object spec) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
277 { |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
278 #ifdef HAVE_WINDOW_SYSTEM |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
279 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
|
280 double point_size; |
94926 | 281 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
|
282 Lisp_Object val; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
283 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
284 if (INTEGERP (size)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
285 return XINT (size); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
286 if (NILP (size)) |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
287 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
|
288 font_assert (FLOATP (size)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
289 point_size = XFLOAT_DATA (size); |
94926 | 290 val = AREF (spec, FONT_DPI_INDEX); |
291 if (INTEGERP (val)) | |
95483
d3cbd7d56845
(font_pixel_size): Don't take cdr of an integer.
Chong Yidong <cyd@stupidchicken.com>
parents:
95475
diff
changeset
|
292 dpi = XINT (val); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
293 else |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
294 dpi = f->resy; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
295 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
|
296 return pixel_size; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
297 #else |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
298 return 1; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
299 #endif |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
300 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
301 |
94926 | 302 |
303 /* Return a value of PROP's VAL (symbol or integer) to be stored in a | |
304 font vector. If VAL is not valid (i.e. not registered in | |
305 font_style_table), return -1 if NOERROR is zero, and return a | |
306 proper index if NOERROR is nonzero. In that case, register VAL in | |
307 font_style_table if VAL is a symbol, and return a closest index if | |
308 VAL is an integer. */ | |
309 | |
310 int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
311 font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror) |
90400 | 312 { |
94926 | 313 Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); |
314 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
|
315 int i, j; |
94926 | 316 |
317 if (SYMBOLP (val)) | |
90400 | 318 { |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
319 unsigned char *s; |
94926 | 320 Lisp_Object args[2], elt; |
321 | |
322 /* At first try exact match. */ | |
323 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
|
324 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
|
325 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
|
326 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
|
327 | (i << 4) | (j - 1)); |
94926 | 328 /* 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
|
329 s = SDATA (SYMBOL_NAME (val)); |
94926 | 330 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
|
331 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
|
332 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
333 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
|
334 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
|
335 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
|
336 | (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
|
337 } |
94926 | 338 if (! noerror) |
339 return -1; | |
340 if (len == 255) | |
341 abort (); | |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
342 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
|
343 ASET (elt, 1, val); |
94926 | 344 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
|
345 args[1] = Fmake_vector (make_number (1), elt); |
94926 | 346 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
|
347 return (100 << 8) | (i << 4); |
90400 | 348 } |
94926 | 349 else |
350 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
351 int i, last_n; |
94926 | 352 int numeric = XINT (val); |
353 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
354 for (i = 0, last_n = -1; i < len; i++) |
94926 | 355 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
356 int n = XINT (AREF (AREF (table, i), 0)); |
94926 | 357 |
358 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
|
359 return (n << 8) | (i << 4); |
94926 | 360 if (numeric < n) |
361 { | |
362 if (! noerror) | |
363 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
|
364 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
|
365 ? (n << 8) | (i << 4): (last_n << 8 | ((i - 1) << 4))); |
94926 | 366 } |
367 last_n = n; | |
368 } | |
369 if (! noerror) | |
370 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
|
371 return ((last_n << 8) | ((i - 1) << 4)); |
94926 | 372 } |
90400 | 373 } |
374 | |
375 Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
376 font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face) |
90400 | 377 { |
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
|
378 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
|
379 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
|
380 int i; |
94926 | 381 |
382 if (NILP (val)) | |
383 return Qnil; | |
384 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
|
385 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
|
386 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
|
387 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
|
388 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
|
389 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
|
390 } |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
391 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
392 /* 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
|
393 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
|
394 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
|
395 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
396 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
397 find_font_encoding (Lisp_Object fontname) |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
398 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
399 Lisp_Object tail, elt; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
400 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
401 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
|
402 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
403 elt = XCAR (tail); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
404 if (CONSP (elt) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
405 && STRINGP (XCAR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
406 && 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
|
407 && (SYMBOLP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
408 ? CHARSETP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
409 : 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
|
410 return (XCDR (elt)); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
411 } |
102708
c8014e79191f
(find_font_encoding): Return Qnil for unsupported encoding.
Kenichi Handa <handa@m17n.org>
parents:
102483
diff
changeset
|
412 return Qnil; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
413 } |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
414 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
415 /* 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
|
416 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
|
417 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
|
418 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
419 int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
420 font_registry_charsets (Lisp_Object registry, struct charset **encoding, struct charset **repertory) |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
421 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
422 Lisp_Object val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
423 int encoding_id, repertory_id; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
424 |
94926 | 425 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
|
426 if (! NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
427 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
428 val = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
429 if (NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
430 return -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
431 encoding_id = XINT (XCAR (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
432 repertory_id = XINT (XCDR (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
433 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
434 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
435 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
436 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
|
437 if (SYMBOLP (val) && CHARSETP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
438 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
439 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
|
440 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
441 else if (CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
442 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
443 if (! CHARSETP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
444 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
445 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
|
446 if (NILP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
447 repertory_id = -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
448 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
449 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
450 if (! CHARSETP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
451 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
452 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
|
453 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
454 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
455 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
456 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
457 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
|
458 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
459 = 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
|
460 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
461 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
462 if (encoding) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
463 *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
|
464 if (repertory) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
465 *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
|
466 return 0; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
467 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
468 invalid_entry: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
469 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
470 = 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
|
471 return -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
472 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
473 |
90400 | 474 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
475 /* 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
|
476 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
|
477 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
478 static Lisp_Object font_prop_validate (int, Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
479 static Lisp_Object font_prop_validate_symbol (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
480 static Lisp_Object font_prop_validate_style (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
481 static Lisp_Object font_prop_validate_non_neg (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
482 static Lisp_Object font_prop_validate_spacing (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
483 static int get_font_prop_index (Lisp_Object); |
90400 | 484 |
485 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
486 font_prop_validate_symbol (Lisp_Object prop, Lisp_Object val) |
90400 | 487 { |
488 if (STRINGP (val)) | |
94926 | 489 val = Fintern (val, Qnil); |
490 if (! SYMBOLP (val)) | |
491 val = Qerror; | |
492 else if (EQ (prop, QCregistry)) | |
493 val = Fintern (Fdowncase (SYMBOL_NAME (val)), Qnil); | |
494 return val; | |
495 } | |
496 | |
497 | |
498 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
499 font_prop_validate_style (Lisp_Object style, Lisp_Object val) |
94926 | 500 { |
501 enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX | |
502 : EQ (style, QCslant) ? FONT_SLANT_INDEX | |
503 : FONT_WIDTH_INDEX); | |
504 int n; | |
505 if (INTEGERP (val)) | |
506 { | |
507 n = XINT (val); | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
508 if (((n >> 4) & 0xF) |
94926 | 509 >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) |
510 val = Qerror; | |
511 else | |
512 { | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
513 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
|
514 |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
515 if ((n & 0xF) + 1 >= ASIZE (elt)) |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
516 val = Qerror; |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
517 else if (XINT (AREF (elt, 0)) != (n >> 8)) |
94926 | 518 val = Qerror; |
519 } | |
520 } | |
90400 | 521 else if (SYMBOLP (val)) |
522 { | |
94926 | 523 int n = font_style_to_value (prop, val, 0); |
524 | |
525 val = n >= 0 ? make_number (n) : Qerror; | |
90400 | 526 } |
527 else | |
528 val = Qerror; | |
529 return val; | |
530 } | |
531 | |
532 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
533 font_prop_validate_non_neg (Lisp_Object prop, Lisp_Object val) |
90400 | 534 { |
535 return (NATNUMP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0) | |
536 ? val : Qerror); | |
537 } | |
538 | |
539 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
540 font_prop_validate_spacing (Lisp_Object prop, Lisp_Object val) |
90400 | 541 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
542 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
|
543 return val; |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
544 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
|
545 { |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
546 char spacing = SDATA (SYMBOL_NAME (val))[0]; |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
547 |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
548 if (spacing == 'c' || spacing == 'C') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
549 return make_number (FONT_SPACING_CHARCELL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
550 if (spacing == 'm' || spacing == 'M') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
551 return make_number (FONT_SPACING_MONO); |
95523
3c4256715c94
(font_prop_validate_spacing): Fix last change.
Andreas Schwab <schwab@suse.de>
parents:
95516
diff
changeset
|
552 if (spacing == 'p' || spacing == 'P') |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
553 return make_number (FONT_SPACING_PROPORTIONAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
554 if (spacing == 'd' || spacing == 'D') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
555 return make_number (FONT_SPACING_DUAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
556 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
557 return Qerror; |
90400 | 558 } |
559 | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
560 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
561 font_prop_validate_otf (Lisp_Object prop, Lisp_Object val) |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
562 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
563 Lisp_Object tail, tmp; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
564 int i; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
565 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
566 /* 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
|
567 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
|
568 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
|
569 if (! CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
570 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
571 if (! SYMBOLP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
572 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
573 tail = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
574 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
575 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
576 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
|
577 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
578 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
|
579 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
580 tail = XCDR (tail); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
581 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
582 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
583 if (! CONSP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
584 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
585 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
|
586 if (! SYMBOLP (XCAR (tmp))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
587 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
588 if (! NILP (tmp)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
589 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
590 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
591 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
592 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
593 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
594 /* 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
|
595 values. */ |
109637
c4c8e4a16194
Remove extern declarations in .c files, .h files have them.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109555
diff
changeset
|
596 static const struct |
90400 | 597 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
598 /* Pointer to the key symbol. */ |
90400 | 599 Lisp_Object *key; |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
600 /* 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
|
601 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
|
602 and Qerror if not. */ |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
603 Lisp_Object (*validater) (Lisp_Object prop, Lisp_Object val); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
604 } font_property_table[] = |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
605 { { &QCtype, font_prop_validate_symbol }, |
90400 | 606 { &QCfoundry, font_prop_validate_symbol }, |
607 { &QCfamily, font_prop_validate_symbol }, | |
608 { &QCadstyle, font_prop_validate_symbol }, | |
609 { &QCregistry, font_prop_validate_symbol }, | |
610 { &QCweight, font_prop_validate_style }, | |
611 { &QCslant, font_prop_validate_style }, | |
612 { &QCwidth, font_prop_validate_style }, | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
613 { &QCsize, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
614 { &QCdpi, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
615 { &QCspacing, font_prop_validate_spacing }, |
94926 | 616 { &QCavgwidth, font_prop_validate_non_neg }, |
617 /* The order of the above entries must match with enum | |
618 font_property_index. */ | |
619 { &QClang, font_prop_validate_symbol }, | |
620 { &QCscript, font_prop_validate_symbol }, | |
621 { &QCotf, font_prop_validate_otf } | |
90400 | 622 }; |
623 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
624 /* 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
|
625 #define FONT_PROPERTY_TABLE_SIZE \ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
626 ((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
|
627 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
628 /* Return an index number of font property KEY or -1 if KEY is not an |
94926 | 629 already known property. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
630 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
631 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
632 get_font_prop_index (Lisp_Object key) |
90400 | 633 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
634 int i; |
94926 | 635 |
636 for (i = 0; i < FONT_PROPERTY_TABLE_SIZE; i++) | |
637 if (EQ (key, *font_property_table[i].key)) | |
638 return i; | |
639 return -1; | |
640 } | |
641 | |
642 /* Validate the font property. The property key is specified by the | |
643 symbol PROP, or the index IDX (if PROP is nil). If VAL is invalid, | |
644 signal an error. The value is VAL or the regularized one. */ | |
645 | |
646 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
647 font_prop_validate (int idx, Lisp_Object prop, Lisp_Object val) |
94926 | 648 { |
649 Lisp_Object validated; | |
650 | |
94964
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
651 if (NILP (val)) |
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
652 return val; |
94926 | 653 if (NILP (prop)) |
654 prop = *font_property_table[idx].key; | |
655 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
656 { |
94926 | 657 idx = get_font_prop_index (prop); |
658 if (idx < 0) | |
659 return val; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
660 } |
94926 | 661 validated = (font_property_table[idx].validater) (prop, val); |
662 if (EQ (validated, Qerror)) | |
663 signal_error ("invalid font property", Fcons (prop, val)); | |
664 return validated; | |
90400 | 665 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
666 |
94926 | 667 |
668 /* Store VAL as a value of extra font property PROP in FONT while | |
669 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
|
670 |
90888
5f03b3602143
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90883
diff
changeset
|
671 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
672 font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
673 { |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
674 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
|
675 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
|
676 |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
677 if (NILP (slot)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
678 { |
94926 | 679 Lisp_Object prev = Qnil; |
680 | |
681 while (CONSP (extra) | |
682 && NILP (Fstring_lessp (prop, XCAR (XCAR (extra))))) | |
683 prev = extra, extra = XCDR (extra); | |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
684 |
106433
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
685 if (NILP (prev)) |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
686 ASET (font, FONT_EXTRA_INDEX, Fcons (Fcons (prop, val), extra)); |
106433
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
687 else |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
688 XSETCDR (prev, Fcons (Fcons (prop, val), extra)); |
106433
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
689 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
690 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
691 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
692 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
|
693 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
|
694 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
|
695 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
696 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
697 |
90400 | 698 |
699 /* Font name parser and unparser */ | |
700 | |
109726
64732fa6188a
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109717
diff
changeset
|
701 static int parse_matrix (const char *); |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
702 static int font_expand_wildcards (Lisp_Object *, int); |
109735
0fe981e141e3
Remove incorrect const use.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109726
diff
changeset
|
703 static int font_parse_name (char *, Lisp_Object); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
704 |
90400 | 705 /* An enumerator for each field of an XLFD font name. */ |
706 enum xlfd_field_index | |
707 { | |
708 XLFD_FOUNDRY_INDEX, | |
709 XLFD_FAMILY_INDEX, | |
710 XLFD_WEIGHT_INDEX, | |
711 XLFD_SLANT_INDEX, | |
712 XLFD_SWIDTH_INDEX, | |
713 XLFD_ADSTYLE_INDEX, | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
714 XLFD_PIXEL_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
715 XLFD_POINT_INDEX, |
90400 | 716 XLFD_RESX_INDEX, |
717 XLFD_RESY_INDEX, | |
718 XLFD_SPACING_INDEX, | |
719 XLFD_AVGWIDTH_INDEX, | |
720 XLFD_REGISTRY_INDEX, | |
721 XLFD_ENCODING_INDEX, | |
722 XLFD_LAST_INDEX | |
723 }; | |
724 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
725 /* 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
|
726 enum xlfd_field_mask |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
727 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
728 XLFD_FOUNDRY_MASK = 0x0001, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
729 XLFD_FAMILY_MASK = 0x0002, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
730 XLFD_WEIGHT_MASK = 0x0004, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
731 XLFD_SLANT_MASK = 0x0008, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
732 XLFD_SWIDTH_MASK = 0x0010, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
733 XLFD_ADSTYLE_MASK = 0x0020, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
734 XLFD_PIXEL_MASK = 0x0040, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
735 XLFD_POINT_MASK = 0x0080, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
736 XLFD_RESX_MASK = 0x0100, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
737 XLFD_RESY_MASK = 0x0200, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
738 XLFD_SPACING_MASK = 0x0400, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
739 XLFD_AVGWIDTH_MASK = 0x0800, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
740 XLFD_REGISTRY_MASK = 0x1000, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
741 XLFD_ENCODING_MASK = 0x2000 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
742 }; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
743 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
744 |
90400 | 745 /* Parse P pointing the pixel/point size field of the form |
746 `[A B C D]' which specifies a transformation matrix: | |
747 | |
748 A B 0 | |
749 C D 0 | |
750 0 0 1 | |
751 | |
752 by which all glyphs of the font are transformed. The spec says | |
753 that scalar value N for the pixel/point size is equivalent to: | |
754 A = N * resx/resy, B = C = 0, D = N. | |
755 | |
756 Return the scalar value N if the form is valid. Otherwise return | |
757 -1. */ | |
758 | |
759 static int | |
109726
64732fa6188a
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109717
diff
changeset
|
760 parse_matrix (const char *p) |
90400 | 761 { |
762 double matrix[4]; | |
763 char *end; | |
764 int i; | |
765 | |
766 for (i = 0, p++; i < 4 && *p && *p != ']'; i++) | |
767 { | |
768 if (*p == '~') | |
769 matrix[i] = - strtod (p + 1, &end); | |
770 else | |
771 matrix[i] = strtod (p, &end); | |
772 p = end; | |
773 } | |
774 return (i == 4 ? (int) matrix[3] : -1); | |
775 } | |
776 | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
777 /* 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
|
778 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
|
779 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
|
780 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
781 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
782 font_expand_wildcards (Lisp_Object *field, int n) |
90451
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 /* Copy of FIELD. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
785 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
|
786 /* 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
|
787 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
|
788 struct { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
789 /* Minimum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
790 int from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
791 /* Maxinum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
792 int to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
793 /* 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
|
794 int mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
795 } range[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
796 int i, j; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
797 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
|
798 unsigned range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
799 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
800 #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
|
801 | 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
|
802 #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
|
803 #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
|
804 | XLFD_AVGWIDTH_MASK) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
805 #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
|
806 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
807 /* 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
|
808 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
|
809 following loop. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
810 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
|
811 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
|
812 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
813 /* 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
|
814 position-based retriction for FIELD[I]. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
815 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
|
816 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
|
817 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
818 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
|
819 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
820 tmp[i] = val; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
821 if (NILP (val)) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
822 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
823 /* Wildcard. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
824 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
|
825 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
|
826 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
|
827 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
828 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
829 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
830 /* 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
|
831 retriction for FIELD[I]. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
832 int from, to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
833 unsigned mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
834 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
835 if (INTEGERP (val)) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
836 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
837 int numeric = XINT (val); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
838 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
839 if (i + 1 == n) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
840 from = to = XLFD_ENCODING_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
841 mask = XLFD_ENCODING_MASK; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
842 else if (numeric == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
843 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
|
844 mask = XLFD_PIXEL_MASK | XLFD_LARGENUM_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
845 else if (numeric <= 48) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
846 from = to = XLFD_PIXEL_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
847 mask = XLFD_PIXEL_MASK; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
848 else |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
849 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
|
850 mask = XLFD_LARGENUM_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
851 } |
94926 | 852 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
|
853 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
|
854 mask = XLFD_NULL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
855 else if (i == 0) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
856 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
|
857 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
|
858 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
859 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
|
860 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
861 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
|
862 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
|
863 mask = XLFD_REGENC_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
864 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
865 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
|
866 mask = XLFD_ENCODING_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
867 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
868 else if (range_from <= XLFD_WEIGHT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
869 && range_to >= XLFD_WEIGHT_INDEX |
94926 | 870 && 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
|
871 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
|
872 else if (range_from <= XLFD_SLANT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
873 && range_to >= XLFD_SLANT_INDEX |
94926 | 874 && 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
|
875 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
|
876 else if (range_from <= XLFD_SWIDTH_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
877 && range_to >= XLFD_SWIDTH_INDEX |
94926 | 878 && 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
|
879 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
|
880 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
881 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
882 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
|
883 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
|
884 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
885 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
|
886 mask = XLFD_SYMBOL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
887 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
888 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
889 /* 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
|
890 mask &= range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
891 while (from < range_from) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
892 mask &= ~(1 << from++); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
893 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
|
894 from++; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
895 while (to > range_to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
896 mask &= ~(1 << to--); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
897 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
|
898 to--; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
899 if (from > to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
900 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
901 range[i].from = from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
902 range[i].to = to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
903 range[i].mask = mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
904 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
905 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
|
906 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
907 /* 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
|
908 Reflect it to the other fields. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
909 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
910 /* Following fields should be after FROM. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
911 range_from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
912 /* Preceding fields should be before TO. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
913 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
|
914 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
915 /* Check FROM for non-wildcard field. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
916 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
|
917 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
918 while (range[j].from < from) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
919 range[j].mask &= ~(1 << range[j].from++); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
920 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
|
921 from++; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
922 range[j].from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
923 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
924 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
925 from = range[j].from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
926 if (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
927 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
928 while (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
929 range[j].mask &= ~(1 << range[j].to--); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
930 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
|
931 to--; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
932 range[j].to = to; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
933 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
934 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
935 to = range[j].to; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
936 if (from > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
937 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
938 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
939 } |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
940 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
941 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
942 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
943 /* 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
|
944 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
|
945 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
946 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
|
947 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
948 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
|
949 /* 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
|
950 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
951 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
|
952 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
953 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
954 field[j++] = tmp[i]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
955 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
956 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
|
957 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
958 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
|
959 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
960 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
|
961 field[XLFD_ENCODING_INDEX] |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
962 = 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
|
963 return 0; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
964 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
965 |
92113
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
966 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
967 /* 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
|
968 (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
|
969 follows: |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
970 specified XLFD fields FONT property |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
971 --------------------- ------------- |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
972 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
|
973 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
|
974 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
|
975 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
976 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
|
977 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
978 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
|
979 X font backend driver, it is a font-entity. In that case, NAME is |
94926 | 980 a fully specified XLFD. */ |
90400 | 981 |
982 int | |
109735
0fe981e141e3
Remove incorrect const use.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109726
diff
changeset
|
983 font_parse_xlfd (char *name, Lisp_Object font) |
90400 | 984 { |
985 int len = strlen (name); | |
94926 | 986 int i, j, n; |
90695
a1cd7344d6a2
(font_parse_xlfd): Fix the array size of `f'.
Kenichi Handa <handa@m17n.org>
parents:
90677
diff
changeset
|
987 char *f[XLFD_LAST_INDEX + 1]; |
90400 | 988 Lisp_Object val; |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
989 char *p; |
90400 | 990 |
101422
9e1fcd81389c
(font_parse_xlfd): Handle patterns of length < 2.
Chong Yidong <cyd@stupidchicken.com>
parents:
101293
diff
changeset
|
991 if (len > 255 || !len) |
90400 | 992 /* Maximum XLFD name length is 255. */ |
993 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
994 /* 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
|
995 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
|
996 i = 1, f[XLFD_FOUNDRY_INDEX] = name; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
997 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
998 i = 0; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
999 for (p = name + i; *p; p++) |
94926 | 1000 if (*p == '-') |
1001 { | |
1002 f[i++] = p + 1; | |
1003 if (i == XLFD_LAST_INDEX) | |
1004 break; | |
1005 } | |
1006 f[i] = name + len; | |
1007 | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1008 #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
|
1009 #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
|
1010 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1011 if (i == XLFD_LAST_INDEX) |
90400 | 1012 { |
94926 | 1013 /* Fully specified XLFD. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1014 int pixel_size; |
94926 | 1015 |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1016 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
|
1017 ASET (font, FONT_FAMILY_INDEX, INTERN_FIELD_SYM (XLFD_FAMILY_INDEX)); |
94926 | 1018 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; |
1019 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90400 | 1020 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1021 val = INTERN_FIELD_SYM (i); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1022 if (! NILP (val)) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1023 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1024 if ((n = font_style_to_value (j, INTERN_FIELD_SYM (i), 0)) < 0) |
94926 | 1025 return -1; |
1026 ASET (font, j, make_number (n)); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1027 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1028 } |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1029 ASET (font, FONT_ADSTYLE_INDEX, INTERN_FIELD_SYM (XLFD_ADSTYLE_INDEX)); |
94926 | 1030 if (strcmp (f[XLFD_REGISTRY_INDEX], "*-*") == 0) |
1031 ASET (font, FONT_REGISTRY_INDEX, Qnil); | |
1032 else | |
1033 ASET (font, FONT_REGISTRY_INDEX, | |
1034 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
|
1035 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
|
1036 1)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1037 p = f[XLFD_PIXEL_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1038 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
|
1039 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
|
1040 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1041 { |
94926 | 1042 val = INTERN_FIELD (XLFD_PIXEL_INDEX); |
1043 if (INTEGERP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1044 ASET (font, FONT_SIZE_INDEX, val); |
107061
fa65fbe23fdb
font.c (font_parse_xlfd): If FONT is a font-entity and pixel size in NAME is invalid, return -1.
Kenichi Handa <handa@m17n.org>
parents:
106815
diff
changeset
|
1045 else if (FONT_ENTITY_P (font)) |
fa65fbe23fdb
font.c (font_parse_xlfd): If FONT is a font-entity and pixel size in NAME is invalid, return -1.
Kenichi Handa <handa@m17n.org>
parents:
106815
diff
changeset
|
1046 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1047 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1048 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1049 double point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1050 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1051 font_assert (FONT_SPEC_P (font)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1052 p = f[XLFD_POINT_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1053 if (*p == '[') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1054 point_size = parse_matrix (p); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1055 else if (isdigit (*p)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1056 point_size = atoi (p), point_size /= 10; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1057 if (point_size >= 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1058 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
|
1059 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1060 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1061 |
104091
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1062 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
|
1063 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
|
1064 return -1; |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1065 ASET (font, FONT_DPI_INDEX, val); |
94926 | 1066 val = INTERN_FIELD (XLFD_SPACING_INDEX); |
1067 if (! NILP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1068 { |
94926 | 1069 val = font_prop_validate_spacing (QCspacing, val); |
1070 if (! INTEGERP (val)) | |
1071 return -1; | |
1072 ASET (font, FONT_SPACING_INDEX, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1073 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1074 p = f[XLFD_AVGWIDTH_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1075 if (*p == '~') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1076 p++; |
104091
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1077 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
|
1078 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
|
1079 return -1; |
5ad8c9beecab
(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
103889
diff
changeset
|
1080 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
|
1081 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1082 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1083 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1084 int wild_card_found = 0; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1085 Lisp_Object prop[XLFD_LAST_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1086 |
94926 | 1087 if (FONT_ENTITY_P (font)) |
1088 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1089 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
|
1090 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1091 if (*f[j] == '*') |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1092 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1093 if (f[j][1] && f[j][1] != '-') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1094 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1095 prop[j] = Qnil; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1096 wild_card_found = 1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1097 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1098 else if (j + 1 < i) |
94926 | 1099 prop[j] = INTERN_FIELD (j); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1100 else |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1101 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
|
1102 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1103 if (! wild_card_found) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1104 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1105 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
|
1106 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1107 |
94926 | 1108 ASET (font, FONT_FOUNDRY_INDEX, prop[XLFD_FOUNDRY_INDEX]); |
1109 ASET (font, FONT_FAMILY_INDEX, prop[XLFD_FAMILY_INDEX]); | |
1110 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; | |
1111 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1112 if (! NILP (prop[i])) |
94926 | 1113 { |
1114 if ((n = font_style_to_value (j, prop[i], 1)) < 0) | |
1115 return -1; | |
1116 ASET (font, j, make_number (n)); | |
1117 } | |
1118 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
|
1119 val = prop[XLFD_REGISTRY_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1120 if (NILP (val)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1121 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1122 val = prop[XLFD_ENCODING_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1123 if (! NILP (val)) |
94926 | 1124 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
|
1125 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1126 else if (NILP (prop[XLFD_ENCODING_INDEX])) |
94926 | 1127 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
|
1128 else |
94926 | 1129 val = concat3 (SYMBOL_NAME (val), build_string ("-"), |
1130 SYMBOL_NAME (prop[XLFD_ENCODING_INDEX])); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1131 if (! NILP (val)) |
94926 | 1132 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
|
1133 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1134 if (INTEGERP (prop[XLFD_PIXEL_INDEX])) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1135 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
|
1136 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
|
1137 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1138 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
|
1139 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1140 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
|
1141 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1142 |
94926 | 1143 if (INTEGERP (prop[XLFD_RESX_INDEX])) |
1144 ASET (font, FONT_DPI_INDEX, prop[XLFD_RESY_INDEX]); | |
1145 if (! NILP (prop[XLFD_SPACING_INDEX])) | |
1146 { | |
1147 val = font_prop_validate_spacing (QCspacing, | |
1148 prop[XLFD_SPACING_INDEX]); | |
1149 if (! INTEGERP (val)) | |
1150 return -1; | |
1151 ASET (font, FONT_SPACING_INDEX, val); | |
1152 } | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1153 if (INTEGERP (prop[XLFD_AVGWIDTH_INDEX])) |
94926 | 1154 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
|
1155 } |
90400 | 1156 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1157 return 0; |
90400 | 1158 } |
1159 | |
1160 /* Store XLFD name of FONT (font-spec or font-entity) in NAME (NBYTES | |
1161 length), and return the name length. If FONT_SIZE_INDEX of FONT is | |
1162 0, use PIXEL_SIZE instead. */ | |
1163 | |
1164 int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1165 font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) |
90400 | 1166 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1167 char *f[XLFD_REGISTRY_INDEX + 1]; |
90400 | 1168 Lisp_Object val; |
1169 int i, j, len = 0; | |
1170 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1171 font_assert (FONTP (font)); |
90400 | 1172 |
1173 for (i = FONT_FOUNDRY_INDEX, j = XLFD_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; | |
1174 i++, j++) | |
1175 { | |
1176 if (i == FONT_ADSTYLE_INDEX) | |
1177 j = XLFD_ADSTYLE_INDEX; | |
1178 else if (i == FONT_REGISTRY_INDEX) | |
1179 j = XLFD_REGISTRY_INDEX; | |
1180 val = AREF (font, i); | |
1181 if (NILP (val)) | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1182 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1183 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
|
1184 f[j] = "*-*", len += 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1185 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1186 f[j] = "*", len += 2; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1187 } |
90400 | 1188 else |
1189 { | |
1190 if (SYMBOLP (val)) | |
1191 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
|
1192 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
|
1193 && ! strchr ((char *) SDATA (val), '-')) |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1194 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1195 /* 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
|
1196 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
|
1197 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1198 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
|
1199 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
|
1200 len += SBYTES (val) + 3; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1201 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1202 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1203 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1204 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
|
1205 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
|
1206 len += SBYTES (val) + 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1207 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1208 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1209 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1210 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
90400 | 1211 } |
1212 } | |
1213 | |
1214 for (i = FONT_WEIGHT_INDEX, j = XLFD_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; | |
1215 i++, j++) | |
1216 { | |
94926 | 1217 val = font_style_symbolic (font, i, 0); |
90400 | 1218 if (NILP (val)) |
1219 f[j] = "*", len += 2; | |
1220 else | |
1221 { | |
94926 | 1222 val = SYMBOL_NAME (val); |
90400 | 1223 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
1224 } | |
1225 } | |
1226 | |
1227 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
|
1228 font_assert (NUMBERP (val) || NILP (val)); |
90400 | 1229 if (INTEGERP (val)) |
1230 { | |
94926 | 1231 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
|
1232 if (i <= 0) |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1233 i = pixel_size; |
90400 | 1234 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
|
1235 { |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1236 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
|
1237 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
|
1238 } |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1239 else |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1240 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
90400 | 1241 } |
1242 else if (FLOATP (val)) | |
1243 { | |
94926 | 1244 i = XFLOAT_DATA (val) * 10; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1245 f[XLFD_PIXEL_INDEX] = alloca (12); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1246 len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1; |
90400 | 1247 } |
1248 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1249 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1250 |
94926 | 1251 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) |
90400 | 1252 { |
94926 | 1253 i = XINT (AREF (font, FONT_DPI_INDEX)); |
1254 f[XLFD_RESX_INDEX] = alloca (22); | |
1255 len += sprintf (f[XLFD_RESX_INDEX], | |
1256 "%d-%d", i, i) + 1; | |
90400 | 1257 } |
1258 else | |
94926 | 1259 f[XLFD_RESX_INDEX] = "*-*", len += 4; |
1260 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
|
1261 { |
94926 | 1262 int spacing = XINT (AREF (font, FONT_SPACING_INDEX)); |
1263 | |
1264 f[XLFD_SPACING_INDEX] = (spacing <= FONT_SPACING_PROPORTIONAL ? "p" | |
1265 : spacing <= FONT_SPACING_DUAL ? "d" | |
1266 : spacing <= FONT_SPACING_MONO ? "m" | |
1267 : "c"); | |
1268 len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1269 } |
94926 | 1270 else |
1271 f[XLFD_SPACING_INDEX] = "*", len += 2; | |
1272 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1273 { | |
1274 f[XLFD_AVGWIDTH_INDEX] = alloca (11); | |
105576
9e1a1361da63
(font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105155
diff
changeset
|
1275 len += sprintf (f[XLFD_AVGWIDTH_INDEX], "%ld", |
9e1a1361da63
(font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105155
diff
changeset
|
1276 (long) XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; |
94926 | 1277 } |
1278 else | |
1279 f[XLFD_AVGWIDTH_INDEX] = "*", len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1280 len++; /* for terminating '\0'. */ |
90400 | 1281 if (len >= nbytes) |
1282 return -1; | |
94926 | 1283 return sprintf (name, "-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s", |
90400 | 1284 f[XLFD_FOUNDRY_INDEX], f[XLFD_FAMILY_INDEX], |
1285 f[XLFD_WEIGHT_INDEX], f[XLFD_SLANT_INDEX], | |
94926 | 1286 f[XLFD_SWIDTH_INDEX], f[XLFD_ADSTYLE_INDEX], |
1287 f[XLFD_PIXEL_INDEX], f[XLFD_RESX_INDEX], | |
1288 f[XLFD_SPACING_INDEX], f[XLFD_AVGWIDTH_INDEX], | |
1289 f[XLFD_REGISTRY_INDEX]); | |
90400 | 1290 } |
1291 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1292 /* 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
|
1293 (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
|
1294 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
|
1295 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
|
1296 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1297 The fontconfig format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1298 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1299 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
|
1300 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1301 The GTK format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1302 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1303 FAMILY [PROPS...] [SIZE] |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1304 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1305 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
|
1306 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1307 int |
109735
0fe981e141e3
Remove incorrect const use.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109726
diff
changeset
|
1308 font_parse_fcname (char *name, Lisp_Object font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1309 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1310 char *p, *q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1311 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
|
1312 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
|
1313 int len = strlen (name); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1314 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1315 if (len == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1316 return -1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1317 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1318 for (p = name; *p; p++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1319 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1320 if (*p == '\\' && p[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1321 p++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1322 else if (*p == ':') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1323 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1324 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
|
1325 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1326 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1327 else if (*p == '-') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1328 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1329 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
|
1330 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
|
1331 if (! isdigit(*q)) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1332 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1333 if (*q != '.' || decimal) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1334 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1335 size_found = 0; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1336 break; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1337 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1338 decimal = 1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1339 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1340 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1341 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1342 family_end = p; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1343 size_beg = p + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1344 size_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1345 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1346 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1347 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1348 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1349 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1350 if (family_end) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1351 { |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1352 Lisp_Object extra_props = Qnil; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1353 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1354 /* 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
|
1355 if (family_end > name) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1356 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1357 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1358 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
|
1359 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
|
1360 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1361 if (size_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1362 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1363 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
|
1364 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
|
1365 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
|
1366 props_beg = size_end; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1367 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1368 if (props_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1369 { |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1370 /* 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
|
1371 Lisp_Object val; |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1372 |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1373 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
|
1374 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1375 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
|
1376 if (*q != '=') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1377 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1378 /* 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
|
1379 int word_len; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1380 p = p + 1; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1381 word_len = q - p; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1382 val = font_intern_prop (p, q - p, 1); |
95984 | 1383 |
1384 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) | |
1385 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1386 if (PROP_MATCH ("light", 5) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1387 || PROP_MATCH ("medium", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1388 || PROP_MATCH ("demibold", 8) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1389 || PROP_MATCH ("bold", 4) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1390 || PROP_MATCH ("black", 5)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1391 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
|
1392 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
|
1393 || PROP_MATCH ("italic", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1394 || PROP_MATCH ("oblique", 7)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1395 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
|
1396 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
|
1397 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1398 make_number (FONT_SPACING_CHARCELL)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1399 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
|
1400 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1401 make_number (FONT_SPACING_MONO)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1402 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
|
1403 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1404 make_number (FONT_SPACING_PROPORTIONAL)); |
95984 | 1405 #undef PROP_MATCH |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1406 } |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1407 else |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1408 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1409 /* KEY=VAL pairs */ |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1410 Lisp_Object key; |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1411 int prop; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1412 |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1413 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
|
1414 prop = FONT_SIZE_INDEX; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1415 else |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1416 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1417 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
|
1418 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
|
1419 } |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1420 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1421 p = q + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1422 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
|
1423 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
|
1424 |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1425 if (prop >= FONT_FOUNDRY_INDEX |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1426 && prop < FONT_EXTRA_INDEX) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1427 ASET (font, prop, font_prop_validate (prop, Qnil, val)); |
106433
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
1428 else |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1429 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1430 extra_props = nconc2 (extra_props, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1431 Fcons (Fcons (key, val), Qnil)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1432 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1433 } |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1434 p = q; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1435 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1436 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1437 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1438 if (! NILP (extra_props)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1439 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1440 struct font_driver_list *driver_list = font_driver_list; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1441 for ( ; driver_list; driver_list = driver_list->next) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1442 if (driver_list->driver->filter_properties) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1443 (*driver_list->driver->filter_properties) (font, extra_props); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
1444 } |
106433
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
1445 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1446 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1447 else |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1448 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1449 /* 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
|
1450 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
|
1451 Lisp_Object prop; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1452 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
|
1453 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1454 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
|
1455 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1456 if (isdigit (*p)) |
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 int size_found = 1; |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
1459 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1460 for (q = p + 1; *q && *q != ' '; q++) |
109032
d8720405694a
* font.c (font_parse_fcname): Allow . for sizes like 7.5 (bug#6437).
Jan D. <jan.h.d@swipnet.se>
parents:
108813
diff
changeset
|
1461 if (! isdigit (*q) && *q != '.') |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1462 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1463 size_found = 0; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1464 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1465 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1466 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1467 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1468 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
|
1469 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
|
1470 continue; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1471 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1472 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1473 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1474 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
|
1475 if (*q == '\\' && q[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1476 q++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1477 word_len = q - p; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1478 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1479 #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
|
1480 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1481 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
|
1482 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1483 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1484 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
|
1485 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
|
1486 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1487 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
|
1488 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1489 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1490 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
|
1491 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
|
1492 } |
107241
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1493 else if (PROP_MATCH ("Book", 4)) |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1494 { |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1495 prop_found = 1; |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1496 prop = font_intern_prop ("book", 4, 1); |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1497 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1498 } |
107242
26b234a2e901
Addendum to last patch: add "Medium" GTK font name keyword.
Chong Yidong <cyd@stupidchicken.com>
parents:
107241
diff
changeset
|
1499 else if (PROP_MATCH ("Medium", 6)) |
26b234a2e901
Addendum to last patch: add "Medium" GTK font name keyword.
Chong Yidong <cyd@stupidchicken.com>
parents:
107241
diff
changeset
|
1500 { |
26b234a2e901
Addendum to last patch: add "Medium" GTK font name keyword.
Chong Yidong <cyd@stupidchicken.com>
parents:
107241
diff
changeset
|
1501 prop_found = 1; |
26b234a2e901
Addendum to last patch: add "Medium" GTK font name keyword.
Chong Yidong <cyd@stupidchicken.com>
parents:
107241
diff
changeset
|
1502 prop = font_intern_prop ("medium", 6, 1); |
26b234a2e901
Addendum to last patch: add "Medium" GTK font name keyword.
Chong Yidong <cyd@stupidchicken.com>
parents:
107241
diff
changeset
|
1503 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
26b234a2e901
Addendum to last patch: add "Medium" GTK font name keyword.
Chong Yidong <cyd@stupidchicken.com>
parents:
107241
diff
changeset
|
1504 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1505 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
|
1506 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1507 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1508 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
|
1509 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
|
1510 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1511 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
|
1512 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1513 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1514 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
|
1515 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
|
1516 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1517 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
|
1518 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1519 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1520 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
|
1521 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
|
1522 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1523 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
|
1524 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1525 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1526 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
|
1527 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
|
1528 } |
107241
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1529 else if (PROP_MATCH ("Semi-Condensed", 14)) |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1530 { |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1531 prop_found = 1; |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1532 prop = font_intern_prop ("semi-condensed", 14, 1); |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1533 FONT_SET_STYLE (font, FONT_WIDTH_INDEX, prop); |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1534 } |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1535 else if (PROP_MATCH ("Condensed", 9)) |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1536 { |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1537 prop_found = 1; |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1538 prop = font_intern_prop ("condensed", 9, 1); |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1539 FONT_SET_STYLE (font, FONT_WIDTH_INDEX, prop); |
c7ed9615fb56
Recognize more keywords in GTK font names (Bug#5646).
Chong Yidong <cyd@stupidchicken.com>
parents:
107061
diff
changeset
|
1540 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1541 else { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1542 if (prop_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1543 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
|
1544 family_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1545 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1546 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1547 #undef PROP_MATCH |
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 (family_end) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1550 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1551 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1552 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
|
1553 ASET (font, FONT_FAMILY_INDEX, family); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1554 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1555 } |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
1556 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1557 return 0; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1558 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1559 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1560 /* 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
|
1561 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
|
1562 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
|
1563 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1564 int |
109735
0fe981e141e3
Remove incorrect const use.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109726
diff
changeset
|
1565 font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1566 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1567 Lisp_Object family, foundry; |
94926 | 1568 Lisp_Object tail, val; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1569 int point_size; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1570 int i, len = 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1571 char *p; |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1572 Lisp_Object styles[3]; |
109717
8949aad5e992
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109637
diff
changeset
|
1573 const char *style_names[3] = { "weight", "slant", "width" }; |
94926 | 1574 char work[256]; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1575 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1576 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1577 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1578 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1579 if (SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1580 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1581 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1582 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1583 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1584 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1585 family = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1586 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1587 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1588 val = AREF (font, FONT_SIZE_INDEX); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1589 if (INTEGERP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1590 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1591 if (XINT (val) != 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1592 pixel_size = XINT (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1593 point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1594 len += 21; /* for ":pixelsize=NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1595 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1596 else if (FLOATP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1597 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1598 pixel_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1599 point_size = (int) XFLOAT_DATA (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1600 len += 11; /* for "-NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1601 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1602 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1603 foundry = AREF (font, FONT_FOUNDRY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1604 if (! NILP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1605 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1606 if (SYMBOLP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1607 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1608 foundry = SYMBOL_NAME (foundry); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1609 len += 9 + SBYTES (foundry); /* ":foundry=NAME" */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1610 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1611 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1612 foundry = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1613 } |
94926 | 1614 |
1615 for (i = 0; i < 3; i++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1616 { |
94926 | 1617 styles[i] = font_style_symbolic (font, FONT_WEIGHT_INDEX + i, 0); |
1618 if (! NILP (styles[i])) | |
1619 len += sprintf (work, ":%s=%s", style_names[i], | |
1620 SDATA (SYMBOL_NAME (styles[i]))); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1621 } |
94926 | 1622 |
1623 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
105576
9e1a1361da63
(font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105155
diff
changeset
|
1624 len += sprintf (work, ":dpi=%ld", (long)XINT (AREF (font, FONT_DPI_INDEX))); |
94926 | 1625 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) |
1626 len += strlen (":spacing=100"); | |
1627 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1628 len += strlen (":scalable=false"); /* or ":scalable=true" */ | |
1629 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
|
1630 { |
94926 | 1631 Lisp_Object key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail)); |
1632 | |
1633 len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */ | |
1634 if (STRINGP (val)) | |
1635 len += SBYTES (val); | |
1636 else if (INTEGERP (val)) | |
105576
9e1a1361da63
(font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105155
diff
changeset
|
1637 len += sprintf (work, "%ld", (long) XINT (val)); |
94926 | 1638 else if (SYMBOLP (val)) |
1639 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
|
1640 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1641 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1642 if (len > nbytes) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1643 return -1; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1644 p = name; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1645 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1646 p += sprintf (p, "%s", SDATA (family)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1647 if (point_size > 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1648 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1649 if (p == name) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1650 p += sprintf (p, "%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1651 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1652 p += sprintf (p, "-%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1653 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1654 else if (pixel_size > 0) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1655 p += sprintf (p, ":pixelsize=%d", pixel_size); |
94926 | 1656 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
|
1657 p += sprintf (p, ":foundry=%s", |
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1658 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
|
1659 for (i = 0; i < 3; i++) |
94926 | 1660 if (! NILP (styles[i])) |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1661 p += sprintf (p, ":%s=%s", style_names[i], |
94926 | 1662 SDATA (SYMBOL_NAME (styles[i]))); |
1663 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
105576
9e1a1361da63
(font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105155
diff
changeset
|
1664 p += sprintf (p, ":dpi=%ld", (long) XINT (AREF (font, FONT_DPI_INDEX))); |
94926 | 1665 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) |
105576
9e1a1361da63
(font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105155
diff
changeset
|
1666 p += sprintf (p, ":spacing=%ld", |
9e1a1361da63
(font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105155
diff
changeset
|
1667 (long) XINT (AREF (font, FONT_SPACING_INDEX))); |
94926 | 1668 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) |
1669 { | |
1670 if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0) | |
1671 p += sprintf (p, ":scalable=true"); | |
1672 else | |
1673 p += sprintf (p, ":scalable=false"); | |
1674 } | |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1675 return (p - name); |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1676 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1677 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1678 /* 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
|
1679 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
|
1680 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
|
1681 size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1682 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1683 int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1684 font_unparse_gtkname (Lisp_Object font, struct frame *f, char *name, int nbytes) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1685 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1686 char *p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1687 int len = 1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1688 Lisp_Object family, weight, slant, size; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1689 int point_size = -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1690 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1691 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1692 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1693 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1694 if (! SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1695 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1696 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1697 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1698 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1699 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1700 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
|
1701 if (EQ (weight, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1702 weight = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1703 else if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1704 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1705 weight = SYMBOL_NAME (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1706 len += SBYTES (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1707 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1708 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1709 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
|
1710 if (EQ (slant, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1711 slant = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1712 else if (! NILP (slant)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1713 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1714 slant = SYMBOL_NAME (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1715 len += SBYTES (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1716 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1717 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1718 size = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1719 /* Convert pixel size to point size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1720 if (INTEGERP (size)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1721 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1722 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
|
1723 int dpi = 75; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1724 if (INTEGERP (font_dpi)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1725 dpi = XINT (font_dpi); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1726 else if (f) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1727 dpi = f->resy; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1728 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
|
1729 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1730 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1731 else if (FLOATP (size)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1732 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1733 point_size = (int) XFLOAT_DATA (size); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1734 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1735 } |
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 if (len > nbytes) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1738 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1739 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1740 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
|
1741 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1742 if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1743 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1744 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1745 p += sprintf (p, " %s", SDATA (weight)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1746 q[1] = toupper (q[1]); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1747 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1748 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1749 if (! NILP (slant)) |
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 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1752 p += sprintf (p, " %s", SDATA (slant)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1753 q[1] = toupper (q[1]); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1754 } |
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 if (point_size > 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1757 p += sprintf (p, " %d", point_size); |
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 return (p - name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1760 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1761 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1762 /* 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
|
1763 (font-spec or font-entity). If NAME is successfully parsed, return |
94926 | 1764 0. Otherwise return -1. */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1765 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1766 static int |
109735
0fe981e141e3
Remove incorrect const use.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109726
diff
changeset
|
1767 font_parse_name (char *name, Lisp_Object font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1768 { |
109315
8f3464b85afb
Use strchr, strrchr instead of index, rindex
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
1769 if (name[0] == '-' || strchr (name, '*') || strchr (name, '?')) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1770 return font_parse_xlfd (name, font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1771 return font_parse_fcname (name, font); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1772 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1773 |
94926 | 1774 |
1775 /* Merge FAMILY and REGISTRY into FONT_SPEC. FAMILY may have the form | |
1776 "FAMILY-FOUNDRY". REGISTRY may not contain charset-encoding | |
1777 part. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1778 |
90400 | 1779 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1780 font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec) |
90400 | 1781 { |
94926 | 1782 int len; |
1783 char *p0, *p1; | |
1784 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1785 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
|
1786 && NILP (AREF (font_spec, FONT_FAMILY_INDEX))) |
90400 | 1787 { |
94926 | 1788 CHECK_STRING (family); |
1789 len = SBYTES (family); | |
1790 p0 = (char *) SDATA (family); | |
109315
8f3464b85afb
Use strchr, strrchr instead of index, rindex
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
1791 p1 = strchr (p0, '-'); |
94926 | 1792 if (p1) |
90400 | 1793 { |
103369
97cfffb6f666
(font_parse_family_registry): Fix for one-char foundry.
Kenichi Handa <handa@m17n.org>
parents:
103255
diff
changeset
|
1794 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
|
1795 && 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
|
1796 Ffont_put (font_spec, QCfoundry, font_intern_prop (p0, p1 - p0, 1)); |
94926 | 1797 p1++; |
1798 len -= p1 - p0; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1799 Ffont_put (font_spec, QCfamily, font_intern_prop (p1, len, 1)); |
90400 | 1800 } |
94926 | 1801 else |
1802 ASET (font_spec, FONT_FAMILY_INDEX, Fintern (family, Qnil)); | |
1803 } | |
1804 if (! NILP (registry)) | |
1805 { | |
1806 /* Convert "XXX" and "XXX*" to "XXX*-*". */ | |
1807 CHECK_STRING (registry); | |
1808 len = SBYTES (registry); | |
1809 p0 = (char *) SDATA (registry); | |
109315
8f3464b85afb
Use strchr, strrchr instead of index, rindex
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
1810 p1 = strchr (p0, '-'); |
94926 | 1811 if (! p1) |
1812 { | |
1813 if (SDATA (registry)[len - 1] == '*') | |
1814 registry = concat2 (registry, build_string ("-*")); | |
1815 else | |
1816 registry = concat2 (registry, build_string ("*-*")); | |
1817 } | |
1818 registry = Fdowncase (registry); | |
1819 ASET (font_spec, FONT_REGISTRY_INDEX, Fintern (registry, Qnil)); | |
90400 | 1820 } |
1821 } | |
1822 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1823 |
94926 | 1824 /* This part (through the next ^L) is still experimental and not |
1825 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
|
1826 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1827 /* OTF handler */ |
90541 | 1828 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1829 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1830 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1831 #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
|
1832 #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
|
1833 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1834 static int |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1835 check_gstring (gstring) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1836 Lisp_Object gstring; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1837 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1838 Lisp_Object val; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1839 int i, j; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1840 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1841 CHECK_VECTOR (gstring); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1842 val = AREF (gstring, 0); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1843 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1844 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
|
1845 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1846 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
|
1847 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
|
1848 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
|
1849 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
|
1850 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
|
1851 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
|
1852 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
|
1853 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
|
1854 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
|
1855 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
|
1856 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
|
1857 |
97822 | 1858 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
|
1859 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1860 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
|
1861 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1862 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
|
1863 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
|
1864 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
|
1865 break; |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1866 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
|
1867 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
|
1868 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
|
1869 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
|
1870 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
|
1871 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
|
1872 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
|
1873 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
|
1874 { |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1875 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
|
1876 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1877 if (ASIZE (val) < 3) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1878 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1879 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
|
1880 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
|
1881 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1882 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1883 return i; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1884 err: |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1885 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
|
1886 return -1; |
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 |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1889 static void |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1890 check_otf_features (otf_features) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1891 Lisp_Object otf_features; |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1892 { |
94926 | 1893 Lisp_Object val; |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1894 |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1895 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1896 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1897 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1898 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1899 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1900 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1901 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
|
1902 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1903 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1904 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1905 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
|
1906 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1907 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1908 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
|
1909 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1910 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1911 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1912 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
|
1913 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1914 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1915 |
90400 | 1916 #ifdef HAVE_LIBOTF |
1917 #include <otf.h> | |
1918 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1919 Lisp_Object otf_list; |
90400 | 1920 |
1921 static Lisp_Object | |
1922 otf_tag_symbol (tag) | |
1923 OTF_Tag tag; | |
1924 { | |
1925 char name[5]; | |
1926 | |
1927 OTF_tag_name (tag, name); | |
1928 return Fintern (make_unibyte_string (name, 4), Qnil); | |
1929 } | |
1930 | |
1931 static OTF * | |
94926 | 1932 otf_open (file) |
1933 Lisp_Object file; | |
90400 | 1934 { |
94926 | 1935 Lisp_Object val = Fassoc (file, otf_list); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1936 OTF *otf; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1937 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1938 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1939 otf = XSAVE_VALUE (XCDR (val))->pointer; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1940 else |
90400 | 1941 { |
94926 | 1942 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
|
1943 val = make_save_value (otf, 0); |
94926 | 1944 otf_list = Fcons (Fcons (file, val), otf_list); |
90400 | 1945 } |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1946 return otf; |
90400 | 1947 } |
1948 | |
1949 | |
1950 /* Return a list describing which scripts/languages FONT supports by | |
1951 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
|
1952 (struct font_driver).otf_capability. */ |
90400 | 1953 |
1954 Lisp_Object | |
1955 font_otf_capability (font) | |
1956 struct font *font; | |
1957 { | |
1958 OTF *otf; | |
1959 Lisp_Object capability = Fcons (Qnil, Qnil); | |
1960 int i; | |
1961 | |
94926 | 1962 otf = otf_open (font->props[FONT_FILE_INDEX]); |
90400 | 1963 if (! otf) |
1964 return Qnil; | |
1965 for (i = 0; i < 2; i++) | |
1966 { | |
1967 OTF_GSUB_GPOS *gsub_gpos; | |
1968 Lisp_Object script_list = Qnil; | |
1969 int j; | |
1970 | |
1971 if (OTF_get_features (otf, i == 0) < 0) | |
1972 continue; | |
1973 gsub_gpos = i == 0 ? otf->gsub : otf->gpos; | |
1974 for (j = gsub_gpos->ScriptList.ScriptCount - 1; j >= 0; j--) | |
1975 { | |
1976 OTF_Script *script = gsub_gpos->ScriptList.Script + j; | |
1977 Lisp_Object langsys_list = Qnil; | |
1978 Lisp_Object script_tag = otf_tag_symbol (script->ScriptTag); | |
1979 int k; | |
1980 | |
1981 for (k = script->LangSysCount; k >= 0; k--) | |
1982 { | |
1983 OTF_LangSys *langsys; | |
1984 Lisp_Object feature_list = Qnil; | |
1985 Lisp_Object langsys_tag; | |
1986 int l; | |
1987 | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
1988 if (k == script->LangSysCount) |
90400 | 1989 { |
1990 langsys = &script->DefaultLangSys; | |
1991 langsys_tag = Qnil; | |
1992 } | |
1993 else | |
1994 { | |
1995 langsys = script->LangSys + k; | |
1996 langsys_tag | |
1997 = otf_tag_symbol (script->LangSysRecord[k].LangSysTag); | |
1998 } | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
1999 for (l = langsys->FeatureCount - 1; l >= 0; l--) |
90400 | 2000 { |
2001 OTF_Feature *feature | |
2002 = gsub_gpos->FeatureList.Feature + langsys->FeatureIndex[l]; | |
2003 Lisp_Object feature_tag | |
2004 = otf_tag_symbol (feature->FeatureTag); | |
2005 | |
2006 feature_list = Fcons (feature_tag, feature_list); | |
2007 } | |
2008 langsys_list = Fcons (Fcons (langsys_tag, feature_list), | |
2009 langsys_list); | |
2010 } | |
2011 script_list = Fcons (Fcons (script_tag, langsys_list), | |
2012 script_list); | |
2013 } | |
2014 | |
2015 if (i == 0) | |
2016 XSETCAR (capability, script_list); | |
2017 else | |
2018 XSETCDR (capability, script_list); | |
2019 } | |
2020 | |
2021 return capability; | |
2022 } | |
2023 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2024 /* 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
|
2025 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
|
2026 assured that the sufficient memory has already allocated for |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2027 FEATURES. */ |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2028 |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2029 static void |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2030 generate_otf_features (spec, features) |
90400 | 2031 Lisp_Object spec; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2032 char *features; |
90400 | 2033 { |
2034 Lisp_Object val; | |
94926 | 2035 char *p; |
90400 | 2036 int asterisk; |
2037 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2038 p = features; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2039 *p = '\0'; |
90400 | 2040 for (asterisk = 0; CONSP (spec); spec = XCDR (spec)) |
2041 { | |
2042 val = XCAR (spec); | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2043 CHECK_SYMBOL (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2044 if (p > features) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2045 *p++ = ','; |
90400 | 2046 if (SREF (SYMBOL_NAME (val), 0) == '*') |
2047 { | |
2048 asterisk = 1; | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2049 *p++ = '*'; |
90400 | 2050 } |
2051 else if (! asterisk) | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2052 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2053 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2054 p += sprintf (p, "%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2055 } |
90400 | 2056 else |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2057 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2058 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2059 p += sprintf (p, "~%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2060 } |
90400 | 2061 } |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2062 if (CONSP (spec)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2063 error ("OTF spec too long"); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2064 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2065 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2066 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2067 font_otf_DeviceTable (device_table) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2068 OTF_DeviceTable *device_table; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2069 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2070 int len = device_table->StartSize - device_table->EndSize + 1; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2071 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2072 return Fcons (make_number (len), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2073 make_unibyte_string (device_table->DeltaValue, len)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2074 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2075 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2076 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2077 font_otf_ValueRecord (value_format, value_record) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2078 int value_format; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2079 OTF_ValueRecord *value_record; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2080 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2081 Lisp_Object val = Fmake_vector (make_number (8), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2082 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2083 if (value_format & OTF_XPlacement) |
91909 | 2084 ASET (val, 0, make_number (value_record->XPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2085 if (value_format & OTF_YPlacement) |
91909 | 2086 ASET (val, 1, make_number (value_record->YPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2087 if (value_format & OTF_XAdvance) |
91909 | 2088 ASET (val, 2, make_number (value_record->XAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2089 if (value_format & OTF_YAdvance) |
91909 | 2090 ASET (val, 3, make_number (value_record->YAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2091 if (value_format & OTF_XPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2092 ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2093 if (value_format & OTF_YPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2094 ASET (val, 4, font_otf_DeviceTable (&value_record->YPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2095 if (value_format & OTF_XAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2096 ASET (val, 4, font_otf_DeviceTable (&value_record->XAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2097 if (value_format & OTF_YAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2098 ASET (val, 4, font_otf_DeviceTable (&value_record->YAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2099 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2100 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2101 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2102 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2103 font_otf_Anchor (anchor) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2104 OTF_Anchor *anchor; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2105 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2106 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2107 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2108 val = Fmake_vector (make_number (anchor->AnchorFormat + 1), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2109 ASET (val, 0, make_number (anchor->XCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2110 ASET (val, 1, make_number (anchor->YCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2111 if (anchor->AnchorFormat == 2) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2112 ASET (val, 2, make_number (anchor->f.f1.AnchorPoint)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2113 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2114 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2115 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
|
2116 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
|
2117 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2118 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2119 } |
90400 | 2120 #endif /* HAVE_LIBOTF */ |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
2121 #endif /* 0 */ |
90400 | 2122 |
2123 | |
2124 /* Font sorting */ | |
2125 | |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2126 static unsigned font_score (Lisp_Object, Lisp_Object *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2127 static int font_compare (const void *, const void *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2128 static Lisp_Object font_sort_entities (Lisp_Object, Lisp_Object, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2129 Lisp_Object, int); |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2130 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2131 static double |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2132 font_rescale_ratio (Lisp_Object font_entity) |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2133 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2134 Lisp_Object tail, elt; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2135 Lisp_Object name = Qnil; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2136 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2137 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
|
2138 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2139 elt = XCAR (tail); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2140 if (FLOATP (XCDR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2141 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2142 if (STRINGP (XCAR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2143 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2144 if (NILP (name)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2145 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
|
2146 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
|
2147 return XFLOAT_DATA (XCDR (elt)); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2148 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2149 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
|
2150 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2151 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
|
2152 return XFLOAT_DATA (XCDR (elt)); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2153 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2154 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2155 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2156 return 1.0; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2157 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2158 |
90400 | 2159 /* We sort fonts by scoring each of them against a specified |
2160 font-spec. The score value is 32 bit (`unsigned'), and the smaller | |
2161 the value is, the closer the font is to the font-spec. | |
2162 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2163 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
|
2164 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
|
2165 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2166 Each 7-bit in the higher 28 bits are used for numeric properties |
90400 | 2167 WEIGHT, SLANT, WIDTH, and SIZE. */ |
2168 | |
2169 /* How many bits to shift to store the difference value of each font | |
94926 | 2170 property in a score. Note that flots for FONT_TYPE_INDEX and |
2171 FONT_REGISTRY_INDEX are not used. */ | |
90400 | 2172 static int sort_shift_bits[FONT_SIZE_INDEX + 1]; |
2173 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2174 /* 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
|
2175 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
|
2176 SPEC_PROP. */ |
90400 | 2177 |
2178 static unsigned | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2179 font_score (Lisp_Object entity, Lisp_Object *spec_prop) |
90400 | 2180 { |
2181 unsigned score = 0; | |
2182 int i; | |
94926 | 2183 |
2184 /* Score three style numeric fields. Maximum difference is 127. */ | |
2185 for (i = FONT_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; i++) | |
2186 if (! NILP (spec_prop[i]) && ! EQ (AREF (entity, i), spec_prop[i])) | |
2187 { | |
2188 int diff = (XINT (AREF (entity, i)) >> 8) - (XINT (spec_prop[i]) >> 8); | |
2189 | |
2190 if (diff < 0) | |
2191 diff = - diff; | |
95875
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2192 if (diff > 0) |
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2193 score |= min (diff, 127) << sort_shift_bits[i]; |
94926 | 2194 } |
2195 | |
2196 /* Score the size. Maximum difference is 127. */ | |
2197 i = FONT_SIZE_INDEX; | |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2198 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
|
2199 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) |
90400 | 2200 { |
94926 | 2201 /* We use the higher 6-bit for the actual size difference. The |
2202 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
|
2203 int diff; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2204 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
|
2205 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2206 if (CONSP (Vface_font_rescale_alist)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2207 pixel_size *= font_rescale_ratio (entity); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2208 diff = pixel_size - XINT (AREF (entity, FONT_SIZE_INDEX)); |
94926 | 2209 if (diff < 0) |
2210 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
|
2211 diff <<= 1; |
94926 | 2212 if (! NILP (spec_prop[FONT_DPI_INDEX]) |
2213 && ! EQ (spec_prop[FONT_DPI_INDEX], AREF (entity, FONT_DPI_INDEX))) | |
2214 diff |= 1; | |
103041
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2215 if (! NILP (spec_prop[FONT_AVGWIDTH_INDEX]) |
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2216 && ! 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
|
2217 diff |= 1; |
94926 | 2218 score |= min (diff, 127) << sort_shift_bits[FONT_SIZE_INDEX]; |
90400 | 2219 } |
2220 | |
2221 return score; | |
2222 } | |
2223 | |
2224 | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2225 /* 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
|
2226 of font-entity vectors. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2227 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2228 static Lisp_Object |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2229 font_vconcat_entity_vectors (Lisp_Object list) |
90400 | 2230 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2231 int nargs = XINT (Flength (list)); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2232 Lisp_Object *args = alloca (sizeof (Lisp_Object) * nargs); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2233 int i; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2234 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2235 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
|
2236 args[i] = XCAR (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2237 return Fvconcat (nargs, args); |
90400 | 2238 } |
2239 | |
2240 | |
2241 /* The structure for elements being sorted by qsort. */ | |
2242 struct font_sort_data | |
2243 { | |
2244 unsigned score; | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2245 int font_driver_preference; |
90400 | 2246 Lisp_Object entity; |
2247 }; | |
2248 | |
2249 | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2250 /* The comparison function for qsort. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2251 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2252 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2253 font_compare (const void *d1, const void *d2) |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2254 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2255 const struct font_sort_data *data1 = d1; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2256 const struct font_sort_data *data2 = d2; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2257 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2258 if (data1->score < data2->score) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2259 return -1; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2260 else if (data1->score > data2->score) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2261 return 1; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2262 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
|
2263 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2264 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2265 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2266 /* Sort each font-entity vector in LIST by closeness to font-spec PREFER. |
90400 | 2267 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
|
2268 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
|
2269 of FRAME before sorting. |
94926 | 2270 |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2271 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
|
2272 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
|
2273 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
|
2274 a single vector of font-entities. |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2275 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2276 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
|
2277 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
|
2278 such a case. */ |
90400 | 2279 |
2280 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2281 font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int best_only) |
90400 | 2282 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2283 Lisp_Object prefer_prop[FONT_SPEC_MAX]; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2284 int len, maxlen, i; |
90400 | 2285 struct font_sort_data *data; |
94926 | 2286 unsigned best_score; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2287 Lisp_Object best_entity; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2288 struct frame *f = XFRAME (frame); |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2289 Lisp_Object tail, vec; |
90400 | 2290 USE_SAFE_ALLOCA; |
2291 | |
103369
97cfffb6f666
(font_parse_family_registry): Fix for one-char foundry.
Kenichi Handa <handa@m17n.org>
parents:
103255
diff
changeset
|
2292 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
|
2293 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
|
2294 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
|
2295 prefer_prop[FONT_SIZE_INDEX] |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2296 = 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
|
2297 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2298 if (NILP (XCDR (list))) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2299 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2300 /* 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
|
2301 vec = XCAR (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2302 maxlen = ASIZE (vec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2303 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2304 else if (best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2305 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2306 /* 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
|
2307 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
|
2308 vector. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2309 maxlen = 0; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2310 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2311 if (maxlen < ASIZE (XCAR (tail))) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2312 maxlen = ASIZE (XCAR (tail)); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2313 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2314 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2315 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2316 /* 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
|
2317 vec = font_vconcat_entity_vectors (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2318 maxlen = ASIZE (vec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2319 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2320 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2321 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
|
2322 best_score = 0xFFFFFFFF; |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2323 best_entity = Qnil; |
103889
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 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
90400 | 2326 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2327 int font_driver_preference = 0; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2328 Lisp_Object current_font_driver; |
106433
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
2329 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2330 if (best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2331 vec = XCAR (tail); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2332 len = ASIZE (vec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2333 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2334 /* 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
|
2335 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
|
2336 /* Score the elements. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2337 for (i = 0; i < len; i++) |
94926 | 2338 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2339 data[i].entity = AREF (vec, i); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2340 data[i].score |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2341 = ((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
|
2342 > 0) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2343 ? font_score (data[i].entity, prefer_prop) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2344 : 0xFFFFFFFF); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2345 if (best_only && best_score > data[i].score) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2346 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2347 best_score = data[i].score; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2348 best_entity = data[i].entity; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2349 if (best_score == 0) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2350 break; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2351 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2352 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
|
2353 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2354 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
|
2355 font_driver_preference++; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2356 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2357 data[i].font_driver_preference = font_driver_preference; |
94926 | 2358 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2359 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2360 /* Sort if necessary. */ |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2361 if (! best_only) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2362 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2363 qsort (data, len, sizeof *data, font_compare); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2364 for (i = 0; i < len; i++) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2365 ASET (vec, i, data[i].entity); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2366 break; |
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 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2369 vec = best_entity; |
90400 | 2370 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2371 |
90400 | 2372 SAFE_FREE (); |
2373 | |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
2374 FONT_ADD_LOG ("sort-by", prefer, vec); |
90400 | 2375 return vec; |
2376 } | |
2377 | |
2378 | |
2379 /* API of Font Service Layer. */ | |
2380 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2381 /* 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
|
2382 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
|
2383 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
|
2384 |
90400 | 2385 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2386 font_update_sort_order (int *order) |
90400 | 2387 { |
94926 | 2388 int i, shift_bits; |
2389 | |
95869
14ab94c436d7
(font_update_sort_order): Setting of sort_shift_bits adjusted for the
Kenichi Handa <handa@m17n.org>
parents:
95867
diff
changeset
|
2390 for (i = 0, shift_bits = 23; i < 4; i++, shift_bits -= 7) |
90400 | 2391 { |
2392 int xlfd_idx = order[i]; | |
2393 | |
2394 if (xlfd_idx == XLFD_WEIGHT_INDEX) | |
2395 sort_shift_bits[FONT_WEIGHT_INDEX] = shift_bits; | |
2396 else if (xlfd_idx == XLFD_SLANT_INDEX) | |
2397 sort_shift_bits[FONT_SLANT_INDEX] = shift_bits; | |
2398 else if (xlfd_idx == XLFD_SWIDTH_INDEX) | |
2399 sort_shift_bits[FONT_WIDTH_INDEX] = shift_bits; | |
2400 else | |
2401 sort_shift_bits[FONT_SIZE_INDEX] = shift_bits; | |
2402 } | |
2403 } | |
2404 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2405 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2406 font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table) |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2407 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2408 Lisp_Object val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2409 int negative; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2410 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2411 table = assq_no_quit (script, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2412 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2413 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2414 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2415 if (! NILP (langsys)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2416 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2417 table = assq_no_quit (langsys, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2418 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2419 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2420 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2421 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2422 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2423 val = assq_no_quit (Qnil, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2424 if (NILP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2425 table = XCAR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2426 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2427 table = val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2428 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2429 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2430 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
|
2431 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2432 if (NILP (XCAR (features))) |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2433 { |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2434 negative = 1; |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2435 continue; |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2436 } |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2437 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
|
2438 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2439 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2440 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2441 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2442 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2443 /* 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
|
2444 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2445 static int |
96573
3de01ebe30b7
* fontset.c (fontset_get_font_group):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96565
diff
changeset
|
2446 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
|
2447 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2448 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
|
2449 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2450 script = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2451 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2452 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2453 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2454 langsys = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2455 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2456 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2457 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2458 gsub = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2459 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2460 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2461 gpos = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2462 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2463 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2464 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2465 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
|
2466 XCAR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2467 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2468 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
|
2469 XCDR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2470 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2471 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2472 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2473 |
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 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2476 /* 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
|
2477 specification SPEC. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2478 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2479 int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2480 font_match_p (Lisp_Object spec, Lisp_Object font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2481 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2482 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
|
2483 Lisp_Object extra, font_extra; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2484 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2485 |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2486 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
|
2487 if (! NILP (AREF (spec, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2488 && ! NILP (AREF (font, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2489 && ! 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
|
2490 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2491 props = XFONT_SPEC (spec)->props; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2492 if (FLOATP (props[FONT_SIZE_INDEX])) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2493 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2494 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
|
2495 prop[i] = AREF (spec, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2496 prop[FONT_SIZE_INDEX] |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2497 = 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
|
2498 props = prop; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2499 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2500 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2501 if (font_score (font, props) > 0) |
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 extra = AREF (spec, FONT_EXTRA_INDEX); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2504 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
|
2505 for (; CONSP (extra); extra = XCDR (extra)) |
94926 | 2506 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2507 Lisp_Object key = XCAR (XCAR (extra)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2508 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
|
2509 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2510 if (EQ (key, QClang)) |
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 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
|
2513 if (NILP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2514 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2515 val2 = XCDR (val2); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2516 if (CONSP (val)) |
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 if (! CONSP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2519 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2520 while (CONSP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2521 if (NILP (Fmemq (val, val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2522 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2523 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2524 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2525 if (CONSP (val2) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2526 ? NILP (Fmemq (val, XCDR (val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2527 : ! EQ (val, val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2528 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2529 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2530 else if (EQ (key, QCscript)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2531 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2532 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
|
2533 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2534 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2535 val2 = XCDR (val2); |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2536 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2537 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2538 /* 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
|
2539 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
|
2540 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2541 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
|
2542 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2543 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
|
2544 == FONT_INVALID_CODE) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2545 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2546 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2547 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2548 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
|
2549 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2550 /* 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
|
2551 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
|
2552 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2553 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
|
2554 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2555 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
|
2556 != FONT_INVALID_CODE) |
99076
06c37ccf1b58
(font_match_p): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
99075
diff
changeset
|
2557 break; |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2558 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2559 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
|
2560 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2561 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2562 } |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2563 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2564 else if (EQ (key, QCotf)) |
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 struct font *fontp; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2567 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2568 if (! FONT_OBJECT_P (font)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2569 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2570 fontp = XFONT_OBJECT (font); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2571 if (! fontp->driver->otf_capability) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2572 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2573 val2 = fontp->driver->otf_capability (fontp); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2574 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
|
2575 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2576 } |
94926 | 2577 } |
2578 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2579 return 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2580 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2581 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2582 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2583 /* Font cache |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2584 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2585 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
|
2586 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
|
2587 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
|
2588 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
|
2589 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2590 ((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
|
2591 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2592 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
|
2593 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
|
2594 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
|
2595 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2596 static void font_prepare_cache (FRAME_PTR, struct font_driver *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2597 static void font_finish_cache (FRAME_PTR, struct font_driver *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2598 static Lisp_Object font_get_cache (FRAME_PTR, struct font_driver *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2599 static void font_clear_cache (FRAME_PTR, Lisp_Object, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109032
diff
changeset
|
2600 struct font_driver *); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2601 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2602 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2603 font_prepare_cache (FRAME_PTR f, struct font_driver *driver) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2604 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2605 Lisp_Object cache, val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2606 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2607 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
|
2608 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2609 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
|
2610 val = XCDR (val); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2611 if (NILP (val)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2612 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2613 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
|
2614 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
|
2615 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2616 else |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2617 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2618 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2619 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
|
2620 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2621 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2622 |
91909 | 2623 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2624 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2625 font_finish_cache (FRAME_PTR f, struct font_driver *driver) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2626 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2627 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
|
2628 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2629 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2630 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
|
2631 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2632 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
|
2633 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
|
2634 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
|
2635 tmp = XCDR (XCAR (val)); |
91909 | 2636 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
|
2637 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
|
2638 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2639 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
|
2640 XSETCDR (cache, XCDR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2641 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2642 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2643 |
91909 | 2644 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2645 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2646 font_get_cache (FRAME_PTR f, struct font_driver *driver) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2647 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2648 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
|
2649 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
|
2650 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2651 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
|
2652 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
|
2653 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
|
2654 /* 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
|
2655 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2656 return val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2657 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2658 |
91909 | 2659 static int num_fonts; |
2660 | |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2661 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2662 font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2663 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2664 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
|
2665 Lisp_Object tail2, entity; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2666 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2667 /* 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
|
2668 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
|
2669 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2670 elt = XCAR (tail); |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2671 /* 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
|
2672 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
|
2673 { |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2674 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
|
2675 { |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2676 entity = XCAR (tail2); |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2677 |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2678 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
|
2679 && 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
|
2680 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2681 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
|
2682 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2683 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
|
2684 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2685 Lisp_Object val = XCAR (objlist); |
94926 | 2686 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
|
2687 |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2688 if (! NILP (AREF (val, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2689 { |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2690 font_assert (font && driver == font->driver); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2691 driver->close (f, font); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2692 num_fonts--; |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2693 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2694 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2695 if (driver->free_entity) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2696 driver->free_entity (entity); |
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 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2700 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2701 XSETCDR (cache, Qnil); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2702 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2703 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2704 |
90400 | 2705 static Lisp_Object scratch_font_spec, scratch_font_prefer; |
2706 | |
108813 | 2707 /* Check each font-entity in VEC, and return a list of font-entities |
2708 that satisfy this condition: | |
2709 (1) matches with SPEC and SIZE if SPEC is not nil, and | |
2710 (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil). | |
2711 */ | |
2712 | |
94926 | 2713 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2714 font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size) |
94926 | 2715 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2716 Lisp_Object entity, val; |
94926 | 2717 enum font_property_index prop; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2718 int i; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2719 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2720 for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--) |
94926 | 2721 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2722 entity = AREF (vec, i); |
108813 | 2723 if (! NILP (Vface_ignored_fonts)) |
2724 { | |
2725 char name[256]; | |
2726 Lisp_Object tail, regexp; | |
2727 | |
2728 if (font_unparse_xlfd (entity, 0, name, 256) >= 0) | |
2729 { | |
2730 for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail)) | |
2731 { | |
2732 regexp = XCAR (tail); | |
2733 if (STRINGP (regexp) | |
2734 && fast_c_string_match_ignore_case (regexp, name) >= 0) | |
2735 break; | |
2736 } | |
2737 if (CONSP (tail)) | |
2738 continue; | |
2739 } | |
2740 } | |
2741 if (NILP (spec)) | |
2742 { | |
2743 val = Fcons (entity, val); | |
2744 continue; | |
2745 } | |
94926 | 2746 for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) |
2747 if (INTEGERP (AREF (spec, prop)) | |
2748 && ((XINT (AREF (spec, prop)) >> 8) | |
2749 != (XINT (AREF (entity, prop)) >> 8))) | |
2750 prop = FONT_SPEC_MAX; | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2751 if (prop < FONT_SPEC_MAX |
94926 | 2752 && size |
2753 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) | |
2754 { | |
2755 int diff = XINT (AREF (entity, FONT_SIZE_INDEX)) - size; | |
2756 | |
2757 if (diff != 0 | |
2758 && (diff < 0 ? -diff > FONT_PIXEL_SIZE_QUANTUM | |
2759 : diff > FONT_PIXEL_SIZE_QUANTUM)) | |
2760 prop = FONT_SPEC_MAX; | |
2761 } | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2762 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2763 && INTEGERP (AREF (spec, FONT_DPI_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2764 && 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
|
2765 && XINT (AREF (entity, FONT_DPI_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2766 && ! 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
|
2767 prop = FONT_SPEC_MAX; |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2768 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2769 && INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2770 && 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
|
2771 && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2772 && ! EQ (AREF (spec, FONT_AVGWIDTH_INDEX), |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2773 AREF (entity, FONT_AVGWIDTH_INDEX))) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2774 prop = FONT_SPEC_MAX; |
94926 | 2775 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
|
2776 val = Fcons (entity, val); |
94926 | 2777 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2778 return (Fvconcat (1, &val)); |
94926 | 2779 } |
2780 | |
2781 | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2782 /* Return a list of vectors of font-entities matching with SPEC on |
106433
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
2783 FRAME. Each elements in the list is a vector of entities from the |
7c2192f52cb6
Fix a comment and delete trailing whitespace.
Chong Yidong <cyd@stupidchicken.com>
parents:
106350
diff
changeset
|
2784 same font-driver. */ |
94926 | 2785 |
2786 Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2787 font_list_entities (Lisp_Object frame, Lisp_Object spec) |
90400 | 2788 { |
2789 FRAME_PTR f = XFRAME (frame); | |
2790 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
|
2791 Lisp_Object ftype, val; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2792 Lisp_Object list = Qnil; |
94926 | 2793 int size; |
2794 int need_filtering = 0; | |
90400 | 2795 int i; |
2796 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2797 font_assert (FONT_SPEC_P (spec)); |
90400 | 2798 |
94926 | 2799 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) |
2800 size = XINT (AREF (spec, FONT_SIZE_INDEX)); | |
2801 else if (FLOATP (AREF (spec, FONT_SIZE_INDEX))) | |
2802 size = font_pixel_size (f, spec); | |
2803 else | |
2804 size = 0; | |
2805 | |
90400 | 2806 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
|
2807 for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) |
94926 | 2808 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
|
2809 for (i = FONT_WEIGHT_INDEX; i < FONT_EXTRA_INDEX; i++) |
94926 | 2810 { |
2811 ASET (scratch_font_spec, i, Qnil); | |
2812 if (! NILP (AREF (spec, i))) | |
2813 need_filtering = 1; | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2814 if (i == FONT_DPI_INDEX) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2815 /* Skip FONT_SPACING_INDEX */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2816 i++; |
94926 | 2817 } |
95359
f6580a4c58da
(font_parse_family_registry): Use Ffont_put to validate
Kenichi Handa <handa@m17n.org>
parents:
95290
diff
changeset
|
2818 ASET (scratch_font_spec, FONT_SPACING_INDEX, AREF (spec, FONT_SPACING_INDEX)); |
94926 | 2819 ASET (scratch_font_spec, FONT_EXTRA_INDEX, AREF (spec, FONT_EXTRA_INDEX)); |
2820 | |
90400 | 2821 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
|
2822 if (driver_list->on |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
2823 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) |
90400 | 2824 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2825 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
|
2826 |
95437
6e6db01383e4
(font_list_entities): Fix the car part of data to be
Kenichi Handa <handa@m17n.org>
parents:
95421
diff
changeset
|
2827 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
|
2828 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
|
2829 if (CONSP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2830 val = XCDR (val); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2831 else |
90400 | 2832 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2833 Lisp_Object copy; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2834 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2835 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
|
2836 if (NILP (val)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2837 val = null_vector; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2838 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2839 val = Fvconcat (1, &val); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2840 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
|
2841 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
|
2842 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); |
90400 | 2843 } |
108813 | 2844 if (ASIZE (val) > 0 |
2845 && (need_filtering | |
2846 || ! NILP (Vface_ignored_fonts))) | |
2847 val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2848 if (ASIZE (val) > 0) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2849 list = Fcons (val, list); |
90400 | 2850 } |
94926 | 2851 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2852 list = Fnreverse (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2853 FONT_ADD_LOG ("list", spec, list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
2854 return list; |
90400 | 2855 } |
2856 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2857 |
94926 | 2858 /* Return a font entity matching with SPEC on FRAME. ATTRS, if non |
2859 nil, is an array of face's attributes, which specifies preferred | |
2860 font-related attributes. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2861 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2862 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2863 font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2864 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2865 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
|
2866 Lisp_Object ftype, size, entity; |
94926 | 2867 Lisp_Object frame; |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2868 Lisp_Object work = Fcopy_font_spec (spec); |
94926 | 2869 |
2870 XSETFRAME (frame, f); | |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2871 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
|
2872 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
|
2873 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2874 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
|
2875 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
|
2876 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
|
2877 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
|
2878 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
|
2879 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2880 entity = Qnil; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2881 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
|
2882 if (driver_list->on |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2883 && (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
|
2884 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2885 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
|
2886 Lisp_Object copy; |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2887 |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2888 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
|
2889 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
|
2890 if (CONSP (entity)) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2891 entity = XCDR (entity); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2892 else |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2893 { |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2894 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
|
2895 copy = Fcopy_font_spec (work); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2896 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
|
2897 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
|
2898 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2899 if (! NILP (entity)) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2900 break; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2901 } |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
2902 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
|
2903 return entity; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2904 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2905 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2906 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2907 /* 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
|
2908 opened font object. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2909 |
90400 | 2910 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2911 font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) |
90400 | 2912 { |
2913 struct font_driver_list *driver_list; | |
91909 | 2914 Lisp_Object objlist, size, val, font_object; |
90400 | 2915 struct font *font; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2916 int min_width, height; |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2917 int scaled_pixel_size; |
94926 | 2918 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2919 font_assert (FONT_ENTITY_P (entity)); |
90400 | 2920 size = AREF (entity, FONT_SIZE_INDEX); |
2921 if (XINT (size) != 0) | |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2922 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
|
2923 else if (CONSP (Vface_font_rescale_alist)) |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2924 scaled_pixel_size = pixel_size * font_rescale_ratio (entity); |
90400 | 2925 |
94926 | 2926 val = AREF (entity, FONT_TYPE_INDEX); |
2927 for (driver_list = f->font_driver_list; | |
2928 driver_list && ! EQ (driver_list->driver->type, val); | |
2929 driver_list = driver_list->next); | |
2930 if (! driver_list) | |
2931 return Qnil; | |
2932 | |
106755
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2933 for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2934 objlist = XCDR (objlist)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2935 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2936 Lisp_Object fn = XCAR (objlist); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2937 if (! NILP (AREF (fn, FONT_TYPE_INDEX)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2938 && XFONT_OBJECT (fn)->pixel_size == pixel_size) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2939 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2940 if (driver_list->driver->cached_font_ok == NULL |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2941 || driver_list->driver->cached_font_ok (f, fn, entity)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2942 return fn; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2943 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2944 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106750
diff
changeset
|
2945 |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2946 font_object = driver_list->driver->open (f, entity, scaled_pixel_size); |
106215
da3ca3481c0b
(font_open_entity): Don't use ASET if font_object is Qnil.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
106201
diff
changeset
|
2947 if (!NILP (font_object)) |
da3ca3481c0b
(font_open_entity): Don't use ASET if font_object is Qnil.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
106201
diff
changeset
|
2948 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
|
2949 FONT_ADD_LOG ("open", entity, font_object); |
91909 | 2950 if (NILP (font_object)) |
94926 | 2951 return Qnil; |
2952 ASET (entity, FONT_OBJLIST_INDEX, | |
2953 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); | |
2954 num_fonts++; | |
2955 | |
2956 font = XFONT_OBJECT (font_object); | |
2957 min_width = (font->min_width ? font->min_width | |
2958 : font->average_width ? font->average_width | |
2959 : font->space_width ? font->space_width | |
2960 : 1); | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2961 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
|
2962 #ifdef HAVE_WINDOW_SYSTEM |
94926 | 2963 FRAME_X_DISPLAY_INFO (f)->n_fonts++; |
2964 if (FRAME_X_DISPLAY_INFO (f)->n_fonts == 1) | |
91909 | 2965 { |
94926 | 2966 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2967 FRAME_SMALLEST_FONT_HEIGHT (f) = height; |
94926 | 2968 fonts_changed_p = 1; |
91909 | 2969 } |
94926 | 2970 else |
2971 { | |
2972 if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width) | |
2973 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
|
2974 if (FRAME_SMALLEST_FONT_HEIGHT (f) > height) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2975 FRAME_SMALLEST_FONT_HEIGHT (f) = height, fonts_changed_p = 1; |
94926 | 2976 } |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2977 #endif |
91909 | 2978 |
2979 return font_object; | |
90400 | 2980 } |
2981 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2982 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2983 /* 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
|
2984 |
90400 | 2985 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2986 font_close_object (FRAME_PTR f, Lisp_Object font_object) |
90400 | 2987 { |
94926 | 2988 struct font *font = XFONT_OBJECT (font_object); |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2989 |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2990 if (NILP (AREF (font_object, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2991 /* Already closed. */ |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2992 return; |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
2993 FONT_ADD_LOG ("close", font_object, Qnil); |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2994 font->driver->close (f, font); |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2995 #ifdef HAVE_WINDOW_SYSTEM |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2996 font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2997 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
|
2998 #endif |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2999 num_fonts--; |
90400 | 3000 } |
3001 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3002 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3003 /* 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
|
3004 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
|
3005 |
90400 | 3006 int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3007 font_has_char (FRAME_PTR f, Lisp_Object font, int c) |
90400 | 3008 { |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3009 struct font *fontp; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3010 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3011 if (FONT_ENTITY_P (font)) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3012 { |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3013 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
|
3014 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
|
3015 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3016 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
|
3017 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
|
3018 driver_list = driver_list->next); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3019 if (! driver_list) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3020 return 0; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3021 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
|
3022 return -1; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3023 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
|
3024 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3025 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3026 font_assert (FONT_OBJECT_P (font)); |
94926 | 3027 fontp = XFONT_OBJECT (font); |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3028 if (fontp->driver->has_char) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3029 { |
94926 | 3030 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
|
3031 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3032 if (result >= 0) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3033 return result; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3034 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3035 return (fontp->driver->encode_char (fontp, c) != FONT_INVALID_CODE); |
90400 | 3036 } |
3037 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3038 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3039 /* 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
|
3040 |
90400 | 3041 unsigned |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3042 font_encode_char (Lisp_Object font_object, int c) |
90400 | 3043 { |
94926 | 3044 struct font *font; |
3045 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3046 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 3047 font = XFONT_OBJECT (font_object); |
90400 | 3048 return font->driver->encode_char (font, c); |
3049 } | |
3050 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3051 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3052 /* 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
|
3053 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3054 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3055 font_get_name (Lisp_Object font_object) |
90400 | 3056 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3057 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 3058 return AREF (font_object, FONT_NAME_INDEX); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3059 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3060 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3061 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3062 /* 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
|
3063 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3064 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3065 font_get_spec (Lisp_Object font_object) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3066 { |
94926 | 3067 Lisp_Object spec = font_make_spec (); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3068 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3069 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3070 for (i = 0; i < FONT_SIZE_INDEX; i++) |
94926 | 3071 ASET (spec, i, AREF (font_object, i)); |
3072 ASET (spec, FONT_SIZE_INDEX, | |
3073 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
|
3074 return spec; |
90400 | 3075 } |
3076 | |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3077 |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3078 /* 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
|
3079 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
|
3080 |
90400 | 3081 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3082 font_spec_from_name (Lisp_Object font_name) |
94926 | 3083 { |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3084 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
|
3085 |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3086 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
|
3087 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
|
3088 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
|
3089 font_put_extra (spec, QCname, font_name); |
106750
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
3090 font_put_extra (spec, QCuser_spec, font_name); |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3091 return spec; |
94926 | 3092 } |
3093 | |
3094 | |
3095 void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3096 font_clear_prop (Lisp_Object *attrs, enum font_property_index prop) |
94926 | 3097 { |
3098 Lisp_Object font = attrs[LFACE_FONT_INDEX]; | |
3099 | |
3100 if (! FONTP (font)) | |
3101 return; | |
106750
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
3102 |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3103 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
|
3104 { |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3105 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
|
3106 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
|
3107 } |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3108 |
94926 | 3109 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
|
3110 && 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
|
3111 && 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
|
3112 && prop != FONT_WIDTH_INDEX |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3113 && prop != FONT_SIZE_INDEX) |
94926 | 3114 return; |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3115 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
|
3116 font = Fcopy_font_spec (font); |
94926 | 3117 ASET (font, prop, Qnil); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3118 if (prop == FONT_FAMILY_INDEX || prop == FONT_FOUNDRY_INDEX) |
94926 | 3119 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3120 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
|
3121 { |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3122 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
|
3123 /* 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
|
3124 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
|
3125 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
|
3126 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
|
3127 } |
94926 | 3128 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
|
3129 ASET (font, FONT_REGISTRY_INDEX, Qnil); |
94926 | 3130 ASET (font, FONT_SIZE_INDEX, Qnil); |
3131 ASET (font, FONT_DPI_INDEX, Qnil); | |
3132 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3133 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3134 } | |
3135 else if (prop == FONT_SIZE_INDEX) | |
3136 { | |
3137 ASET (font, FONT_DPI_INDEX, Qnil); | |
3138 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3139 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3140 } | |
98717
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3141 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
|
3142 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); |
94926 | 3143 attrs[LFACE_FONT_INDEX] = font; |
3144 } | |
3145 | |
3146 void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3147 font_update_lface (FRAME_PTR f, Lisp_Object *attrs) |
90400 | 3148 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3149 Lisp_Object spec; |
94926 | 3150 |
3151 spec = attrs[LFACE_FONT_INDEX]; | |
3152 if (! FONT_SPEC_P (spec)) | |
3153 return; | |
3154 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3155 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
|
3156 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
|
3157 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
|
3158 attrs[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (spec, FONT_FAMILY_INDEX)); |
94926 | 3159 if (! NILP (AREF (spec, FONT_WEIGHT_INDEX))) |
3160 attrs[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (spec); | |
3161 if (! NILP (AREF (spec, FONT_SLANT_INDEX))) | |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101806
diff
changeset
|
3162 attrs[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (spec); |
94926 | 3163 if (! NILP (AREF (spec, FONT_WIDTH_INDEX))) |
3164 attrs[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (spec); | |
3165 if (! NILP (AREF (spec, FONT_SIZE_INDEX))) | |
3166 { | |
3167 int point; | |
3168 | |
3169 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) | |
3170 { | |
3171 Lisp_Object val; | |
3172 int dpi = f->resy; | |
3173 | |
3174 val = Ffont_get (spec, QCdpi); | |
3175 if (! NILP (val)) | |
3176 dpi = XINT (val); | |
3177 point = PIXEL_TO_POINT (XINT (AREF (spec, FONT_SIZE_INDEX)) * 10, | |
3178 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
|
3179 attrs[LFACE_HEIGHT_INDEX] = make_number (point); |
94926 | 3180 } |
3181 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
|
3182 { |
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3183 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
|
3184 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
|
3185 } |
94926 | 3186 } |
90400 | 3187 } |
3188 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3189 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3190 /* 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
|
3191 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
|
3192 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3193 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3194 font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c) |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3195 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3196 Lisp_Object font_entity; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3197 Lisp_Object prefer; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3198 int result, i; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3199 FRAME_PTR f = XFRAME (frame); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3200 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3201 if (NILP (XCDR (entities)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3202 && ASIZE (XCAR (entities)) == 1) |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3203 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3204 font_entity = AREF (XCAR (entities), 0); |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3205 if (c < 0 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3206 || (result = font_has_char (f, font_entity, c)) > 0) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3207 return font_entity; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3208 return Qnil; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3209 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3210 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3211 /* Sort fonts by properties specified in ATTRS. */ |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3212 prefer = scratch_font_prefer; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3213 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3214 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
|
3215 ASET (prefer, i, Qnil); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3216 if (FONTP (attrs[LFACE_FONT_INDEX])) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3217 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3218 Lisp_Object face_font = attrs[LFACE_FONT_INDEX]; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3219 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3220 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
|
3221 ASET (prefer, i, AREF (face_font, i)); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3222 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3223 if (NILP (AREF (prefer, FONT_WEIGHT_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3224 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
|
3225 if (NILP (AREF (prefer, FONT_SLANT_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3226 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
|
3227 if (NILP (AREF (prefer, FONT_WIDTH_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3228 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
|
3229 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
|
3230 |
103255
a8e08bcfc3ad
(font_sort_entities): Renamed from font_sort_entites.
Kenichi Handa <handa@m17n.org>
parents:
103246
diff
changeset
|
3231 return font_sort_entities (entities, prefer, frame, c); |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3232 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3233 |
94926 | 3234 /* Return a font-entity satisfying SPEC and best matching with face's |
3235 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
|
3236 character that the entity must support. */ |
90400 | 3237 |
3238 Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3239 font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) |
90400 | 3240 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3241 Lisp_Object work; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3242 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
|
3243 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
|
3244 int pixel_size; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3245 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
|
3246 |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3247 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
|
3248 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
|
3249 { |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
3250 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
|
3251 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
|
3252 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
|
3253 } |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3254 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
|
3255 registry[1] = null_vector; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3256 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3257 if (c >= 0 && ! NILP (AREF (spec, FONT_REGISTRY_INDEX))) |
94926 | 3258 { |
3259 struct charset *encoding, *repertory; | |
3260 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3261 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
|
3262 &encoding, &repertory) < 0) |
94926 | 3263 return Qnil; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3264 if (repertory |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3265 && ENCODE_CHAR (repertory, c) == CHARSET_INVALID_CODE (repertory)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3266 return Qnil; |
94926 | 3267 else if (c > encoding->max_char) |
3268 return Qnil; | |
3269 } | |
3270 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3271 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
|
3272 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
|
3273 XSETFRAME (frame, f); |
94926 | 3274 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
|
3275 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
|
3276 if (pixel_size == 0) |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3277 { |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3278 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
|
3279 |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3280 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
|
3281 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3282 ASET (work, FONT_SIZE_INDEX, Qnil); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3283 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
|
3284 if (! NILP (foundry[0])) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3285 foundry[1] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3286 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
|
3287 { |
97822 | 3288 val = attrs[LFACE_FOUNDRY_INDEX]; |
3289 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
|
3290 foundry[1] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3291 foundry[2] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3292 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3293 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3294 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
|
3295 |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3296 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
|
3297 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
|
3298 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
|
3299 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
|
3300 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3301 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
|
3302 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3303 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
|
3304 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3305 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
|
3306 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
|
3307 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
|
3308 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3309 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3310 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
|
3311 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3312 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3313 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
|
3314 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3315 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3316 val = AREF (work, FONT_FAMILY_INDEX); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3317 if (NILP (val) && STRINGP (attrs[LFACE_FAMILY_INDEX])) |
97822 | 3318 { |
3319 val = attrs[LFACE_FAMILY_INDEX]; | |
3320 val = font_intern_prop ((char *) SDATA (val), SBYTES (val), 1); | |
3321 } | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3322 if (NILP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3323 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3324 family = alloca ((sizeof family[0]) * 2); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3325 family[0] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3326 family[1] = null_vector; /* terminator. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3327 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3328 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3329 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3330 Lisp_Object alters |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3331 = 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
|
3332 /* 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
|
3333 #ifndef HAVE_NS |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3334 Qt |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3335 #else |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3336 Qnil |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3337 #endif |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3338 ); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3339 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3340 if (! NILP (alters)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3341 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3342 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
|
3343 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
|
3344 family[i] = XCAR (alters); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3345 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
|
3346 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3347 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3348 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3349 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3350 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3351 family = alloca ((sizeof family[0]) * 3); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3352 i = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3353 family[i++] = val; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3354 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
|
3355 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3356 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3357 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3358 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3359 |
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
|
3360 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
|
3361 { |
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
|
3362 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
|
3363 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
|
3364 { |
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
|
3365 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
|
3366 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
|
3367 { |
95890
e6e6c351339d
(font_find_for_lface): Fix typo of the previous change.
Kenichi Handa <handa@m17n.org>
parents:
95888
diff
changeset
|
3368 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
|
3369 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
|
3370 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3371 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
|
3372 entities = font_list_entities (frame, work); |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
3373 if (! NILP (entities)) |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3374 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3375 val = font_select_entity (frame, entities, |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3376 attrs, pixel_size, c); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3377 if (! NILP (val)) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
3378 return val; |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3379 } |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3380 } |
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
|
3381 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3382 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3383 } |
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
|
3384 return Qnil; |
90400 | 3385 } |
3386 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3387 |
90400 | 3388 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3389 font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_Object spec) |
90400 | 3390 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3391 int size; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3392 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3393 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
|
3394 && 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
|
3395 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
|
3396 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
|
3397 size = font_pixel_size (f, spec); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3398 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3399 { |
100985
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3400 double pt; |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3401 if (INTEGERP (attrs[LFACE_HEIGHT_INDEX])) |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3402 pt = XINT (attrs[LFACE_HEIGHT_INDEX]); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3403 else |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3404 { |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3405 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
|
3406 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
|
3407 if (INTEGERP (height)) |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3408 pt = XINT (height); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3409 else |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3410 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
|
3411 } |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3412 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3413 pt /= 10; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3414 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
|
3415 #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
|
3416 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
|
3417 { |
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
|
3418 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
|
3419 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
|
3420 } |
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
|
3421 #endif |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3422 } |
90400 | 3423 return font_open_entity (f, entity, size); |
3424 } | |
3425 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3426 |
94926 | 3427 /* Find a font satisfying SPEC and best matching with face's |
3428 attributes in ATTRS on FRAME, and return the opened | |
3429 font-object. */ | |
3430 | |
3431 Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3432 font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) |
90400 | 3433 { |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
3434 Lisp_Object entity, name; |
94926 | 3435 |
103037
e04bcedc08be
(font_load_for_lface): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
103019
diff
changeset
|
3436 entity = font_find_for_lface (f, attrs, spec, -1); |
94926 | 3437 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
|
3438 { |
94926 | 3439 /* No font is listed for SPEC, but each font-backend may have |
3440 the different criteria about "font matching". So, try | |
3441 it. */ | |
3442 entity = font_matching_entity (f, attrs, spec); | |
3443 if (NILP (entity)) | |
3444 return Qnil; | |
91350
9673276f310c
(font_load_for_face): Handle the case that the font in
Kenichi Handa <handa@m17n.org>
parents:
91337
diff
changeset
|
3445 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
3446 /* Don't loose the original name that was put in initially. We need |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
3447 it to re-apply the font when font parameters (like hinting or dpi) have |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
3448 changed. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
3449 entity = font_open_for_lface (f, entity, attrs, spec); |
106350
08b3f5b6e96d
(font_load_for_lface, font_open_by_name): Don't store name
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
106215
diff
changeset
|
3450 if (!NILP (entity)) |
08b3f5b6e96d
(font_load_for_lface, font_open_by_name): Don't store name
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
106215
diff
changeset
|
3451 { |
106750
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
3452 name = Ffont_get (spec, QCuser_spec); |
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
3453 if (STRINGP (name)) font_put_extra (entity, QCuser_spec, name); |
106350
08b3f5b6e96d
(font_load_for_lface, font_open_by_name): Don't store name
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
106215
diff
changeset
|
3454 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105877
diff
changeset
|
3455 return entity; |
90400 | 3456 } |
3457 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3458 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3459 /* 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
|
3460 |
90400 | 3461 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3462 font_prepare_for_face (FRAME_PTR f, struct face *face) |
90400 | 3463 { |
94926 | 3464 if (face->font->driver->prepare_face) |
3465 face->font->driver->prepare_face (f, face); | |
90400 | 3466 } |
3467 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3468 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3469 /* 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
|
3470 |
90400 | 3471 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3472 font_done_for_face (FRAME_PTR f, struct face *face) |
90400 | 3473 { |
94926 | 3474 if (face->font->driver->done_face) |
3475 face->font->driver->done_face (f, face); | |
90400 | 3476 face->extra = NULL; |
3477 } | |
3478 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3479 |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3480 /* 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
|
3481 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
|
3482 |
90400 | 3483 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3484 font_open_by_spec (FRAME_PTR f, Lisp_Object spec) |
90400 | 3485 { |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3486 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3487 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3488 /* 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
|
3489 a moderate font. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3490 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
|
3491 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
|
3492 = 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
|
3493 #ifndef HAVE_NS |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3494 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
|
3495 #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
|
3496 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
|
3497 #endif |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3498 attrs[LFACE_FONT_INDEX] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3499 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3500 return font_load_for_lface (f, attrs, spec); |
90400 | 3501 } |
3502 | |
3503 | |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3504 /* 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
|
3505 found, return Qnil. */ |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3506 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3507 Lisp_Object |
109748
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109735
diff
changeset
|
3508 font_open_by_name (FRAME_PTR f, const char *name) |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3509 { |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3510 Lisp_Object args[2]; |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
3511 Lisp_Object spec, ret; |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3512 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3513 args[0] = QCname; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3514 args[1] = make_unibyte_string (name, strlen (name)); |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3515 spec = Ffont_spec (2, args); |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
3516 ret = font_open_by_spec (f, spec); |
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
3517 /* Do not loose name originally put in. */ |
106350
08b3f5b6e96d
(font_load_for_lface, font_open_by_name): Don't store name
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
106215
diff
changeset
|
3518 if (!NILP (ret)) |
106750
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
3519 font_put_extra (ret, QCuser_spec, args[1]); |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
3520 |
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
3521 return ret; |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3522 } |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3523 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3524 |
90400 | 3525 /* Register font-driver DRIVER. This function is used in two ways. |
3526 | |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3527 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
|
3528 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
|
3529 (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
|
3530 an available font-driver. |
90400 | 3531 |
3532 The second is with frame F NULL. In this case, DRIVER is globally | |
3533 registered in the variable `font_driver_list'. All font-driver | |
3534 implementations must call this function in its syms_of_XXXX | |
3535 (e.g. syms_of_xfont). */ | |
3536 | |
3537 void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3538 register_font_driver (struct font_driver *driver, FRAME_PTR f) |
90400 | 3539 { |
3540 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; | |
3541 struct font_driver_list *prev, *list; | |
3542 | |
3543 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
|
3544 error ("Unusable font driver for a frame: %s", |
90400 | 3545 SDATA (SYMBOL_NAME (driver->type))); |
3546 | |
3547 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
|
3548 if (EQ (list->driver->type, driver->type)) |
90400 | 3549 error ("Duplicated font driver: %s", SDATA (SYMBOL_NAME (driver->type))); |
3550 | |
100103
c2ef1c8b2d64
(register_font_driver): Use xmalloc.
Andreas Schwab <schwab@suse.de>
parents:
99076
diff
changeset
|
3551 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
|
3552 list->on = 0; |
90400 | 3553 list->driver = driver; |
3554 list->next = NULL; | |
3555 if (prev) | |
3556 prev->next = list; | |
3557 else if (f) | |
3558 f->font_driver_list = list; | |
3559 else | |
3560 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
|
3561 if (! f) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
3562 num_font_drivers++; |
90400 | 3563 } |
3564 | |
100406
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3565 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3566 free_font_driver_list (FRAME_PTR f) |
100406
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3567 { |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3568 struct font_driver_list *list, *next; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3569 |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3570 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
|
3571 { |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3572 next = list->next; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3573 xfree (list); |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3574 } |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3575 f->font_driver_list = NULL; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3576 } |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3577 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3578 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3579 /* 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
|
3580 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
|
3581 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
|
3582 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3583 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
|
3584 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
|
3585 F. */ |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3586 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3587 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3588 font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3589 { |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3590 Lisp_Object active_drivers = Qnil; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3591 struct font_driver *driver; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3592 struct font_driver_list *list; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3593 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3594 /* 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
|
3595 drivers. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3596 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
|
3597 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3598 driver = list->driver; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3599 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
|
3600 != list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3601 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3602 if (list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3603 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3604 if (driver->end_for_frame) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3605 driver->end_for_frame (f); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3606 font_finish_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3607 list->on = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3608 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3609 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3610 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3611 if (! driver->start_for_frame |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3612 || driver->start_for_frame (f) == 0) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3613 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3614 font_prepare_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3615 list->on = 1; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3616 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3617 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3618 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3619 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3620 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3621 if (NILP (new_drivers)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3622 return Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3623 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3624 if (! EQ (new_drivers, Qt)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3625 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3626 /* 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
|
3627 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
|
3628 Lisp_Object tail; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3629 int i; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3630 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3631 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
|
3632 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
|
3633 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3634 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
|
3635 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
|
3636 break; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3637 if (list) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3638 list_table[i++] = list; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3639 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3640 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
|
3641 if (! list->on) |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
3642 list_table[i++] = list; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3643 list_table[i] = NULL; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3644 |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3645 next = &f->font_driver_list; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3646 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
|
3647 { |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3648 *next = list_table[i]; |
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3649 next = &(*next)->next; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3650 } |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3651 *next = NULL; |
103162
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3652 |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3653 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
|
3654 { /* 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
|
3655 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
|
3656 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
|
3657 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
|
3658 { |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3659 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
|
3660 eassert (! list->on); |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3661 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
|
3662 || 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
|
3663 { |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3664 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
|
3665 list->on = 1; |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3666 } |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3667 } |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3668 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3669 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3670 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3671 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
|
3672 if (list->on) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3673 active_drivers = nconc2 (active_drivers, |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3674 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
|
3675 return active_drivers; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3676 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3677 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3678 int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3679 font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data) |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3680 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3681 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
|
3682 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3683 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
|
3684 prev = list, list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3685 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3686 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3687 if (! data) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3688 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3689 if (list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3690 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3691 if (prev) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3692 prev->next = list->next; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3693 else |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3694 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
|
3695 xfree (list); |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3696 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3697 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3698 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3699 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3700 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3701 { |
100103
c2ef1c8b2d64
(register_font_driver): Use xmalloc.
Andreas Schwab <schwab@suse.de>
parents:
99076
diff
changeset
|
3702 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
|
3703 list->driver = driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3704 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
|
3705 f->font_data_list = list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3706 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3707 list->data = data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3708 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3709 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3710 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3711 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3712 void * |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3713 font_get_frame_data (FRAME_PTR f, struct font_driver *driver) |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3714 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3715 struct font_data_list *list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3716 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3717 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
|
3718 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3719 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3720 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3721 return NULL; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3722 return list->data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3723 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3724 |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3725 |
110989
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3726 /* Sets attributes on a font. Any properties that appear in ALIST and |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3727 BOOLEAN_PROPERTIES or NON_BOOLEAN_PROPERTIES are set on the font. |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3728 BOOLEAN_PROPERTIES and NON_BOOLEAN_PROPERTIES are NULL-terminated |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3729 arrays of strings. This function is intended for use by the font |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3730 drivers to implement their specific font_filter_properties. */ |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3731 void |
110997
b8fde5ef9e14
Merge changes from emacs-23 branch.
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
3732 font_filter_properties (Lisp_Object font, |
b8fde5ef9e14
Merge changes from emacs-23 branch.
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
3733 Lisp_Object alist, |
b8fde5ef9e14
Merge changes from emacs-23 branch.
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
3734 const char *boolean_properties[], |
b8fde5ef9e14
Merge changes from emacs-23 branch.
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
3735 const char *non_boolean_properties[]) |
110989
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3736 { |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3737 Lisp_Object it; |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3738 int i; |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3739 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3740 /* Set boolean values to Qt or Qnil */ |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3741 for (i = 0; boolean_properties[i] != NULL; ++i) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3742 for (it = alist; ! NILP (it); it = XCDR (it)) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3743 { |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3744 Lisp_Object key = XCAR (XCAR (it)); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3745 Lisp_Object val = XCDR (XCAR (it)); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3746 char *keystr = SDATA (SYMBOL_NAME (key)); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3747 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3748 if (strcmp (boolean_properties[i], keystr) == 0) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3749 { |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3750 const char *str = INTEGERP (val) ? (XINT (val) ? "true" : "false") |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3751 : SYMBOLP (val) ? (const char *) SDATA (SYMBOL_NAME (val)) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3752 : "true"; |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3753 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3754 if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3755 || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3756 || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3757 || strcmp ("Off", str) == 0) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3758 val = Qnil; |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3759 else |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3760 val = Qt; |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3761 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3762 Ffont_put (font, key, val); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3763 } |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3764 } |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3765 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3766 for (i = 0; non_boolean_properties[i] != NULL; ++i) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3767 for (it = alist; ! NILP (it); it = XCDR (it)) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3768 { |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3769 Lisp_Object key = XCAR (XCAR (it)); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3770 Lisp_Object val = XCDR (XCAR (it)); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3771 char *keystr = SDATA (SYMBOL_NAME (key)); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3772 if (strcmp (non_boolean_properties[i], keystr) == 0) |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3773 Ffont_put (font, key, val); |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3774 } |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3775 } |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3776 |
36726f009542
Fix handling of font properties on Windows (bug#6303).
Juanma Barranquero <lekktu@gmail.com>
parents:
110987
diff
changeset
|
3777 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3778 /* 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
|
3779 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
|
3780 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
|
3781 STRING. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3782 |
90541 | 3783 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3784 font_at (int c, EMACS_INT pos, struct face *face, struct window *w, Lisp_Object string) |
90541 | 3785 { |
3786 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
|
3787 int multibyte; |
94926 | 3788 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
|
3789 |
100173
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3790 multibyte = (NILP (string) |
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3791 ? ! NILP (current_buffer->enable_multibyte_characters) |
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3792 : 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
|
3793 if (c < 0) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3794 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3795 if (NILP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3796 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3797 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3798 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3799 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
|
3800 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3801 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
|
3802 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3803 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3804 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
|
3805 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3806 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3807 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3808 unsigned char *str; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3809 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3810 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
|
3811 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3812 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3813 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
|
3814 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3815 str = SDATA (string) + pos_byte; |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
106085
diff
changeset
|
3816 c = STRING_CHAR (str); |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3817 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3818 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3819 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
|
3820 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3821 } |
90541 | 3822 |
3823 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
|
3824 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
|
3825 return Qnil; |
90541 | 3826 if (! face) |
3827 { | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3828 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
|
3829 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
|
3830 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3831 if (STRINGP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3832 face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr, |
90541 | 3833 DEFAULT_FACE_ID, 0); |
3834 else | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3835 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
|
3836 pos + 100, 0, -1); |
90541 | 3837 face = FACE_FROM_ID (f, face_id); |
3838 } | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3839 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3840 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3841 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
|
3842 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
|
3843 } |
94926 | 3844 if (! face->font) |
90541 | 3845 return Qnil; |
94926 | 3846 |
3847 XSETFONT (font_object, face->font); | |
3848 return font_object; | |
3849 } | |
3850 | |
3851 | |
97822 | 3852 #ifdef HAVE_WINDOW_SYSTEM |
3853 | |
3854 /* Check how many characters after POS (at most to *LIMIT) can be | |
3855 displayed by the same font on the window W. FACE, if non-NULL, is | |
3856 the face selected for the character at POS. If STRING is not nil, | |
3857 it is the string to check instead of the current buffer. In that | |
3858 case, FACE must be not NULL. | |
3859 | |
3860 The return value is the font-object for the character at POS. | |
3861 *LIMIT is set to the position where that font can't be used. | |
3862 | |
3863 It is assured that the current buffer (or STRING) is multibyte. */ | |
3864 | |
3865 Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3866 font_range (EMACS_INT pos, EMACS_INT *limit, struct window *w, struct face *face, Lisp_Object string) |
94926 | 3867 { |
108548
c34421dab75e
font.c (font_range): Return the range for the font found at first.
Kenichi Handa <handa@etlken>
parents:
108004
diff
changeset
|
3868 EMACS_INT pos_byte, ignore; |
94926 | 3869 int c; |
97822 | 3870 Lisp_Object font_object = Qnil; |
94926 | 3871 |
3872 if (NILP (string)) | |
3873 { | |
3874 pos_byte = CHAR_TO_BYTE (pos); | |
97822 | 3875 if (! face) |
3876 { | |
3877 int face_id; | |
3878 | |
103114
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103041
diff
changeset
|
3879 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
|
3880 *limit, 0, -1); |
97822 | 3881 face = FACE_FROM_ID (XFRAME (w->frame), face_id); |
3882 } | |
94926 | 3883 } |
3884 else | |
3885 { | |
97822 | 3886 font_assert (face); |
94926 | 3887 pos_byte = string_char_to_byte (string, pos); |
3888 } | |
3889 | |
97822 | 3890 while (pos < *limit) |
94926 | 3891 { |
97822 | 3892 Lisp_Object category; |
94926 | 3893 |
3894 if (NILP (string)) | |
3895 FETCH_CHAR_ADVANCE_NO_CHECK (c, pos, pos_byte); | |
3896 else | |
3897 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, pos, pos_byte); | |
108548
c34421dab75e
font.c (font_range): Return the range for the font found at first.
Kenichi Handa <handa@etlken>
parents:
108004
diff
changeset
|
3898 category = CHAR_TABLE_REF (Vunicode_category_table, c); |
c34421dab75e
font.c (font_range): Return the range for the font found at first.
Kenichi Handa <handa@etlken>
parents:
108004
diff
changeset
|
3899 if (EQ (category, QCf) |
c34421dab75e
font.c (font_range): Return the range for the font found at first.
Kenichi Handa <handa@etlken>
parents:
108004
diff
changeset
|
3900 || CHAR_VARIATION_SELECTOR_P (c)) |
c34421dab75e
font.c (font_range): Return the range for the font found at first.
Kenichi Handa <handa@etlken>
parents:
108004
diff
changeset
|
3901 continue; |
97822 | 3902 if (NILP (font_object)) |
94926 | 3903 { |
97822 | 3904 font_object = font_for_char (face, c, pos - 1, string); |
3905 if (NILP (font_object)) | |
3906 return Qnil; | |
94926 | 3907 continue; |
3908 } | |
108548
c34421dab75e
font.c (font_range): Return the range for the font found at first.
Kenichi Handa <handa@etlken>
parents:
108004
diff
changeset
|
3909 if (font_encode_char (font_object, c) == FONT_INVALID_CODE) |
c34421dab75e
font.c (font_range): Return the range for the font found at first.
Kenichi Handa <handa@etlken>
parents:
108004
diff
changeset
|
3910 *limit = pos - 1; |
94926 | 3911 } |
97822 | 3912 return font_object; |
90541 | 3913 } |
97822 | 3914 #endif |
90541 | 3915 |
90400 | 3916 |
3917 /* Lisp API */ | |
3918 | |
94926 | 3919 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
|
3920 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. |
94926 | 3921 Return nil otherwise. |
3922 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
|
3923 which kind of font it is. It must be one of `font-spec', `font-entity', |
94926 | 3924 `font-object'. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
3925 (Lisp_Object object, Lisp_Object extra_type) |
90400 | 3926 { |
94926 | 3927 if (NILP (extra_type)) |
3928 return (FONTP (object) ? Qt : Qnil); | |
3929 if (EQ (extra_type, Qfont_spec)) | |
3930 return (FONT_SPEC_P (object) ? Qt : Qnil); | |
3931 if (EQ (extra_type, Qfont_entity)) | |
3932 return (FONT_ENTITY_P (object) ? Qt : Qnil); | |
3933 if (EQ (extra_type, Qfont_object)) | |
3934 return (FONT_OBJECT_P (object) ? Qt : Qnil); | |
3935 wrong_type_argument (intern ("font-extra-type"), extra_type); | |
90400 | 3936 } |
3937 | |
3938 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
|
3939 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
|
3940 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3941 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
|
3942 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
|
3943 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3944 `:family', `:weight', `:slant', `:width' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3945 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3946 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
|
3947 `set-face-attribute'. |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3948 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3949 `:foundry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3950 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3951 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
|
3952 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3953 `:adstyle' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3954 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3955 VALUE must be a string or a symbol specifying the additional |
94926 | 3956 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
|
3957 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3958 `:registry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3959 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3960 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
|
3961 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
|
3962 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3963 `:size' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3964 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3965 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
|
3966 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
|
3967 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
|
3968 |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
3969 `:name' |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
3970 |
96013
04be82e0cbd3
(Ffont_spec): Fix usage in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96012
diff
changeset
|
3971 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
|
3972 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3973 `:script' |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3974 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3975 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
|
3976 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
|
3977 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
|
3978 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3979 `:lang' |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3980 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3981 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
|
3982 e.g. `ja'. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3983 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3984 `:otf' |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3985 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3986 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
|
3987 required OpenType features. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3988 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3989 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
|
3990 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
|
3991 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
|
3992 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
|
3993 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
|
3994 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3995 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
|
3996 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
|
3997 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3998 For instance, if the VALUE is `(thai nil nil (mark))', the font must |
102085 | 3999 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
|
4000 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
|
4001 |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4002 usage: (font-spec ARGS...) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4003 (int nargs, Lisp_Object *args) |
90400 | 4004 { |
94926 | 4005 Lisp_Object spec = font_make_spec (); |
90400 | 4006 int i; |
4007 | |
4008 for (i = 0; i < nargs; i += 2) | |
4009 { | |
103229
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4010 Lisp_Object key = args[i], val; |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4011 |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4012 CHECK_SYMBOL (key); |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4013 if (i + 1 >= nargs) |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4014 error ("No value for key `%s'", SDATA (SYMBOL_NAME (key))); |
499a2bc2b600
(Ffont_spec): Check arguments.
Kenichi Handa <handa@m17n.org>
parents:
103162
diff
changeset
|
4015 val = args[i + 1]; |
90400 | 4016 |
94926 | 4017 if (EQ (key, QCname)) |
4018 { | |
4019 CHECK_STRING (val); | |
4020 font_parse_name ((char *) SDATA (val), spec); | |
4021 font_put_extra (spec, key, val); | |
4022 } | |
90400 | 4023 else |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
4024 { |
94926 | 4025 int idx = get_font_prop_index (key); |
4026 | |
4027 if (idx >= 0) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4028 { |
94926 | 4029 val = font_prop_validate (idx, Qnil, val); |
4030 if (idx < FONT_EXTRA_INDEX) | |
4031 ASET (spec, idx, val); | |
4032 else | |
4033 font_put_extra (spec, key, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4034 } |
94926 | 4035 else |
4036 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
|
4037 } |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
4038 } |
90400 | 4039 return spec; |
4040 } | |
4041 | |
94926 | 4042 DEFUN ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, |
4043 doc: /* Return a copy of FONT as a font-spec. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4044 (Lisp_Object font) |
94926 | 4045 { |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4046 Lisp_Object new_spec, tail, prev, extra; |
94926 | 4047 int i; |
4048 | |
4049 CHECK_FONT (font); | |
4050 new_spec = font_make_spec (); | |
4051 for (i = 1; i < FONT_EXTRA_INDEX; i++) | |
4052 ASET (new_spec, i, AREF (font, i)); | |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106185
diff
changeset
|
4053 extra = Fcopy_alist (AREF (font, FONT_EXTRA_INDEX)); |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4054 /* We must remove :font-entity property. */ |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4055 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
|
4056 if (EQ (XCAR (XCAR (tail)), QCfont_entity)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4057 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4058 if (NILP (prev)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4059 extra = XCDR (extra); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4060 else |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4061 XSETCDR (prev, XCDR (tail)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4062 break; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4063 } |
94926 | 4064 ASET (new_spec, FONT_EXTRA_INDEX, extra); |
4065 return new_spec; | |
4066 } | |
4067 | |
4068 DEFUN ("merge-font-spec", Fmerge_font_spec, Smerge_font_spec, 2, 2, 0, | |
4069 doc: /* Merge font-specs FROM and TO, and return a new font-spec. | |
4070 Every specified properties in FROM override the corresponding | |
4071 properties in TO. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4072 (Lisp_Object from, Lisp_Object to) |
94926 | 4073 { |
4074 Lisp_Object extra, tail; | |
4075 int i; | |
4076 | |
4077 CHECK_FONT (from); | |
4078 CHECK_FONT (to); | |
4079 to = Fcopy_font_spec (to); | |
4080 for (i = 0; i < FONT_EXTRA_INDEX; i++) | |
4081 ASET (to, i, AREF (from, i)); | |
4082 extra = AREF (to, FONT_EXTRA_INDEX); | |
4083 for (tail = AREF (from, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) | |
4084 if (! EQ (XCAR (XCAR (tail)), Qfont_entity)) | |
4085 { | |
4086 Lisp_Object slot = assq_no_quit (XCAR (XCAR (tail)), extra); | |
4087 | |
4088 if (! NILP (slot)) | |
4089 XSETCDR (slot, XCDR (XCAR (tail))); | |
4090 else | |
4091 extra = Fcons (Fcons (XCAR (XCAR (tail)), XCDR (XCAR (tail))), extra); | |
4092 } | |
4093 ASET (to, FONT_EXTRA_INDEX, extra); | |
4094 return to; | |
4095 } | |
90400 | 4096 |
4097 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
|
4098 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
|
4099 FONT is a font-spec, a font-entity, or a font-object. |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4100 KEY is any symbol, but these are reserved for specific meanings: |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4101 :family, :weight, :slant, :width, :foundry, :adstyle, :registry, |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4102 :size, :name, :script, :otf |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4103 See the documentation of `font-spec' for their meanings. |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4104 In addition, if FONT is a font-entity or a font-object, values of |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4105 :script and :otf are different from those of a font-spec as below: |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4106 |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4107 The value of :script may be a list of scripts that are supported by the font. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4108 |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4109 The value of :otf is a cons (GSUB . GPOS) where GSUB and GPOS are lists |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4110 representing the OpenType features supported by the font by this form: |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4111 ((SCRIPT (LANGSYS FEATURE ...) ...) ...) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4112 SCRIPT, LANGSYS, and FEATURE are all symbols representing OpenType |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4113 Layout tags. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4114 (Lisp_Object font, Lisp_Object key) |
90400 | 4115 { |
94926 | 4116 int idx; |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4117 Lisp_Object val; |
94926 | 4118 |
4119 CHECK_FONT (font); | |
4120 CHECK_SYMBOL (key); | |
4121 | |
4122 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
|
4123 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
|
4124 return font_style_symbolic (font, idx, 0); |
94926 | 4125 if (idx >= 0 && idx < FONT_EXTRA_INDEX) |
90400 | 4126 return AREF (font, idx); |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4127 val = Fassq (key, AREF (font, FONT_EXTRA_INDEX)); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4128 if (NILP (val) && EQ (key, QCotf) && FONT_OBJECT_P (font)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4129 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4130 struct font *fontp = XFONT_OBJECT (font); |
109386
1cbe0a6dbbc2
Do not record a font-entity in the property of font-object.
Kenichi Handa <handa@etlken>
parents:
109353
diff
changeset
|
4131 |
1cbe0a6dbbc2
Do not record a font-entity in the property of font-object.
Kenichi Handa <handa@etlken>
parents:
109353
diff
changeset
|
4132 if (fontp->driver->otf_capability) |
1cbe0a6dbbc2
Do not record a font-entity in the property of font-object.
Kenichi Handa <handa@etlken>
parents:
109353
diff
changeset
|
4133 val = fontp->driver->otf_capability (fontp); |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4134 else |
109386
1cbe0a6dbbc2
Do not record a font-entity in the property of font-object.
Kenichi Handa <handa@etlken>
parents:
109353
diff
changeset
|
4135 val = Fcons (Qnil, Qnil); |
1cbe0a6dbbc2
Do not record a font-entity in the property of font-object.
Kenichi Handa <handa@etlken>
parents:
109353
diff
changeset
|
4136 font_put_extra (font, QCotf, val); |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4137 } |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4138 else |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4139 val = Fcdr (val); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4140 return val; |
90400 | 4141 } |
4142 | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4143 #ifdef HAVE_WINDOW_SYSTEM |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4144 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4145 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
|
4146 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
|
4147 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
|
4148 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
|
4149 |
96012
c04088bb7b0d
(Ffont_face_attributes): Fix definition.
Andreas Schwab <schwab@suse.de>
parents:
96010
diff
changeset
|
4150 \(: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
|
4151 |
96014
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4152 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
|
4153 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
|
4154 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
|
4155 |
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4156 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
|
4157 are to be displayed on. If omitted, the selected frame is used. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4158 (Lisp_Object font, Lisp_Object frame) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4159 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4160 struct frame *f; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4161 Lisp_Object plist[10]; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4162 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
|
4163 int n = 0; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4164 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4165 if (NILP (frame)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4166 frame = selected_frame; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4167 CHECK_LIVE_FRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4168 f = XFRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4169 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4170 if (STRINGP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4171 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4172 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
|
4173 Lisp_Object name = font; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4174 if (fontset >= 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4175 font = fontset_ascii (fontset); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4176 font = font_spec_from_name (name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4177 if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4178 signal_error ("Invalid font name", name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4179 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4180 else if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4181 signal_error ("Invalid font object", font); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4182 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4183 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
|
4184 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4185 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4186 plist[n++] = QCfamily; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4187 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
|
4188 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4189 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4190 val = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4191 if (INTEGERP (val)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4192 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4193 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
|
4194 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
|
4195 plist[n++] = QCheight; |
96227
f9eb9f0d6678
(Ffont_face_attributes): Multiply pixel size before point
Jason Rumney <jasonr@gnu.org>
parents:
96224
diff
changeset
|
4196 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
|
4197 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4198 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
|
4199 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4200 plist[n++] = QCheight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4201 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
|
4202 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4203 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4204 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
|
4205 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4206 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4207 plist[n++] = QCweight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4208 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4209 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4210 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4211 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
|
4212 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4213 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4214 plist[n++] = QCslant; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4215 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4216 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4217 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4218 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
|
4219 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4220 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4221 plist[n++] = QCwidth; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4222 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4223 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4224 |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4225 return Flist (n, plist); |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4226 } |
90400 | 4227 |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4228 #endif |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4229 |
90400 | 4230 DEFUN ("font-put", Ffont_put, Sfont_put, 3, 3, 0, |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4231 doc: /* Set one property of FONT: give property KEY value VAL. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4232 FONT is a font-spec, a font-entity, or a font-object. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4233 |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4234 If FONT is a font-spec, KEY can be any symbol. But if KEY is the one |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4235 accepted by the function `font-spec' (which see), VAL must be what |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4236 allowed in `font-spec'. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4237 |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4238 If FONT is a font-entity or a font-object, KEY must not be the one |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4239 accepted by `font-spec'. */) |
109351 | 4240 (Lisp_Object font, Lisp_Object prop, Lisp_Object val) |
90400 | 4241 { |
94926 | 4242 int idx; |
90400 | 4243 |
94926 | 4244 idx = get_font_prop_index (prop); |
4245 if (idx >= 0 && idx < FONT_EXTRA_INDEX) | |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4246 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4247 CHECK_FONT_SPEC (font); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4248 ASET (font, idx, font_prop_validate (idx, Qnil, val)); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4249 } |
90400 | 4250 else |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4251 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4252 if (EQ (prop, QCname) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4253 || EQ (prop, QCscript) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4254 || EQ (prop, QClang) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4255 || EQ (prop, QCotf)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4256 CHECK_FONT_SPEC (font); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4257 else |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4258 CHECK_FONT (font); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4259 font_put_extra (font, prop, font_prop_validate (0, prop, val)); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4260 } |
90400 | 4261 return val; |
4262 } | |
4263 | |
4264 DEFUN ("list-fonts", Flist_fonts, Slist_fonts, 1, 4, 0, | |
4265 doc: /* List available fonts matching FONT-SPEC on the current frame. | |
4266 Optional 2nd argument FRAME specifies the target frame. | |
4267 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
|
4268 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
|
4269 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
|
4270 how close they are to PREFER. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4271 (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer) |
90400 | 4272 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4273 Lisp_Object vec, list; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4274 int n = 0; |
90400 | 4275 |
4276 if (NILP (frame)) | |
4277 frame = selected_frame; | |
4278 CHECK_LIVE_FRAME (frame); | |
94926 | 4279 CHECK_FONT_SPEC (font_spec); |
90400 | 4280 if (! NILP (num)) |
4281 { | |
4282 CHECK_NUMBER (num); | |
4283 n = XINT (num); | |
4284 if (n <= 0) | |
4285 return Qnil; | |
4286 } | |
4287 if (! NILP (prefer)) | |
94926 | 4288 CHECK_FONT_SPEC (prefer); |
90400 | 4289 |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4290 list = font_list_entities (frame, font_spec); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4291 if (NILP (list)) |
90400 | 4292 return Qnil; |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4293 if (NILP (XCDR (list)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4294 && ASIZE (XCAR (list)) == 1) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4295 return Fcons (AREF (XCAR (list), 0), Qnil); |
90400 | 4296 |
4297 if (! NILP (prefer)) | |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4298 vec = font_sort_entities (list, prefer, frame, 0); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4299 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4300 vec = font_vconcat_entity_vectors (list); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4301 if (n == 0 || n >= ASIZE (vec)) |
90400 | 4302 { |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4303 Lisp_Object args[2]; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4304 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4305 args[0] = vec; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4306 args[1] = Qnil; |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4307 list = Fappend (2, args); |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4308 } |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4309 else |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4310 { |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4311 for (list = Qnil, n--; n >= 0; n--) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
4312 list = Fcons (AREF (vec, n), list); |
90400 | 4313 } |
4314 return list; | |
4315 } | |
4316 | |
94926 | 4317 DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0, |
90400 | 4318 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
|
4319 Optional argument FRAME, if non-nil, specifies the target frame. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4320 (Lisp_Object frame) |
90400 | 4321 { |
4322 FRAME_PTR f; | |
4323 struct font_driver_list *driver_list; | |
4324 Lisp_Object list; | |
4325 | |
4326 if (NILP (frame)) | |
4327 frame = selected_frame; | |
4328 CHECK_LIVE_FRAME (frame); | |
4329 f = XFRAME (frame); | |
4330 list = Qnil; | |
4331 for (driver_list = f->font_driver_list; driver_list; | |
4332 driver_list = driver_list->next) | |
4333 if (driver_list->driver->list_family) | |
4334 { | |
4335 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
|
4336 Lisp_Object tail = list; |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4337 |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4338 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
|
4339 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
|
4340 && SYMBOLP (XCAR (val))) |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4341 list = Fcons (SYMBOL_NAME (XCAR (val)), list); |
90400 | 4342 } |
4343 return list; | |
4344 } | |
4345 | |
4346 DEFUN ("find-font", Ffind_font, Sfind_font, 1, 2, 0, | |
4347 doc: /* Return a font-entity matching with FONT-SPEC on the current frame. | |
4348 Optional 2nd argument FRAME, if non-nil, specifies the target frame. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4349 (Lisp_Object font_spec, Lisp_Object frame) |
90400 | 4350 { |
4351 Lisp_Object val = Flist_fonts (font_spec, frame, make_number (1), Qnil); | |
4352 | |
4353 if (CONSP (val)) | |
4354 val = XCAR (val); | |
4355 return val; | |
4356 } | |
4357 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4358 DEFUN ("font-xlfd-name", Ffont_xlfd_name, Sfont_xlfd_name, 1, 2, 0, |
90400 | 4359 doc: /* Return XLFD name of FONT. |
4360 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
|
4361 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
|
4362 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
|
4363 the consecutive wildcards are folded to one. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4364 (Lisp_Object font, Lisp_Object fold_wildcards) |
90400 | 4365 { |
4366 char name[256]; | |
4367 int pixel_size = 0; | |
4368 | |
94926 | 4369 CHECK_FONT (font); |
4370 | |
4371 if (FONT_OBJECT_P (font)) | |
90400 | 4372 { |
94926 | 4373 Lisp_Object font_name = AREF (font, FONT_NAME_INDEX); |
4374 | |
4375 if (STRINGP (font_name) | |
4376 && 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
|
4377 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4378 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
|
4379 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
|
4380 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
|
4381 goto done; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4382 } |
94926 | 4383 pixel_size = XFONT_OBJECT (font)->pixel_size; |
90400 | 4384 } |
4385 if (font_unparse_xlfd (font, pixel_size, name, 256) < 0) | |
4386 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
|
4387 done: |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4388 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
|
4389 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4390 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
|
4391 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4392 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
|
4393 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4394 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
|
4395 p0 = p1; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4396 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4397 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4398 |
90400 | 4399 return build_string (name); |
4400 } | |
4401 | |
4402 DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0, | |
4403 doc: /* Clear font cache. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4404 (void) |
90400 | 4405 { |
4406 Lisp_Object list, frame; | |
4407 | |
4408 FOR_EACH_FRAME (list, frame) | |
4409 { | |
4410 FRAME_PTR f = XFRAME (frame); | |
4411 struct font_driver_list *driver_list = f->font_driver_list; | |
4412 | |
4413 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
|
4414 if (driver_list->on) |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4415 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4416 Lisp_Object cache = driver_list->driver->get_cache (f); |
106618
431b202f351d
(Fclear_font_cache): Pass correct cache argument to
Andreas Schwab <schwab@linux-m68k.org>
parents:
106433
diff
changeset
|
4417 Lisp_Object val, tmp; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4418 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4419 val = XCDR (cache); |
91909 | 4420 while (! NILP (val) |
4421 && ! 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
|
4422 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
|
4423 font_assert (! NILP (val)); |
106618
431b202f351d
(Fclear_font_cache): Pass correct cache argument to
Andreas Schwab <schwab@linux-m68k.org>
parents:
106433
diff
changeset
|
4424 tmp = XCDR (XCAR (val)); |
431b202f351d
(Fclear_font_cache): Pass correct cache argument to
Andreas Schwab <schwab@linux-m68k.org>
parents:
106433
diff
changeset
|
4425 if (XINT (XCAR (tmp)) == 0) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4426 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4427 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
|
4428 XSETCDR (cache, XCDR (val)); |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4429 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4430 } |
90400 | 4431 } |
4432 | |
4433 return Qnil; | |
4434 } | |
4435 | |
97822 | 4436 |
4437 void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
4438 font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object) |
90400 | 4439 { |
97822 | 4440 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
|
4441 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
|
4442 /* 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
|
4443 EMACS_INT ecode = font->driver->encode_char (font, LGLYPH_CHAR (glyph)); |
97822 | 4444 struct font_metrics metrics; |
4445 | |
97853
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4446 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
|
4447 code = ecode; |
97822 | 4448 font->driver->text_extents (font, &code, 1, &metrics); |
4449 LGLYPH_SET_LBEARING (glyph, metrics.lbearing); | |
4450 LGLYPH_SET_RBEARING (glyph, metrics.rbearing); | |
4451 LGLYPH_SET_WIDTH (glyph, metrics.width); | |
4452 LGLYPH_SET_ASCENT (glyph, metrics.ascent); | |
4453 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
|
4454 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4455 |
97822 | 4456 |
4457 DEFUN ("font-shape-gstring", Ffont_shape_gstring, Sfont_shape_gstring, 1, 1, 0, | |
4458 doc: /* Shape the glyph-string GSTRING. | |
4459 Shaping means substituting glyphs and/or adjusting positions of glyphs | |
4460 to get the correct visual image of character sequences set in the | |
4461 header of the glyph-string. | |
4462 | |
4463 If the shaping was successful, the value is GSTRING itself or a newly | |
4464 created glyph-string. Otherwise, the value is nil. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4465 (Lisp_Object gstring) |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4466 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4467 struct font *font; |
97822 | 4468 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
|
4469 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
|
4470 |
97822 | 4471 if (! composition_gstring_p (gstring)) |
4472 signal_error ("Invalid glyph-string: ", gstring); | |
4473 if (! NILP (LGSTRING_ID (gstring))) | |
4474 return gstring; | |
4475 font_object = LGSTRING_FONT (gstring); | |
4476 CHECK_FONT_OBJECT (font_object); | |
94926 | 4477 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
|
4478 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
|
4479 return Qnil; |
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4480 |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4481 /* 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
|
4482 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
|
4483 { |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4484 n = font->driver->shape (gstring); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4485 if (INTEGERP (n)) |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4486 break; |
97822 | 4487 gstring = larger_vector (gstring, |
4488 ASIZE (gstring) + LGSTRING_GLYPH_LEN (gstring), | |
4489 Qnil); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4490 } |
97822 | 4491 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
|
4492 return Qnil; |
109493
f69d90096f33
font.c (Ffont_shape_gstring): Terminate GSTRING by nil if the number of glyphs gets smaller than the original length.
Kenichi Handa <handa@etlken>
parents:
109386
diff
changeset
|
4493 if (XINT (n) < LGSTRING_GLYPH_LEN (gstring)) |
f69d90096f33
font.c (Ffont_shape_gstring): Terminate GSTRING by nil if the number of glyphs gets smaller than the original length.
Kenichi Handa <handa@etlken>
parents:
109386
diff
changeset
|
4494 LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil); |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4495 |
97822 | 4496 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
|
4497 from = LGLYPH_FROM (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4498 to = LGLYPH_TO (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4499 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
|
4500 { |
97822 | 4501 Lisp_Object this = LGSTRING_GLYPH (gstring, i); |
4502 | |
4503 if (NILP (this)) | |
4504 break; | |
4505 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
|
4506 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4507 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4508 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4509 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4510 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4511 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4512 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4513 } |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4514 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4515 to = LGLYPH_TO (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4516 j = i; |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4517 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4518 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4519 { |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4520 if (from > LGLYPH_FROM (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4521 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4522 if (to < LGLYPH_TO (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4523 to = LGLYPH_TO (this); |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4524 } |
90541 | 4525 } |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4526 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4527 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4528 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4529 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4530 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4531 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4532 } |
97822 | 4533 return composition_gstring_put_cache (gstring, XINT (n)); |
90400 | 4534 } |
4535 | |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4536 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
|
4537 2, 2, 0, |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4538 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
|
4539 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
|
4540 where |
110987
cda2045a5ee8
Fix typos in docstrings, comments and ChangeLogs.
Juanma Barranquero <lekktu@gmail.com>
parents:
107242
diff
changeset
|
4541 VARIATION-SELECTOR is a character code of variation selection |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4542 (#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
|
4543 GLYPH-ID is a glyph code of the corresponding variation glyph. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4544 (Lisp_Object font_object, Lisp_Object character) |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4545 { |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4546 unsigned variations[256]; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4547 struct font *font; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4548 int i, n; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4549 Lisp_Object val; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4550 |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4551 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
|
4552 CHECK_CHARACTER (character); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4553 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
|
4554 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
|
4555 return Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4556 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
|
4557 if (! n) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4558 return Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4559 val = Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4560 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
|
4561 if (variations[i]) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4562 { |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4563 Lisp_Object code; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4564 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
|
4565 /* Stops GCC whining about limited range of data type. */ |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4566 EMACS_INT var = variations[i]; |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4567 |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4568 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
|
4569 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
|
4570 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
|
4571 else |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4572 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
|
4573 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
|
4574 } |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4575 return val; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4576 } |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4577 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4578 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4579 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4580 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
|
4581 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
|
4582 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
|
4583 (SCRIPT LANGSYS GSUB GPOS) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4584 where |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4585 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
|
4586 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
|
4587 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
|
4588 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4589 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
|
4590 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4591 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
|
4592 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
|
4593 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
|
4594 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
|
4595 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
|
4596 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4597 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
|
4598 the glyph-string GSTRING-IN. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4599 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4600 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
|
4601 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
|
4602 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
|
4603 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4604 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
|
4605 the value is 0. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4606 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4607 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
|
4608 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
|
4609 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4610 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
|
4611 glyph-string. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4612 (Lisp_Object otf_features, Lisp_Object gstring_in, Lisp_Object from, Lisp_Object to, Lisp_Object gstring_out, Lisp_Object index) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4613 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4614 Lisp_Object font_object = LGSTRING_FONT (gstring_in); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4615 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4616 struct font *font; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4617 int len, num; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4618 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4619 check_otf_features (otf_features); |
94926 | 4620 CHECK_FONT_OBJECT (font_object); |
4621 font = XFONT_OBJECT (font_object); | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4622 if (! font->driver->otf_drive) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4623 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
|
4624 SDATA (SYMBOL_NAME (font->driver->type))); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4625 CHECK_CONS (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4626 CHECK_SYMBOL (XCAR (otf_features)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4627 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4628 CHECK_SYMBOL (XCAR (val)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4629 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4630 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4631 CHECK_CONS (val); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4632 len = check_gstring (gstring_in); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4633 CHECK_VECTOR (gstring_out); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4634 CHECK_NATNUM (from); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4635 CHECK_NATNUM (to); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4636 CHECK_NATNUM (index); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4637 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4638 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
|
4639 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
|
4640 if (XINT (index) >= ASIZE (gstring_out)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4641 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
|
4642 num = font->driver->otf_drive (font, otf_features, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4643 gstring_in, XINT (from), XINT (to), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4644 gstring_out, XINT (index), 0); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4645 if (num < 0) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4646 return Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4647 return make_number (num); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4648 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4649 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4650 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
|
4651 3, 3, 0, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4652 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
|
4653 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
|
4654 in this format: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4655 (SCRIPT LANGSYS FEATURE ...) |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4656 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
|
4657 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4658 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
|
4659 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
|
4660 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
|
4661 corresponding character. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4662 (Lisp_Object font_object, Lisp_Object character, Lisp_Object otf_features) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4663 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4664 struct font *font; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4665 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
|
4666 Lisp_Object alternates; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4667 int i, num; |
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 CHECK_FONT_GET_OBJECT (font_object, font); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4670 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
|
4671 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
|
4672 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
|
4673 CHECK_CHARACTER (character); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4674 CHECK_CONS (otf_features); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4675 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4676 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
|
4677 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
|
4678 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
|
4679 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
|
4680 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
|
4681 gstring_out, 0, 1)) < 0) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4682 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
|
4683 make_number (ASIZE (gstring_out) * 2)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4684 alternates = Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4685 for (i = 0; i < num; i++) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4686 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4687 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
|
4688 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
|
4689 unsigned code = LGLYPH_CODE (g); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4690 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4691 alternates = Fcons (Fcons (make_number (code), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4692 c > 0 ? make_number (c) : Qnil), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4693 alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4694 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4695 return Fnreverse (alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4696 } |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4697 #endif /* 0 */ |
90400 | 4698 |
4699 #ifdef FONT_DEBUG | |
4700 | |
4701 DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, | |
4702 doc: /* Open FONT-ENTITY. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4703 (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame) |
90400 | 4704 { |
4705 int isize; | |
4706 | |
4707 CHECK_FONT_ENTITY (font_entity); | |
4708 if (NILP (frame)) | |
4709 frame = selected_frame; | |
4710 CHECK_LIVE_FRAME (frame); | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4711 |
94926 | 4712 if (NILP (size)) |
4713 isize = XINT (AREF (font_entity, FONT_SIZE_INDEX)); | |
4714 else | |
4715 { | |
4716 CHECK_NUMBER_OR_FLOAT (size); | |
4717 if (FLOATP (size)) | |
100165
7add351b47c9
(Fopen_font): Compute pixel size correctly.
Chong Yidong <cyd@stupidchicken.com>
parents:
100126
diff
changeset
|
4718 isize = POINT_TO_PIXEL (XFLOAT_DATA (size), XFRAME (frame)->resy); |
94926 | 4719 else |
4720 isize = XINT (size); | |
4721 if (isize == 0) | |
4722 isize = 120; | |
4723 } | |
90400 | 4724 return font_open_entity (XFRAME (frame), font_entity, isize); |
4725 } | |
4726 | |
4727 DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, | |
4728 doc: /* Close FONT-OBJECT. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4729 (Lisp_Object font_object, Lisp_Object frame) |
90400 | 4730 { |
4731 CHECK_FONT_OBJECT (font_object); | |
4732 if (NILP (frame)) | |
4733 frame = selected_frame; | |
4734 CHECK_LIVE_FRAME (frame); | |
4735 font_close_object (XFRAME (frame), font_object); | |
4736 return Qnil; | |
4737 } | |
4738 | |
4739 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
|
4740 doc: /* Return information about FONT-OBJECT. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4741 The value is a vector: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4742 [ 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
|
4743 CAPABILITY ] |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4744 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4745 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
|
4746 provide a name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4747 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4748 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
|
4749 doesn't provide a file name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4750 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4751 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
|
4752 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4753 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
|
4754 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4755 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
|
4756 pixels. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4757 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4758 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
|
4759 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
|
4760 remaining elements describe the details of the font capability. |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4761 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4762 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
|
4763 \(opentype GSUB GPOS) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4764 where GSUB shows which "GSUB" features the font supports, and GPOS |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4765 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
|
4766 lists of the format: |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4767 \((SCRIPT (LANGSYS FEATURE ...) ...) ...) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4768 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4769 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
|
4770 one. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4771 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4772 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
|
4773 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4774 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
|
4775 representing the default langsys. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4776 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4777 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
|
4778 |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4779 If the font is not OpenType font, CAPABILITY is nil. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4780 (Lisp_Object font_object) |
90400 | 4781 { |
4782 struct font *font; | |
4783 Lisp_Object val; | |
4784 | |
4785 CHECK_FONT_GET_OBJECT (font_object, font); | |
4786 | |
4787 val = Fmake_vector (make_number (9), Qnil); | |
94926 | 4788 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); |
4789 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); | |
90400 | 4790 ASET (val, 2, make_number (font->pixel_size)); |
94926 | 4791 ASET (val, 3, make_number (font->max_width)); |
90400 | 4792 ASET (val, 4, make_number (font->ascent)); |
4793 ASET (val, 5, make_number (font->descent)); | |
94926 | 4794 ASET (val, 6, make_number (font->space_width)); |
4795 ASET (val, 7, make_number (font->average_width)); | |
90400 | 4796 if (font->driver->otf_capability) |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4797 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font))); |
90400 | 4798 return val; |
4799 } | |
4800 | |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4801 DEFUN ("font-get-glyphs", Ffont_get_glyphs, Sfont_get_glyphs, 3, 4, 0, |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4802 doc: |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4803 /* Return a vector of FONT-OBJECT's glyphs for the specified characters. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4804 FROM and TO are positions (integers or markers) specifying a region |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4805 of the current buffer. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4806 If the optional fourth arg OBJECT is not nil, it is a string or a |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4807 vector containing the target characters. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4808 |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4809 Each element is a vector containing information of a glyph in this format: |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4810 [FROM-IDX TO-IDX C CODE WIDTH LBEARING RBEARING ASCENT DESCENT ADJUSTMENT] |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4811 where |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4812 FROM is an index numbers of a character the glyph corresponds to. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4813 TO is the same as FROM. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4814 C is the character of the glyph. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4815 CODE is the glyph-code of C in FONT-OBJECT. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4816 WIDTH thru DESCENT are the metrics (in pixels) of the glyph. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4817 ADJUSTMENT is always nil. |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4818 If FONT-OBJECT doesn't have a glyph for a character, |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4819 the corresponding element is nil. */) |
109351 | 4820 (Lisp_Object font_object, Lisp_Object from, Lisp_Object to, |
4821 Lisp_Object object) | |
90400 | 4822 { |
4823 struct font *font; | |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4824 int i, len, c; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4825 Lisp_Object *chars, vec; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4826 USE_SAFE_ALLOCA; |
90400 | 4827 |
4828 CHECK_FONT_GET_OBJECT (font_object, font); | |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4829 if (NILP (object)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4830 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4831 EMACS_INT charpos, bytepos; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4832 |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4833 validate_region (&from, &to); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4834 if (EQ (from, to)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4835 return Qnil; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4836 len = XFASTINT (to) - XFASTINT (from); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4837 SAFE_ALLOCA_LISP (chars, len); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4838 charpos = XFASTINT (from); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4839 bytepos = CHAR_TO_BYTE (charpos); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4840 for (i = 0; charpos < XFASTINT (to); i++) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4841 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4842 FETCH_CHAR_ADVANCE (c, charpos, bytepos); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4843 chars[i] = make_number (c); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4844 } |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4845 } |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4846 else if (STRINGP (object)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4847 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4848 const unsigned char *p; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4849 |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4850 CHECK_NUMBER (from); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4851 CHECK_NUMBER (to); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4852 if (XINT (from) < 0 || XINT (from) > XINT (to) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4853 || XINT (to) > SCHARS (object)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4854 args_out_of_range_3 (object, from, to); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4855 if (EQ (from, to)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4856 return Qnil; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4857 len = XFASTINT (to) - XFASTINT (from); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4858 SAFE_ALLOCA_LISP (chars, len); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4859 p = SDATA (object); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4860 if (STRING_MULTIBYTE (object)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4861 for (i = 0; i < len; i++) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4862 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4863 c = STRING_CHAR_ADVANCE (p); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4864 chars[i] = make_number (c); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4865 } |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4866 else |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4867 for (i = 0; i < len; i++) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4868 chars[i] = make_number (p[i]); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4869 } |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4870 else |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4871 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4872 CHECK_VECTOR (object); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4873 CHECK_NUMBER (from); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4874 CHECK_NUMBER (to); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4875 if (XINT (from) < 0 || XINT (from) > XINT (to) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4876 || XINT (to) > ASIZE (object)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4877 args_out_of_range_3 (object, from, to); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4878 if (EQ (from, to)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4879 return Qnil; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4880 len = XFASTINT (to) - XFASTINT (from); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4881 for (i = 0; i < len; i++) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4882 { |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4883 Lisp_Object elt = AREF (object, XFASTINT (from) + i); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4884 CHECK_CHARACTER (elt); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4885 } |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4886 chars = &(AREF (object, XFASTINT (from))); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4887 } |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4888 |
90400 | 4889 vec = Fmake_vector (make_number (len), Qnil); |
4890 for (i = 0; i < len; i++) | |
4891 { | |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4892 Lisp_Object g; |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4893 int c = XFASTINT (chars[i]); |
90400 | 4894 unsigned code; |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4895 EMACS_INT cod; |
90400 | 4896 struct font_metrics metrics; |
4897 | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4898 cod = code = font->driver->encode_char (font, c); |
90400 | 4899 if (code == FONT_INVALID_CODE) |
4900 continue; | |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4901 g = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4902 LGLYPH_SET_FROM (g, i); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4903 LGLYPH_SET_TO (g, i); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4904 LGLYPH_SET_CHAR (g, c); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4905 LGLYPH_SET_CODE (g, code); |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4906 font->driver->text_extents (font, &code, 1, &metrics); |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4907 LGLYPH_SET_WIDTH (g, metrics.width); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4908 LGLYPH_SET_LBEARING (g, metrics.lbearing); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4909 LGLYPH_SET_RBEARING (g, metrics.rbearing); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4910 LGLYPH_SET_ASCENT (g, metrics.ascent); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4911 LGLYPH_SET_DESCENT (g, metrics.descent); |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4912 ASET (vec, i, g); |
90400 | 4913 } |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4914 if (! VECTORP (object)) |
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
4915 SAFE_FREE (); |
90400 | 4916 return vec; |
4917 } | |
4918 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4919 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
|
4920 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
|
4921 FONT is a font-spec, font-entity, or font-object. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4922 (Lisp_Object spec, Lisp_Object font) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4923 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4924 CHECK_FONT_SPEC (spec); |
94926 | 4925 CHECK_FONT (font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4926 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4927 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
|
4928 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4929 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4930 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
|
4931 doc: /* Return a font-object for displaying a character at POSITION. |
90541 | 4932 Optional second arg WINDOW, if non-nil, is a window displaying |
4933 the current buffer. It defaults to the currently selected window. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4934 (Lisp_Object position, Lisp_Object window, Lisp_Object string) |
90541 | 4935 { |
4936 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
|
4937 EMACS_INT pos; |
90541 | 4938 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4939 if (NILP (string)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4940 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4941 CHECK_NUMBER_COERCE_MARKER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4942 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4943 if (pos < BEGV || pos >= ZV) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4944 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
|
4945 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4946 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4947 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4948 CHECK_NUMBER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4949 CHECK_STRING (string); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4950 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4951 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
|
4952 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
|
4953 } |
90541 | 4954 if (NILP (window)) |
4955 window = selected_window; | |
4956 CHECK_LIVE_WINDOW (window); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4957 w = XWINDOW (window); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4958 |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4959 return font_at (-1, pos, NULL, w, string); |
90541 | 4960 } |
4961 | |
90400 | 4962 #if 0 |
4963 DEFUN ("draw-string", Fdraw_string, Sdraw_string, 2, 2, 0, | |
4964 doc: /* Draw STRING by FONT-OBJECT on the top left corner of the current frame. | |
4965 The value is a number of glyphs drawn. | |
4966 Type C-l to recover what previously shown. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
4967 (Lisp_Object font_object, Lisp_Object string) |
90400 | 4968 { |
4969 Lisp_Object frame = selected_frame; | |
4970 FRAME_PTR f = XFRAME (frame); | |
4971 struct font *font; | |
4972 struct face *face; | |
4973 int i, len, width; | |
4974 unsigned *code; | |
4975 | |
4976 CHECK_FONT_GET_OBJECT (font_object, font); | |
4977 CHECK_STRING (string); | |
4978 len = SCHARS (string); | |
4979 code = alloca (sizeof (unsigned) * len); | |
4980 for (i = 0; i < len; i++) | |
4981 { | |
4982 Lisp_Object ch = Faref (string, make_number (i)); | |
4983 Lisp_Object val; | |
4984 int c = XINT (ch); | |
4985 | |
4986 code[i] = font->driver->encode_char (font, c); | |
4987 if (code[i] == FONT_INVALID_CODE) | |
4988 break; | |
4989 } | |
4990 face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
4991 face->fontp = font; | |
4992 if (font->driver->prepare_face) | |
4993 font->driver->prepare_face (f, face); | |
4994 width = font->driver->text_extents (font, code, i, NULL); | |
4995 len = font->driver->draw_text (f, face, 0, font->ascent, code, i, width); | |
4996 if (font->driver->done_face) | |
4997 font->driver->done_face (f, face); | |
4998 face->fontp = NULL; | |
4999 return make_number (len); | |
5000 } | |
5001 #endif | |
5002 | |
5003 #endif /* FONT_DEBUG */ | |
5004 | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5005 #ifdef HAVE_WINDOW_SYSTEM |
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5006 |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5007 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
|
5008 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
|
5009 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
|
5010 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
|
5011 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
|
5012 where |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5013 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
|
5014 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
|
5015 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
|
5016 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
|
5017 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
|
5018 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
|
5019 how to compose characters. |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5020 If the named font is not yet loaded, return nil. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
5021 (Lisp_Object name, Lisp_Object frame) |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5022 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5023 FRAME_PTR f; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5024 struct font *font; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5025 Lisp_Object info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5026 Lisp_Object font_object; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5027 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5028 (*check_window_system_func) (); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5029 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5030 if (! FONTP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5031 CHECK_STRING (name); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5032 if (NILP (frame)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5033 frame = selected_frame; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5034 CHECK_LIVE_FRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5035 f = XFRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5036 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5037 if (STRINGP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5038 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5039 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
|
5040 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5041 if (fontset >= 0) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5042 name = fontset_ascii (fontset); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5043 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
|
5044 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5045 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
|
5046 font_object = name; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5047 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
|
5048 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
|
5049 else |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5050 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5051 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
|
5052 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
|
5053 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5054 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
|
5055 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5056 if (NILP (font_object)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5057 return Qnil; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5058 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
|
5059 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5060 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
|
5061 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
|
5062 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
|
5063 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
|
5064 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
|
5065 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
|
5066 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
|
5067 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
|
5068 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5069 #if 0 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5070 /* 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
|
5071 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
|
5072 by `reference-count'. */ |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5073 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
|
5074 #endif |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5075 return info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5076 } |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5077 #endif |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5078 |
90400 | 5079 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5080 #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
|
5081 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
|
5082 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5083 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
5084 build_style_table (const struct table_entry *entry, int nelement) |
95176
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 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
|
5087 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
|
5088 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5089 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
|
5090 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
|
5091 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5092 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
|
5093 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
|
5094 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
|
5095 for (j = 0; entry[i].names[j]; j++) |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105872
diff
changeset
|
5096 ASET (elt, j + 1, intern_c_string (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
|
5097 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
|
5098 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5099 return table; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5100 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5101 |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5102 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
|
5103 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5104 /* 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
|
5105 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
|
5106 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
|
5107 static Lisp_Object Vfont_log_deferred; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5108 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5109 /* 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
|
5110 `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
|
5111 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
|
5112 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
|
5113 void |
109717
8949aad5e992
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109637
diff
changeset
|
5114 font_add_log (const char *action, Lisp_Object arg, Lisp_Object result) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5115 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5116 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
|
5117 int i; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5118 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5119 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
|
5120 return; |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5121 if (STRINGP (AREF (Vfont_log_deferred, 0))) |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5122 { |
97822 | 5123 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
|
5124 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5125 ASET (Vfont_log_deferred, 0, Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5126 font_add_log (str, AREF (Vfont_log_deferred, 1), |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5127 AREF (Vfont_log_deferred, 2)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5128 } |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5129 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5130 if (FONTP (arg)) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5131 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5132 Lisp_Object tail, elt; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5133 Lisp_Object equalstr = build_string ("="); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5134 |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5135 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
|
5136 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
|
5137 tail = XCDR (tail)) |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5138 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5139 elt = XCAR (tail); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5140 if (EQ (XCAR (elt), QCscript) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5141 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5142 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
|
5143 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
|
5144 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
|
5145 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5146 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
|
5147 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
|
5148 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
|
5149 && 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
|
5150 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
|
5151 concat2 (equalstr, |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5152 SYMBOL_NAME (XCAR (XCDR (elt))))); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5153 } |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5154 arg = val; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5155 } |
103889
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5156 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5157 if (CONSP (result) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5158 && VECTORP (XCAR (result)) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5159 && ASIZE (XCAR (result)) > 0 |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5160 && FONTP (AREF (XCAR (result), 0))) |
82ad563e96ed
(font_vconcat_entity_vectors): New function.
Kenichi Handa <handa@m17n.org>
parents:
103548
diff
changeset
|
5161 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
|
5162 if (FONTP (result)) |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5163 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5164 val = Ffont_xlfd_name (result, Qt); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5165 if (! FONT_SPEC_P (result)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5166 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
|
5167 build_string (":"), val); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5168 result = val; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5169 } |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5170 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
|
5171 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5172 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
|
5173 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
|
5174 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5175 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
|
5176 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
|
5177 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
|
5178 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
|
5179 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5180 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5181 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
|
5182 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5183 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
|
5184 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
|
5185 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5186 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
|
5187 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
|
5188 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
|
5189 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
|
5190 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5191 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5192 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
|
5193 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5194 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5195 /* 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
|
5196 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
|
5197 as font_add_log. */ |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5198 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5199 void |
109717
8949aad5e992
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109637
diff
changeset
|
5200 font_deferred_log (const char *action, Lisp_Object arg, Lisp_Object result) |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5201 { |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5202 if (EQ (Vfont_log, Qt)) |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5203 return; |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5204 ASET (Vfont_log_deferred, 0, build_string (action)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5205 ASET (Vfont_log_deferred, 1, arg); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5206 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
|
5207 } |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5208 |
90400 | 5209 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
5210 syms_of_font (void) |
90400 | 5211 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5212 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
|
5213 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
|
5214 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
|
5215 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
|
5216 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
|
5217 /* Note that the other elements in sort_shift_bits are not used. */ |
90400 | 5218 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5219 staticpro (&font_charset_alist); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5220 font_charset_alist = Qnil; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5221 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
5222 DEFSYM (Qopentype, "opentype"); |
90400 | 5223 |
95699 | 5224 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
|
5225 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
|
5226 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
|
5227 DEFSYM (Qunicode_bmp, "unicode-bmp"); |
90622
bb9362e3a03b
(Qunicode_sip): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90590
diff
changeset
|
5228 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
|
5229 |
97822 | 5230 DEFSYM (QCf, "Cf"); |
5231 | |
90400 | 5232 DEFSYM (QCotf, ":otf"); |
94926 | 5233 DEFSYM (QClang, ":lang"); |
90400 | 5234 DEFSYM (QCscript, ":script"); |
91125
6c9a19ff6c55
(Qfontp): Remove unused symbol.
Jason Rumney <jasonr@gnu.org>
parents:
91112
diff
changeset
|
5235 DEFSYM (QCantialias, ":antialias"); |
90400 | 5236 |
5237 DEFSYM (QCfoundry, ":foundry"); | |
5238 DEFSYM (QCadstyle, ":adstyle"); | |
5239 DEFSYM (QCregistry, ":registry"); | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
5240 DEFSYM (QCspacing, ":spacing"); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
5241 DEFSYM (QCdpi, ":dpi"); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5242 DEFSYM (QCscalable, ":scalable"); |
94926 | 5243 DEFSYM (QCavgwidth, ":avgwidth"); |
5244 DEFSYM (QCfont_entity, ":font-entity"); | |
5245 DEFSYM (QCfc_unknown_spec, ":fc-unknown-spec"); | |
90400 | 5246 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5247 DEFSYM (Qc, "c"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5248 DEFSYM (Qm, "m"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5249 DEFSYM (Qp, "p"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5250 DEFSYM (Qd, "d"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5251 |
103011
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5252 DEFSYM (Qja, "ja"); |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5253 DEFSYM (Qko, "ko"); |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5254 |
106750
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
5255 DEFSYM (QCuser_spec, "user-spec"); |
10b9609fb6b7
Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents:
106618
diff
changeset
|
5256 |
90400 | 5257 staticpro (&null_vector); |
5258 null_vector = Fmake_vector (make_number (0), Qnil); | |
5259 | |
5260 staticpro (&scratch_font_spec); | |
5261 scratch_font_spec = Ffont_spec (0, NULL); | |
5262 staticpro (&scratch_font_prefer); | |
5263 scratch_font_prefer = Ffont_spec (0, NULL); | |
5264 | |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5265 staticpro (&Vfont_log_deferred); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5266 Vfont_log_deferred = Fmake_vector (make_number (3), Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5267 |
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 #ifdef HAVE_LIBOTF |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5270 staticpro (&otf_list); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5271 otf_list = Qnil; |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5272 #endif /* HAVE_LIBOTF */ |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5273 #endif /* 0 */ |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5274 |
90400 | 5275 defsubr (&Sfontp); |
5276 defsubr (&Sfont_spec); | |
5277 defsubr (&Sfont_get); | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
5278 #ifdef HAVE_WINDOW_SYSTEM |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
5279 defsubr (&Sfont_face_attributes); |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
5280 #endif |
90400 | 5281 defsubr (&Sfont_put); |
5282 defsubr (&Slist_fonts); | |
94926 | 5283 defsubr (&Sfont_family_list); |
90400 | 5284 defsubr (&Sfind_font); |
5285 defsubr (&Sfont_xlfd_name); | |
5286 defsubr (&Sclear_font_cache); | |
97822 | 5287 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
|
5288 defsubr (&Sfont_variation_glyphs); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5289 #if 0 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5290 defsubr (&Sfont_drive_otf); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
5291 defsubr (&Sfont_otf_alternates); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5292 #endif /* 0 */ |
90400 | 5293 |
5294 #ifdef FONT_DEBUG | |
5295 defsubr (&Sopen_font); | |
5296 defsubr (&Sclose_font); | |
5297 defsubr (&Squery_font); | |
109349
c82f3023b7f2
Make font-get to get :otf value dynamically from a font-object.
Kenichi Handa <handa@etlken>
parents:
109032
diff
changeset
|
5298 defsubr (&Sfont_get_glyphs); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5299 defsubr (&Sfont_match_p); |
90541 | 5300 defsubr (&Sfont_at); |
90400 | 5301 #if 0 |
5302 defsubr (&Sdraw_string); | |
5303 #endif | |
5304 #endif /* FONT_DEBUG */ | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5305 #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
|
5306 defsubr (&Sfont_info); |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5307 #endif |
90400 | 5308 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5309 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
|
5310 doc: /* |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5311 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
|
5312 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
|
5313 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
|
5314 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
|
5315 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
5316 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
|
5317 \(REGEXP . ENCODING). |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5318 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5319 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
|
5320 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
|
5321 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
|
5322 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
|
5323 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5324 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
|
5325 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
|
5326 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
|
5327 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
|
5328 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
|
5329 Vfont_encoding_alist = Qnil; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5330 |
108004
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5331 /* FIXME: These 3 vars are not quite what they appear: setq on them |
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5332 won't have any effect other than disconnect them from the style |
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5333 table used by the font display code. So we make them read-only, |
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5334 to avoid this confusing situation. */ |
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5335 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5336 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
|
5337 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
|
5338 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
|
5339 [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
|
5340 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
|
5341 Vfont_weight_table = BUILD_STYLE_TABLE (weight_table); |
108004
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5342 XSYMBOL (intern_c_string ("font-weight-table"))->constant = 1; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5343 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5344 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
|
5345 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
|
5346 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
|
5347 Vfont_slant_table = BUILD_STYLE_TABLE (slant_table); |
108004
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5348 XSYMBOL (intern_c_string ("font-slant-table"))->constant = 1; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5349 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5350 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
|
5351 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
|
5352 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
|
5353 Vfont_width_table = BUILD_STYLE_TABLE (width_table); |
108004
9d210d83ed69
* font.c (syms_of_font): Make the style table vars read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107242
diff
changeset
|
5354 XSYMBOL (intern_c_string ("font-width-table"))->constant = 1; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5355 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5356 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
|
5357 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
|
5358 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
|
5359 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
|
5360 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
|
5361 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5362 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
|
5363 *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
|
5364 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
|
5365 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
|
5366 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
|
5367 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
|
5368 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5369 #ifdef HAVE_WINDOW_SYSTEM |
90400 | 5370 #ifdef HAVE_FREETYPE |
94926 | 5371 syms_of_ftfont (); |
90400 | 5372 #ifdef HAVE_X_WINDOWS |
94926 | 5373 syms_of_xfont (); |
5374 syms_of_ftxfont (); | |
90400 | 5375 #ifdef HAVE_XFT |
94926 | 5376 syms_of_xftfont (); |
90400 | 5377 #endif /* HAVE_XFT */ |
5378 #endif /* HAVE_X_WINDOWS */ | |
5379 #else /* not HAVE_FREETYPE */ | |
5380 #ifdef HAVE_X_WINDOWS | |
94926 | 5381 syms_of_xfont (); |
90400 | 5382 #endif /* HAVE_X_WINDOWS */ |
5383 #endif /* not HAVE_FREETYPE */ | |
5384 #ifdef HAVE_BDFFONT | |
94926 | 5385 syms_of_bdffont (); |
90400 | 5386 #endif /* HAVE_BDFFONT */ |
5387 #ifdef WINDOWSNT | |
94926 | 5388 syms_of_w32font (); |
90400 | 5389 #endif /* WINDOWSNT */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5390 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5391 syms_of_nsfont (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5392 #endif /* HAVE_NS */ |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5393 #endif /* HAVE_WINDOW_SYSTEM */ |
90400 | 5394 } |
90427 | 5395 |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5396 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
5397 init_font (void) |
103548
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5398 { |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5399 Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt; |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5400 } |
1a45bb782f72
(font_sort_entities, font_list_entities)
Kenichi Handa <handa@m17n.org>
parents:
103369
diff
changeset
|
5401 |
90427 | 5402 /* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846 |
5403 (do not change this comment) */ |