Mercurial > hg > xemacs-beta
annotate src/fontcolor-xlike-inc.c @ 5533:11da5b828d10
shell-command and shell-command-on-region API compliant with FSF 23.3.1
| author | Mats Lidell <mats.lidell@cag.se> |
|---|---|
| date | Sun, 31 Jul 2011 01:29:09 +0200 |
| parents | 308d34e9f07d |
| children | 0bd991c31cd1 |
| rev | line source |
|---|---|
|
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
1 /* Common code between X and GTK -- fonts and colors. |
| 3659 | 2 Copyright (C) 1991-5, 1997 Free Software Foundation, Inc. |
| 3 Copyright (C) 1995 Sun Microsystems, Inc. | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
4 Copyright (C) 1996, 2001, 2002, 2003, 2010 Ben Wing. |
| 3659 | 5 |
| 6 This file is part of XEmacs. | |
| 7 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5196
diff
changeset
|
8 XEmacs is free software: you can redistribute it and/or modify it |
| 3659 | 9 under the terms of the GNU General Public License as published by the |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5196
diff
changeset
|
10 Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5196
diff
changeset
|
11 option) any later version. |
| 3659 | 12 |
| 13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 16 for more details. | |
| 17 | |
| 18 You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5196
diff
changeset
|
19 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 3659 | 20 |
| 21 /* Synched up with: Not in FSF. */ | |
| 22 | |
|
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
23 /* Before including this file, you need to define either THIS_IS_X or |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
24 THIS_IS_GTK. */ |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
25 |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
26 /* See comment at top of console-xlike-inc.h for an explanation of |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
27 how this file works. */ |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
28 |
| 3659 | 29 /* Pango is ready for prime-time now, as far as I understand it. The GTK |
| 30 people should be using that. Oh well. (Aidan Kehoe, Sat Nov 4 12:41:12 | |
| 31 CET 2006) */ | |
| 32 | |
|
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
33 #include "console-xlike-inc.h" |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
34 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
35 #ifdef DEBUG_XEMACS |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
36 # define DEBUG_FONTS1(format, arg) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
37 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
38 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
39 debug_out (format, arg); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
40 } while (0) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
41 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
42 # define DEBUG_FONTS2(format, arg1, arg2) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
43 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
44 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
45 debug_out (format, arg1, arg2); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
46 } while (0) |
| 3659 | 47 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
48 # define DEBUG_FONTS3(format, arg1, arg2, arg3) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
49 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
50 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
51 debug_out (format, arg1, arg2, arg3); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
52 } while (0) |
| 3659 | 53 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
54 # define DEBUG_FONTS4(format, arg1, arg2, arg3, arg4) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
55 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
56 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
57 debug_out (format, arg1, arg2, arg3, arg4); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
58 } while (0) |
| 3659 | 59 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
60 # define DEBUG_FONTS_LISP1(format, arg) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
61 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
62 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
63 debug_out_lisp (format, 1, arg); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
64 } while (0) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
65 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
66 # define DEBUG_FONTS_LISP2(format, arg1, arg2) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
67 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
68 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
69 debug_out_lisp (format, 2, arg1, arg2); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
70 } while (0) |
| 3659 | 71 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
72 # define DEBUG_FONTS_LISP3(format, arg1, arg2, arg3) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
73 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
74 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
75 debug_out_lisp (format, 3, arg1, arg2, arg3); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
76 } while (0) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
77 |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
78 # define DEBUG_FONTS_LISP4(format, arg1, arg2, arg3, arg4) \ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
79 do { \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
80 if (debug_x_fonts) \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
81 debug_out_lisp (format, 4, arg1, arg2, arg3, arg4); \ |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
82 } while (0) |
|
5196
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
83 #else /* not DEBUG_XEMACS */ |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
84 # define DEBUG_FONTS1(format, arg) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
85 # define DEBUG_FONTS2(format, arg1, arg2) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
86 # define DEBUG_FONTS3(format, arg1, arg2, arg3) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
87 # define DEBUG_FONTS4(format, arg1, arg2, arg3, arg4) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
88 # define DEBUG_FONTS_LISP1(format, arg) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
89 # define DEBUG_FONTS_LISP2(format, arg1, arg2) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
90 # define DEBUG_FONTS_LISP3(format, arg1, arg2, arg3) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
91 # define DEBUG_FONTS_LISP4(format, arg1, arg2, arg3, arg4) |
|
c87ec061e8cc
Fix compilation --without-debug.
Didier Verna <didier@xemacs.org>
parents:
5189
diff
changeset
|
92 #endif |
| 3659 | 93 |
| 94 #ifdef MULE | |
| 95 | |
| 96 /* For some code it's reasonable to have only one copy and conditionalize | |
| 97 at run-time. For other code it isn't. */ | |
| 98 | |
| 99 static int | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
100 count_hyphens (const Ibyte *str, Bytecount length, Ibyte **last_hyphen) |
| 3659 | 101 { |
| 102 int hyphen_count = 0; | |
| 103 const Ibyte *hyphening = str; | |
| 104 const Ibyte *new_hyphening; | |
| 105 | |
| 106 for (hyphen_count = 0; | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
107 NULL != (new_hyphening = (Ibyte *) memchr ((const void *)hyphening, '-', length)); |
| 3659 | 108 hyphen_count++) |
| 109 { | |
| 110 ++new_hyphening; | |
| 111 length -= new_hyphening - hyphening; | |
| 112 hyphening = new_hyphening; | |
| 113 } | |
| 114 | |
| 115 if (NULL != last_hyphen) | |
| 116 { | |
| 117 *last_hyphen = (Ibyte *)hyphening; | |
| 118 } | |
| 119 | |
| 120 return hyphen_count; | |
| 121 } | |
| 122 | |
| 123 static int | |
|
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
124 XFUN (font_spec_matches_charset) (struct device * USED_IF_XFT (d), |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
125 Lisp_Object charset, |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
126 const Ibyte *nonreloc, Lisp_Object reloc, |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
127 Bytecount offset, Bytecount length, |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
128 enum font_specifier_matchspec_stages stage) |
| 3659 | 129 { |
| 130 Lisp_Object registries = Qnil; | |
| 131 long i, registries_len; | |
| 132 const Ibyte *the_nonreloc; | |
| 133 Bytecount the_length; | |
| 134 | |
| 135 the_nonreloc = nonreloc; | |
| 136 the_length = length; | |
| 137 | |
| 138 if (!the_nonreloc) | |
| 139 the_nonreloc = XSTRING_DATA (reloc); | |
| 140 fixup_internal_substring (nonreloc, reloc, offset, &the_length); | |
| 141 the_nonreloc += offset; | |
| 142 | |
| 143 #ifdef USE_XFT | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
144 if (stage == STAGE_FINAL) |
| 3659 | 145 { |
| 146 Display *dpy = DEVICE_X_DISPLAY (d); | |
| 147 Extbyte *extname; | |
| 148 XftFont *rf; | |
| 149 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
150 if (!NILP (reloc)) |
| 3659 | 151 { |
| 152 the_nonreloc = XSTRING_DATA (reloc); | |
|
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
153 extname = LISP_STRING_TO_EXTERNAL (reloc, Qx_font_name_encoding); |
| 3659 | 154 rf = xft_open_font_by_name (dpy, extname); |
| 155 return 0; /* #### maybe this will compile and run ;) */ | |
| 156 /* Jesus, Stephen, what the fuck? */ | |
| 157 } | |
| 158 } | |
| 159 #endif | |
| 160 | |
| 161 /* Hmm, this smells bad. */ | |
|
4353
4143b78d0df0
Merge an old patch of Ben's, involving font instantiation and charsets.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4124
diff
changeset
|
162 if (NILP (charset)) |
| 3659 | 163 return 1; |
| 164 | |
| 165 /* Hack! Short font names don't have the registry in them, | |
| 166 so we just assume the user knows what they're doing in the | |
| 167 case of ASCII. For other charsets, you gotta give the | |
| 168 long form; sorry buster. | |
| 169 #### FMH: this screws fontconfig/Xft? | |
| 170 STRATEGY: use fontconfig's ability to hack languages and character | |
| 171 sets (lang and charset properties). | |
| 172 #### Maybe we can use the fontconfig model to eliminate the difference | |
| 173 between faces and fonts? No - it looks like that would be an abuse | |
| 174 (fontconfig doesn't know about colors, although Xft does). | |
| 175 */ | |
| 176 if (EQ (charset, Vcharset_ascii) && | |
| 177 (!memchr (the_nonreloc, '*', the_length)) | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
178 && (5 > (count_hyphens (the_nonreloc, the_length, NULL)))) |
| 3659 | 179 { |
| 180 return 1; | |
| 181 } | |
| 182 | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
183 if (STAGE_FINAL == stage) |
| 3659 | 184 { |
| 185 registries = Qunicode_registries; | |
| 186 } | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
187 else if (STAGE_INITIAL == stage) |
| 3659 | 188 { |
| 189 registries = XCHARSET_REGISTRIES (charset); | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
190 if (NILP (registries)) |
| 3659 | 191 { |
| 192 return 0; | |
| 193 } | |
| 194 } | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
195 else assert (0); |
| 3659 | 196 |
| 197 CHECK_VECTOR (registries); | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
198 registries_len = XVECTOR_LENGTH (registries); |
| 3659 | 199 |
| 200 for (i = 0; i < registries_len; ++i) | |
| 201 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
202 if (!(STRINGP (XVECTOR_DATA (registries)[i])) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
203 || (XSTRING_LENGTH (XVECTOR_DATA (registries)[i]) > the_length)) |
| 3659 | 204 { |
| 205 continue; | |
| 206 } | |
| 207 | |
| 208 /* Check if the font spec ends in the registry specified. X11 says | |
| 209 this comparison is case insensitive: XLFD, section 3.11: | |
| 210 | |
| 211 "Alphabetic case distinctions are allowed but are for human | |
| 212 readability concerns only. Conforming X servers will perform | |
| 213 matching on font name query or open requests independent of case." */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
214 if (0 == qxestrcasecmp (XSTRING_DATA (XVECTOR_DATA (registries)[i]), |
| 3659 | 215 the_nonreloc + (the_length - |
| 216 XSTRING_LENGTH | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
217 (XVECTOR_DATA (registries)[i])))) |
| 3659 | 218 { |
| 219 return 1; | |
| 220 } | |
| 221 } | |
| 222 return 0; | |
| 223 } | |
| 224 | |
| 225 static Lisp_Object | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
226 xlistfonts_checking_charset (Lisp_Object device, const Ibyte *xlfd, |
| 3659 | 227 Lisp_Object charset, |
| 228 enum font_specifier_matchspec_stages stage) | |
| 229 { | |
| 230 Extbyte **names; | |
| 231 Lisp_Object result = Qnil; | |
| 232 int count = 0, i; | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
233 DECLARE_EISTRING (ei_single_result); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
234 Extbyte *fontext; |
| 3659 | 235 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
236 DEBUG_FONTS2 ("xlistfonts_checking_charset called, XLFD %s stage %s", |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
237 xlfd, stage == STAGE_INITIAL ? "initial" : "final"); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
238 DEBUG_FONTS_LISP1 (" charset %s\n", charset); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
239 fontext = ITEXT_TO_EXTERNAL (xlfd, Qx_font_name_encoding); |
|
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
240 names = XListFonts (GET_XLIKE_DISPLAY (XDEVICE (device)), |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
241 fontext, MAX_FONT_COUNT, &count); |
| 3659 | 242 |
| 243 for (i = 0; i < count; ++i) | |
| 244 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
245 eireset (ei_single_result); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
246 eicpy_ext (ei_single_result, names[i], Qx_font_name_encoding); |
| 3659 | 247 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
248 if (DEVMETH_OR_GIVEN (XDEVICE (device), font_spec_matches_charset, |
| 3659 | 249 (XDEVICE (device), charset, |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
250 eidata (ei_single_result), Qnil, 0, |
| 3659 | 251 -1, stage), 0)) |
| 252 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
253 result = eimake_string (ei_single_result); |
| 3659 | 254 break; |
| 255 } | |
| 256 } | |
| 257 | |
| 258 if (names) | |
| 259 { | |
| 260 XFreeFontNames (names); | |
| 261 } | |
| 262 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
263 DEBUG_FONTS_LISP1 ("xlistfonts_checking_charset returns %s\n", result); |
| 3659 | 264 return result; |
| 265 } | |
| 266 | |
| 267 #ifdef USE_XFT | |
| 268 /* #### debug functions: find a better place for us */ | |
| 269 const char *FcResultToString (FcResult r); | |
| 270 const char * | |
| 271 FcResultToString (FcResult r) | |
| 272 { | |
| 273 static char buffer[256]; | |
| 274 switch (r) | |
| 275 { | |
| 276 case FcResultMatch: | |
| 277 return "FcResultMatch"; | |
| 278 case FcResultNoMatch: | |
| 279 return "FcResultNoMatch"; | |
| 280 case FcResultTypeMismatch: | |
| 281 return "FcResultTypeMismatch"; | |
| 282 case FcResultNoId: | |
| 283 return "FcResultNoId"; | |
| 284 default: | |
| 285 snprintf (buffer, 255, "FcResultUndocumentedValue (%d)", r); | |
| 286 return buffer; | |
| 287 } | |
| 288 } | |
| 289 | |
| 290 const char *FcTypeOfValueToString (FcValue v); | |
| 291 const char * | |
| 292 FcTypeOfValueToString (FcValue v) | |
| 293 { | |
| 294 static char buffer[256]; | |
| 295 switch (v.type) | |
| 296 { | |
| 297 case FcTypeMatrix: | |
| 298 return "FcTypeMatrix"; | |
| 299 case FcTypeString: | |
| 300 return "FcTypeString"; | |
| 301 case FcTypeVoid: | |
| 302 return "FcTypeVoid"; | |
| 303 case FcTypeDouble: | |
| 304 return "FcTypeDouble"; | |
| 305 case FcTypeInteger: | |
| 306 return "FcTypeInteger"; | |
| 307 case FcTypeBool: | |
| 308 return "FcTypeBool"; | |
| 309 case FcTypeCharSet: | |
| 310 return "FcTypeCharSet"; | |
| 311 case FcTypeLangSet: | |
| 312 return "FcTypeLangSet"; | |
| 313 /* #### There is no union member of this type, but there are void* and | |
| 314 FcPattern* members, as of fontconfig.h FC_VERSION 10002 */ | |
| 315 case FcTypeFTFace: | |
| 316 return "FcTypeFTFace"; | |
| 317 default: | |
| 318 snprintf (buffer, 255, "FcTypeUndocumentedType (%d)", v.type); | |
| 319 return buffer; | |
| 320 } | |
| 321 } | |
| 322 | |
| 323 static FcCharSet * | |
| 324 mule_to_fc_charset (Lisp_Object cs) | |
| 325 { | |
| 326 int ucode, i, j; | |
| 327 FcCharSet *fccs; | |
| 328 | |
| 329 CHECK_CHARSET (cs); | |
| 330 fccs = FcCharSetCreate (); | |
| 331 /* #### do we also need to deal with 94 vs. 96 charsets? | |
| 332 ie, how are SP and DEL treated in ASCII? non-graphic should return -1 */ | |
| 333 if (1 == XCHARSET_DIMENSION (cs)) | |
| 334 /* Unicode tables are indexed by offsets from ASCII SP, not by ASCII */ | |
| 335 for (i = 0; i < 96; i++) | |
| 336 { | |
| 337 ucode = ((int *) XCHARSET_TO_UNICODE_TABLE (cs))[i]; | |
| 338 if (ucode >= 0) | |
| 339 /* #### should check for allocation failure */ | |
| 340 FcCharSetAddChar (fccs, (FcChar32) ucode); | |
| 341 } | |
| 342 else if (2 == XCHARSET_DIMENSION (cs)) | |
| 343 /* Unicode tables are indexed by offsets from ASCII SP, not by ASCII */ | |
| 344 for (i = 0; i < 96; i++) | |
| 345 for (j = 0; j < 96; j++) | |
| 346 { | |
| 347 ucode = ((int **) XCHARSET_TO_UNICODE_TABLE (cs))[i][j]; | |
| 348 if (ucode >= 0) | |
| 349 /* #### should check for allocation failure */ | |
| 350 FcCharSetAddChar (fccs, (FcChar32) ucode); | |
| 351 } | |
| 352 else | |
| 353 { | |
| 354 FcCharSetDestroy (fccs); | |
| 355 fccs = NULL; | |
| 356 } | |
| 357 return fccs; | |
| 358 } | |
| 359 | |
| 360 struct charset_reporter { | |
| 361 Lisp_Object *charset; | |
| 362 /* This is a debug facility, require ASCII. */ | |
| 4932 | 363 const Ascbyte *language; /* ASCII, please */ |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
364 /* Technically this is FcChar8, but fsckin' GCC 4 bitches. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
365 RFC 3066 is a combination of ISO 639 and ISO 3166. */ |
| 4932 | 366 const Ascbyte *rfc3066; /* ASCII, please */ |
| 3659 | 367 }; |
| 368 | |
| 369 static struct charset_reporter charset_table[] = | |
| 370 { | |
| 371 /* #### It's my branch, my favorite charsets get checked first! | |
| 372 That's a joke, Son. | |
| 373 Ie, I don't know what I'm doing, so my charsets first is as good as | |
| 374 any other arbitrary order. If you have a better idea, speak up! */ | |
| 375 { &Vcharset_ascii, "English", "en" }, | |
| 376 { &Vcharset_japanese_jisx0208, "Japanese", "ja" }, | |
| 377 { &Vcharset_japanese_jisx0212, "Japanese", "ja" }, | |
| 378 { &Vcharset_katakana_jisx0201, "Japanese", "ja" }, | |
| 379 { &Vcharset_latin_jisx0201, "Japanese", "ja" }, | |
| 380 { &Vcharset_japanese_jisx0208_1978, "Japanese", "ja" }, | |
| 381 { &Vcharset_greek_iso8859_7, "Greek", "el" }, | |
| 382 /* #### all the Chinese need checking | |
| 383 Damn the blood-sucking ISO anyway. */ | |
|
4756
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
384 { &Vcharset_chinese_gb2312, "simplified Chinese", "zh-cn" }, |
| 3659 | 385 { &Vcharset_korean_ksc5601, "Korean", "ko" }, |
|
4756
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
386 { &Vcharset_chinese_cns11643_1, "traditional Chinese", "zh-tw" }, |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
387 { &Vcharset_chinese_cns11643_2, "traditional Chinese", "zh-tw" }, |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
388 /* #### not obvious how to handle these |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
389 We could (for experimental purposes) make the last element into |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
390 an array of ISO 639 codes, and check for all of them. If a font |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
391 provides some but not others, warn. */ |
| 3659 | 392 { &Vcharset_latin_iso8859_1, NULL, NULL }, |
| 393 { &Vcharset_latin_iso8859_2, NULL, NULL }, | |
| 394 { &Vcharset_latin_iso8859_3, NULL, NULL }, | |
| 395 { &Vcharset_latin_iso8859_4, NULL, NULL }, | |
| 396 { &Vcharset_latin_iso8859_9, NULL, NULL }, | |
| 397 { &Vcharset_latin_iso8859_15, NULL, NULL }, | |
|
4756
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
398 { &Vcharset_thai_tis620, "Thai", "th" }, |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
399 /* We don't have an arabic charset. bidi issues, I guess? */ |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
400 /* { &Vcharset_arabic_iso8859_6, "Arabic", "ar" }, */ |
| 3659 | 401 { &Vcharset_hebrew_iso8859_8, "Hebrew", "he" }, |
|
4756
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
402 /* #### probably close enough for Ukraine? */ |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
403 { &Vcharset_cyrillic_iso8859_5, "Russian", "ru" }, |
| 3659 | 404 /* #### these probably are not quite right */ |
|
4756
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
405 { &Vcharset_chinese_big5_1, "traditional Chinese", "zh-tw" }, |
|
5d67242595a8
Update charset_table used by Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4494
diff
changeset
|
406 { &Vcharset_chinese_big5_2, "traditional Chinese", "zh-tw" }, |
| 3659 | 407 { NULL, NULL, NULL } |
| 408 }; | |
| 409 | |
| 410 /* Choose appropriate font name for debug messages. | |
| 411 Use only in the top half of next function (enforced with #undef). */ | |
| 412 #define DECLARE_DEBUG_FONTNAME(__xemacs_name) \ | |
| 413 Eistring *__xemacs_name; \ | |
| 414 do \ | |
| 415 { \ | |
| 416 __xemacs_name = debug_xft > 2 ? eistr_fullname \ | |
| 417 : debug_xft > 1 ? eistr_longname \ | |
| 418 : eistr_shortname; \ | |
| 419 } while (0) | |
| 420 | |
| 421 static Lisp_Object | |
| 422 xft_find_charset_font (Lisp_Object font, Lisp_Object charset, | |
| 423 enum font_specifier_matchspec_stages stage) | |
| 424 { | |
| 425 const Extbyte *patternext; | |
| 426 Lisp_Object result = Qnil; | |
| 427 | |
| 428 /* #### with Xft need to handle second stage here -- sjt | |
| 429 Hm. Or maybe not. That would be cool. :-) */ | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
430 if (stage == STAGE_FINAL) |
| 3659 | 431 return Qnil; |
| 432 | |
| 433 /* Fontconfig converts all FreeType names to UTF-8 before passing them | |
| 434 back to callers---see fcfreetype.c (FcFreeTypeQuery). | |
| 435 I don't believe this is documented. */ | |
| 436 | |
| 437 DEBUG_XFT1 (1, "confirming charset for font instance %s\n", | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
438 XSTRING_DATA (font)); |
| 3659 | 439 |
| 440 /* #### this looks like a fair amount of work, but the basic design | |
| 441 has never been rethought, and it should be | |
| 442 | |
| 443 what really should happen here is that we use FcFontSort (FcFontList?) | |
| 444 to get a list of matching fonts, then pick the first (best) one that | |
| 445 gives language or repertoire coverage. | |
| 446 */ | |
| 447 | |
| 448 FcInit (); /* No-op if already initialized. | |
| 449 In fontconfig 2.3.2, this cannot return | |
| 450 failure, but that looks like a bug. We | |
| 451 check for it with FcGetCurrentConfig(), | |
| 452 which *can* fail. */ | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
453 if (!FcConfigGetCurrent()) |
| 3659 | 454 stderr_out ("Failed fontconfig initialization\n"); |
| 455 else | |
| 456 { | |
| 457 FcPattern *fontxft; /* long-lived, freed at end of this block */ | |
| 458 FcResult fcresult; | |
| 459 FcConfig *fcc; | |
| 4932 | 460 const Ascbyte *lang = "en"; |
| 3659 | 461 FcCharSet *fccs = NULL; |
| 462 DECLARE_EISTRING (eistr_shortname); /* user-friendly nickname */ | |
| 463 DECLARE_EISTRING (eistr_longname); /* omit FC_LANG and FC_CHARSET */ | |
| 464 DECLARE_EISTRING (eistr_fullname); /* everything */ | |
| 465 | |
|
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
466 patternext = LISP_STRING_TO_EXTERNAL (font, Qfc_font_name_encoding); |
| 3659 | 467 fcc = FcConfigGetCurrent (); |
| 468 | |
| 469 /* parse the name, do the substitutions, and match the font */ | |
| 470 | |
| 471 { | |
| 472 FcPattern *p = FcNameParse ((FcChar8 *) patternext); | |
| 473 PRINT_XFT_PATTERN (3, "FcNameParse'ed name is %s\n", p); | |
| 474 /* #### Next two return FcBool, but what does the return mean? */ | |
| 475 /* The order is correct according the fontconfig docs. */ | |
| 476 FcConfigSubstitute (fcc, p, FcMatchPattern); | |
| 477 PRINT_XFT_PATTERN (2, "FcConfigSubstitute'ed name is %s\n", p); | |
| 478 FcDefaultSubstitute (p); | |
| 479 PRINT_XFT_PATTERN (3, "FcDefaultSubstitute'ed name is %s\n", p); | |
| 480 /* #### check fcresult of following match? */ | |
|
4809
0d3ccd5a2509
Initialize the result variable passed to FcFontMatch. See xemacs-patches
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
481 fcresult = FcResultMatch; |
| 3659 | 482 fontxft = FcFontMatch (fcc, p, &fcresult); |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
483 switch (fcresult) |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
484 { |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
485 /* case FcResultOutOfMemory: */ |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
486 case FcResultNoMatch: |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
487 case FcResultTypeMismatch: |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
488 case FcResultNoId: |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
489 break; |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
490 case FcResultMatch: |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
491 /* this prints the long fontconfig name */ |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
492 PRINT_XFT_PATTERN (1, "FcFontMatch'ed name is %s\n", fontxft); |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
493 break; |
|
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
494 } |
| 3659 | 495 FcPatternDestroy (p); |
| 496 } | |
| 497 | |
| 498 /* heuristic to give reasonable-length names for debug reports | |
| 499 | |
| 500 I considered #ifdef SUPPORT_FULL_FONTCONFIG_NAME etc but that's | |
| 501 pointless. We're just going to remove this code once the font/ | |
| 502 face refactoring is done, but until then it could be very useful. | |
| 503 */ | |
| 504 { | |
| 505 FcPattern *p = FcFontRenderPrepare (fcc, fontxft, fontxft); | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
506 Extbyte *name; |
| 3659 | 507 |
| 508 /* full name, including language coverage and repertoire */ | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
509 name = (Extbyte *) FcNameUnparse (p); |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
510 eicpy_ext (eistr_fullname, |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
511 (name ? name : "NOT FOUND"), |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
512 Qfc_font_name_encoding); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
513 if (name) free (name); |
| 3659 | 514 |
| 515 /* long name, omitting coverage and repertoire, plus a number | |
| 516 of rarely useful properties */ | |
| 517 FcPatternDel (p, FC_CHARSET); | |
| 518 FcPatternDel (p, FC_LANG); | |
| 3841 | 519 #ifdef FC_WIDTH |
| 3659 | 520 FcPatternDel (p, FC_WIDTH); |
| 3841 | 521 #endif |
| 3659 | 522 FcPatternDel (p, FC_SPACING); |
| 523 FcPatternDel (p, FC_HINTING); | |
| 524 FcPatternDel (p, FC_VERTICAL_LAYOUT); | |
| 525 FcPatternDel (p, FC_AUTOHINT); | |
| 526 FcPatternDel (p, FC_GLOBAL_ADVANCE); | |
| 527 FcPatternDel (p, FC_INDEX); | |
| 528 FcPatternDel (p, FC_SCALE); | |
| 529 FcPatternDel (p, FC_FONTVERSION); | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
530 name = (Extbyte *) FcNameUnparse (p); |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
531 eicpy_ext (eistr_longname, |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
532 (name ? name : "NOT FOUND"), |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
533 Qfc_font_name_encoding); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
534 if (name) free (name); |
| 3659 | 535 |
| 536 /* nickname, just family and size, but | |
| 537 "family" names usually have style, slant, and weight */ | |
| 538 FcPatternDel (p, FC_FOUNDRY); | |
| 539 FcPatternDel (p, FC_STYLE); | |
| 540 FcPatternDel (p, FC_SLANT); | |
| 541 FcPatternDel (p, FC_WEIGHT); | |
| 542 FcPatternDel (p, FC_PIXEL_SIZE); | |
| 543 FcPatternDel (p, FC_OUTLINE); | |
| 544 FcPatternDel (p, FC_SCALABLE); | |
| 545 FcPatternDel (p, FC_DPI); | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
546 name = (Extbyte *) FcNameUnparse (p); |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
547 eicpy_ext (eistr_shortname, |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
548 (name ? name : "NOT FOUND"), |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4756
diff
changeset
|
549 Qfc_font_name_encoding); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
550 if (name) free (name); |
| 3659 | 551 |
| 552 FcPatternDestroy (p); | |
| 553 } | |
| 554 | |
| 555 /* The language approach may better in the long run, but we can't use | |
| 556 it based on Mule charsets; fontconfig doesn't provide a way to test | |
| 557 for unions of languages, etc. That will require support from the | |
| 558 text module. | |
| 559 | |
| 560 Optimization: cache the generated FcCharSet in the Mule charset. | |
| 561 Don't forget to destroy it if the Mule charset gets deallocated. */ | |
| 562 | |
| 563 { | |
| 564 /* This block possibly should be a function, but it generates | |
| 565 multiple values. I find the "pass an address to return the | |
| 566 value in" idiom opaque, so prefer a block. */ | |
| 567 struct charset_reporter *cr; | |
| 568 for (cr = charset_table; | |
| 569 cr->charset && !EQ (*(cr->charset), charset); | |
| 570 cr++) | |
| 571 ; | |
| 572 | |
| 573 if (cr->rfc3066) | |
| 574 { | |
| 575 DECLARE_DEBUG_FONTNAME (name); | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
576 CHECKING_LANG (0, eidata (name), cr->language); |
| 4932 | 577 lang = cr->rfc3066; |
| 3659 | 578 } |
| 579 else if (cr->charset) | |
| 580 { | |
| 581 /* what the hey, build 'em on the fly */ | |
| 582 /* #### in the case of error this could return NULL! */ | |
| 583 fccs = mule_to_fc_charset (charset); | |
| 4932 | 584 /* #### Bad idea here */ |
| 585 lang = (const Ascbyte *) XSTRING_DATA (XSYMBOL (XCHARSET_NAME | |
| 586 (charset))->name); | |
| 3659 | 587 } |
| 588 else | |
| 589 { | |
| 590 /* OK, we fell off the end of the table */ | |
| 591 warn_when_safe_lispobj (intern ("xft"), intern ("alert"), | |
|
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
592 list2 (build_ascstring ("unchecked charset"), |
| 3659 | 593 charset)); |
| 594 /* default to "en" | |
| 595 #### THIS IS WRONG, WRONG, WRONG!! | |
| 596 It is why we never fall through to XLFD-checking. */ | |
| 597 } | |
| 598 | |
| 4932 | 599 ASSERT_ASCTEXT_ASCII (lang); |
| 3659 | 600 |
| 601 if (fccs) | |
| 602 { | |
| 603 /* check for character set coverage */ | |
| 604 int i = 0; | |
| 605 FcCharSet *v; | |
| 606 FcResult r = FcPatternGetCharSet (fontxft, FC_CHARSET, i, &v); | |
| 607 | |
| 608 if (r == FcResultTypeMismatch) | |
| 609 { | |
| 610 DEBUG_XFT0 (0, "Unexpected type return in charset value\n"); | |
| 611 result = Qnil; | |
| 612 } | |
| 613 else if (r == FcResultMatch && FcCharSetIsSubset (fccs, v)) | |
| 614 { | |
| 615 /* The full pattern with the bitmap coverage is massively | |
| 616 unwieldy, but the shorter names are just *wrong*. We | |
| 617 should have the full thing internally as truename, and | |
| 618 filter stuff the client doesn't want to see on output. | |
| 619 Should we just store it into the truename right here? */ | |
| 620 DECLARE_DEBUG_FONTNAME (name); | |
| 621 DEBUG_XFT2 (0, "Xft font %s supports %s\n", | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
622 eidata (name), lang); |
| 3659 | 623 #ifdef RETURN_LONG_FONTCONFIG_NAMES |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
624 result = eimake_string (eistr_fullname); |
| 3659 | 625 #else |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
626 result = eimake_string (eistr_longname); |
| 3659 | 627 #endif |
| 628 } | |
| 629 else | |
| 630 { | |
| 631 DECLARE_DEBUG_FONTNAME (name); | |
| 632 DEBUG_XFT2 (0, "Xft font %s doesn't support %s\n", | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
633 eidata (name), lang); |
| 3659 | 634 result = Qnil; |
| 635 } | |
| 636 | |
| 637 /* clean up */ | |
| 638 FcCharSetDestroy (fccs); | |
| 639 } | |
| 640 else | |
| 641 { | |
| 642 /* check for language coverage */ | |
| 643 int i = 0; | |
| 644 FcValue v; | |
| 645 /* the main event */ | |
| 646 FcResult r = FcPatternGet (fontxft, FC_LANG, i, &v); | |
| 647 | |
| 648 if (r == FcResultMatch) | |
| 649 { | |
| 650 if (v.type != FcTypeLangSet) /* excessive paranoia */ | |
| 651 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
652 ASSERT_ASCTEXT_ASCII (FcTypeOfValueToString (v)); |
| 3659 | 653 /* Urk! Fall back and punt to core font. */ |
| 654 DEBUG_XFT1 (0, "Unexpected type of lang value (%s)\n", | |
| 655 FcTypeOfValueToString (v)); | |
| 656 result = Qnil; | |
| 657 } | |
| 4932 | 658 else if (FcLangSetHasLang (v.u.l, (FcChar8 *) lang) |
| 659 != FcLangDifferentLang) | |
| 3659 | 660 { |
| 661 DECLARE_DEBUG_FONTNAME (name); | |
| 662 DEBUG_XFT2 (0, "Xft font %s supports %s\n", | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
663 eidata (name), lang); |
| 3659 | 664 #ifdef RETURN_LONG_FONTCONFIG_NAMES |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
665 result = eimake_string (eistr_fullname); |
| 3659 | 666 #else |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
667 result = eimake_string (eistr_longname); |
| 3659 | 668 #endif |
| 669 } | |
| 670 else | |
| 671 { | |
| 672 DECLARE_DEBUG_FONTNAME (name); | |
| 673 DEBUG_XFT2 (0, "Xft font %s doesn't support %s\n", | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
674 eidata (name), lang); |
| 3659 | 675 result = Qnil; |
| 676 } | |
| 677 } | |
| 678 else | |
| 679 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
680 ASSERT_ASCTEXT_ASCII (FcResultToString (r)); |
| 3659 | 681 DEBUG_XFT1 (0, "Getting lang: unexpected result=%s\n", |
| 682 FcResultToString (r)); | |
| 683 result = Qnil; | |
| 684 } | |
| 685 } | |
| 686 | |
| 687 /* clean up and maybe return */ | |
| 688 FcPatternDestroy (fontxft); | |
| 689 if (!UNBOUNDP (result)) | |
| 690 return result; | |
| 691 } | |
| 692 } | |
| 693 return Qnil; | |
| 694 } | |
| 695 #undef DECLARE_DEBUG_FONTNAME | |
| 696 | |
| 697 #endif /* USE_XFT */ | |
| 698 | |
| 699 /* find a font spec that matches font spec FONT and also matches | |
| 700 (the registry of) CHARSET. */ | |
| 701 static Lisp_Object | |
|
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
702 XFUN (find_charset_font) (Lisp_Object device, Lisp_Object font, |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
703 Lisp_Object charset, |
|
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
704 enum font_specifier_matchspec_stages stage) |
| 3659 | 705 { |
| 706 Lisp_Object result = Qnil, registries = Qnil; | |
| 707 int j, hyphen_count, registries_len = 0; | |
| 708 Ibyte *hyphening, *new_hyphening; | |
| 709 Bytecount xlfd_length; | |
| 710 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
711 DECLARE_EISTRING (ei_xlfd_without_registry); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
712 DECLARE_EISTRING (ei_xlfd); |
| 3659 | 713 |
| 714 #ifdef USE_XFT | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
715 result = xft_find_charset_font (font, charset, stage); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
716 if (!NILP (result)) |
| 3659 | 717 { |
| 718 return result; | |
| 719 } | |
| 720 #endif | |
| 721 | |
| 722 switch (stage) | |
| 723 { | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
724 case STAGE_INITIAL: |
| 3659 | 725 { |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
726 if (!(NILP (XCHARSET_REGISTRIES (charset))) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
727 && VECTORP (XCHARSET_REGISTRIES (charset))) |
| 3659 | 728 { |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
729 registries_len = XVECTOR_LENGTH (XCHARSET_REGISTRIES (charset)); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
730 registries = XCHARSET_REGISTRIES (charset); |
| 3659 | 731 } |
| 732 break; | |
| 733 } | |
|
5015
d95c102a96d3
cleanups for specifier font stages, from ben-unicode-internal (preparation for eliminating shadowed warnings)
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
734 case STAGE_FINAL: |
| 3659 | 735 { |
| 736 registries_len = 1; | |
| 737 registries = Qunicode_registries; | |
| 738 break; | |
| 739 } | |
| 740 default: | |
| 741 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
742 assert (0); |
| 3659 | 743 break; |
| 744 } | |
| 745 } | |
| 746 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
747 eicpy_lstr (ei_xlfd, font); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
748 hyphening = eidata (ei_xlfd); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
749 xlfd_length = eilen (ei_xlfd); |
| 3659 | 750 |
| 751 /* Count the hyphens in the string, moving new_hyphening to just after the | |
| 752 last one. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
753 hyphen_count = count_hyphens (hyphening, xlfd_length, &new_hyphening); |
| 3659 | 754 |
| 755 if (0 == registries_len || (5 > hyphen_count && | |
| 756 !(1 == xlfd_length && '*' == *hyphening))) | |
| 757 { | |
| 758 /* No proper XLFD specified, or we can't modify the pattern to change | |
| 759 the registry and encoding to match what we want, or we have no | |
| 760 information on the registry needed. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
761 result = xlistfonts_checking_charset (device, eidata (ei_xlfd), |
| 3659 | 762 charset, stage); |
| 763 /* No need to loop through the available registries; return | |
| 764 immediately. */ | |
| 765 return result; | |
| 766 } | |
| 767 else if (1 == xlfd_length && '*' == *hyphening) | |
| 768 { | |
| 769 /* It's a single asterisk. We can add the registry directly to the | |
| 770 end. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
771 eicpy_ch (ei_xlfd_without_registry, '*'); |
| 3659 | 772 } |
| 773 else | |
| 774 { | |
| 775 /* It's a fully-specified XLFD. Work out where the registry and | |
| 776 encoding are, and initialise ei_xlfd_without_registry to the string | |
| 777 without them. */ | |
| 778 | |
| 779 /* count_hyphens has set new_hyphening to just after the last | |
| 780 hyphen. Move back to just after the hyphen before it. */ | |
| 781 | |
| 782 for (new_hyphening -= 2; new_hyphening > hyphening | |
| 783 && '-' != *new_hyphening; --new_hyphening) | |
| 784 ; | |
| 785 ++new_hyphening; | |
| 786 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
787 eicpy_ei (ei_xlfd_without_registry, ei_xlfd); |
| 3659 | 788 |
| 789 /* Manipulate ei_xlfd_without_registry, using the information about | |
| 790 ei_xlfd, to which it's identical. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
791 eidel (ei_xlfd_without_registry, new_hyphening - hyphening, -1, |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
792 eilen (ei_xlfd) - (new_hyphening - hyphening), -1); |
| 3659 | 793 |
| 794 } | |
| 795 | |
| 796 /* Now, loop through the registries and encodings defined for this | |
| 797 charset, doing an XListFonts each time with the pattern modified to | |
| 798 specify the regisry and encoding. This avoids huge amounts of IPC and | |
| 799 duplicated searching; now we use the searching the X server was doing | |
| 800 anyway, where before the X server did its search, transferred huge | |
| 801 amounts of data, and then we proceeded to do a regexp search on that | |
| 802 data. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
803 for (j = 0; j < registries_len && NILP (result); ++j) |
| 3659 | 804 { |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
805 eireset (ei_xlfd); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
806 eicpy_ei (ei_xlfd, ei_xlfd_without_registry); |
| 3659 | 807 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
808 eicat_lstr (ei_xlfd, XVECTOR_DATA (registries)[j]); |
| 3659 | 809 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
810 result = xlistfonts_checking_charset (device, eidata (ei_xlfd), |
| 3659 | 811 charset, stage); |
| 812 } | |
| 813 | |
| 3676 | 814 /* In the event that the charset is ASCII and we haven't matched |
| 815 anything up to now, even with a pattern of "*", add "iso8859-1" | |
| 816 to the charset's registry and try again. Not returning a result | |
| 817 for ASCII means our frame geometry calculations are | |
| 818 inconsistent, and that we may crash. */ | |
| 819 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
820 if (1 == xlfd_length && EQ (charset, Vcharset_ascii) && NILP (result) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
821 && ('*' == eigetch (ei_xlfd_without_registry, 0))) |
| 3676 | 822 |
| 823 { | |
| 824 int have_latin1 = 0; | |
| 825 | |
| 826 /* Set this to, for example, is08859-1 if you want to see the | |
| 827 error behaviour. */ | |
| 828 | |
| 829 #define FALLBACK_ASCII_REGISTRY "iso8859-1" | |
| 830 | |
| 831 for (j = 0; j < registries_len; ++j) | |
| 832 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
833 if (0 == qxestrcasecmp (XSTRING_DATA (XVECTOR_DATA (registries)[j]), |
| 4124 | 834 (Ibyte *) FALLBACK_ASCII_REGISTRY)) |
| 3676 | 835 { |
| 836 have_latin1 = 1; | |
| 837 break; | |
| 838 } | |
| 839 } | |
| 840 | |
| 841 if (!have_latin1) | |
| 842 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
843 Lisp_Object new_registries = make_vector (registries_len + 1, Qnil); |
| 3676 | 844 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
845 XVECTOR_DATA (new_registries)[0] |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
846 = build_ascstring (FALLBACK_ASCII_REGISTRY); |
| 3676 | 847 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
848 memcpy (XVECTOR_DATA (new_registries) + 1, |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
849 XVECTOR_DATA (registries), |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
850 sizeof XVECTOR_DATA (registries)[0] * |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
851 XVECTOR_LENGTH (registries)); |
| 3676 | 852 |
| 853 /* Calling set_charset_registries instead of overwriting the | |
| 854 value directly, to allow the charset font caches to be | |
| 855 invalidated and a change to the default face to be | |
| 856 noted. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
857 set_charset_registries (charset, new_registries); |
| 3676 | 858 |
| 3680 | 859 warn_when_safe (Qface, Qwarning, |
| 860 "Your ASCII charset registries contain nothing " | |
| 861 "sensible. Adding `" FALLBACK_ASCII_REGISTRY "'."); | |
| 862 | |
| 3676 | 863 /* And recurse. */ |
| 864 result = | |
| 865 DEVMETH_OR_GIVEN (XDEVICE (device), find_charset_font, | |
| 866 (device, font, charset, stage), | |
| 867 result); | |
| 868 } | |
| 869 else | |
| 870 { | |
| 871 DECLARE_EISTRING (ei_connection_name); | |
| 872 | |
| 873 /* We preserve a copy of the connection name for the error message | |
| 874 after the device is deleted. */ | |
| 875 eicpy_lstr (ei_connection_name, | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5176
diff
changeset
|
876 DEVICE_CONNECTION (XDEVICE (device))); |
| 3676 | 877 |
| 878 stderr_out ("Cannot find a font for ASCII, deleting device on %s\n", | |
| 879 eidata (ei_connection_name)); | |
| 880 | |
| 881 io_error_delete_device (device); | |
| 882 | |
| 883 /* Do a normal warning in the event that we have other, non-X | |
| 884 frames available. (If we don't, io_error_delete_device will | |
| 885 have exited.) */ | |
| 886 warn_when_safe | |
| 887 (Qface, Qerror, | |
| 888 "Cannot find a font for ASCII, deleting device on %s.\n" | |
| 889 "\n" | |
| 890 "Your X server fonts appear to be inconsistent; fix them, or\n" | |
| 891 "the next frame you create on that DISPLAY will crash this\n" | |
| 892 "XEmacs. At a minimum, provide one font with an XLFD ending\n" | |
| 893 "in `" FALLBACK_ASCII_REGISTRY "', so we can work out what size\n" | |
| 894 "a frame should be. ", | |
| 895 eidata (ei_connection_name)); | |
| 896 } | |
| 897 | |
| 898 } | |
| 899 | |
| 3659 | 900 /* This function used to return the font spec, in the case where a font |
| 901 didn't exist on the X server but it did match the charset. We're not | |
| 902 doing that any more, because none of the other platform code does, and | |
| 903 the old behaviour was badly-judged in other respects, so I don't trust | |
| 904 the original author to have had a good reason for it. */ | |
| 905 | |
| 906 return result; | |
| 907 } | |
| 908 | |
| 909 #endif /* MULE */ |
