diff options
| author | Kenichi Handa | 2007-12-01 02:41:41 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-12-01 02:41:41 +0000 |
| commit | a9822ae8782a9313d6d287786c05df168b3676c4 (patch) | |
| tree | 9c9636f6888f94b5a1d8077efcdf1e3d4b767e5a /src | |
| parent | 6e846fdc697224b69a6fdc02871700dad1fe20da (diff) | |
| download | emacs-a9822ae8782a9313d6d287786c05df168b3676c4.tar.gz emacs-a9822ae8782a9313d6d287786c05df168b3676c4.zip | |
* xfont.c (x_font_charset_alist): Moved to font.c and renamed.
(xfont_registry_charsets): Likewise. Caller changed.
(syms_of_xfont): Don't handle x_font_charset_alist.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfont.c | 88 |
1 files changed, 2 insertions, 86 deletions
diff --git a/src/xfont.c b/src/xfont.c index 59cc31d78e4..4bc363d4dd3 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -40,24 +40,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 40 | 40 | ||
| 41 | Lisp_Object Qx; | 41 | Lisp_Object Qx; |
| 42 | 42 | ||
| 43 | /* Alist of font registry symbol and the corresponding charsets | ||
| 44 | information. The information is retrieved from | ||
| 45 | Vfont_encoding_alist on demand. | ||
| 46 | |||
| 47 | Eash element has the form: | ||
| 48 | (REGISTRY . (ENCODING-CHARSET-ID . REPERTORY-CHARSET-ID)) | ||
| 49 | or | ||
| 50 | (REGISTRY . nil) | ||
| 51 | |||
| 52 | In the former form, ENCODING-CHARSET-ID is an ID of a charset that | ||
| 53 | encodes a character code to a glyph code of a font, and | ||
| 54 | REPERTORY-CHARSET-ID is an ID of a charset that tells if a | ||
| 55 | character is supported by a font. | ||
| 56 | |||
| 57 | The latter form means that the information for REGISTRY couldn't be | ||
| 58 | retrieved. */ | ||
| 59 | static Lisp_Object x_font_charset_alist; | ||
| 60 | |||
| 61 | /* Prototypes of support functions. */ | 43 | /* Prototypes of support functions. */ |
| 62 | extern void x_clear_errors P_ ((Display *)); | 44 | extern void x_clear_errors P_ ((Display *)); |
| 63 | 45 | ||
| @@ -174,69 +156,6 @@ xfont_get_pcm (xfont, char2b) | |||
| 174 | ? NULL : pcm); | 156 | ? NULL : pcm); |
| 175 | } | 157 | } |
| 176 | 158 | ||
| 177 | extern Lisp_Object find_font_encoding P_ ((Lisp_Object)); | ||
| 178 | |||
| 179 | /* Return encoding charset and repertory charset for REGISTRY in | ||
| 180 | ENCODING and REPERTORY correspondingly. If correct information for | ||
| 181 | REGISTRY is available, return 0. Otherwise return -1. */ | ||
| 182 | |||
| 183 | static int | ||
| 184 | xfont_registry_charsets (registry, encoding, repertory) | ||
| 185 | Lisp_Object registry; | ||
| 186 | struct charset **encoding, **repertory; | ||
| 187 | { | ||
| 188 | Lisp_Object val; | ||
| 189 | int encoding_id, repertory_id; | ||
| 190 | |||
| 191 | val = assq_no_quit (registry, x_font_charset_alist); | ||
| 192 | if (! NILP (val)) | ||
| 193 | { | ||
| 194 | val = XCDR (val); | ||
| 195 | if (NILP (val)) | ||
| 196 | return -1; | ||
| 197 | encoding_id = XINT (XCAR (val)); | ||
| 198 | repertory_id = XINT (XCDR (val)); | ||
| 199 | } | ||
| 200 | else | ||
| 201 | { | ||
| 202 | val = find_font_encoding (SYMBOL_NAME (registry)); | ||
| 203 | if (SYMBOLP (val) && CHARSETP (val)) | ||
| 204 | { | ||
| 205 | encoding_id = repertory_id = XINT (CHARSET_SYMBOL_ID (val)); | ||
| 206 | } | ||
| 207 | else if (CONSP (val)) | ||
| 208 | { | ||
| 209 | if (! CHARSETP (XCAR (val))) | ||
| 210 | goto invalid_entry; | ||
| 211 | encoding_id = XINT (CHARSET_SYMBOL_ID (XCAR (val))); | ||
| 212 | if (NILP (XCDR (val))) | ||
| 213 | repertory_id = -1; | ||
| 214 | else | ||
| 215 | { | ||
| 216 | if (! CHARSETP (XCDR (val))) | ||
| 217 | goto invalid_entry; | ||
| 218 | repertory_id = XINT (CHARSET_SYMBOL_ID (XCDR (val))); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | else | ||
| 222 | goto invalid_entry; | ||
| 223 | val = Fcons (make_number (encoding_id), make_number (repertory_id)); | ||
| 224 | x_font_charset_alist | ||
| 225 | = nconc2 (x_font_charset_alist, Fcons (Fcons (registry, val), Qnil)); | ||
| 226 | } | ||
| 227 | |||
| 228 | if (encoding) | ||
| 229 | *encoding = CHARSET_FROM_ID (encoding_id); | ||
| 230 | if (repertory) | ||
| 231 | *repertory = repertory_id >= 0 ? CHARSET_FROM_ID (repertory_id) : NULL; | ||
| 232 | return 0; | ||
| 233 | |||
| 234 | invalid_entry: | ||
| 235 | x_font_charset_alist | ||
| 236 | = nconc2 (x_font_charset_alist, Fcons (Fcons (registry, Qnil), Qnil)); | ||
| 237 | return -1; | ||
| 238 | } | ||
| 239 | |||
| 240 | static Lisp_Object xfont_get_cache P_ ((Lisp_Object)); | 159 | static Lisp_Object xfont_get_cache P_ ((Lisp_Object)); |
| 241 | static Lisp_Object xfont_list P_ ((Lisp_Object, Lisp_Object)); | 160 | static Lisp_Object xfont_list P_ ((Lisp_Object, Lisp_Object)); |
| 242 | static Lisp_Object xfont_match P_ ((Lisp_Object, Lisp_Object)); | 161 | static Lisp_Object xfont_match P_ ((Lisp_Object, Lisp_Object)); |
| @@ -567,7 +486,7 @@ xfont_open (f, entity, pixel_size) | |||
| 567 | /* At first, check if we know how to encode characters for this | 486 | /* At first, check if we know how to encode characters for this |
| 568 | font. */ | 487 | font. */ |
| 569 | registry = AREF (entity, FONT_REGISTRY_INDEX); | 488 | registry = AREF (entity, FONT_REGISTRY_INDEX); |
| 570 | if (xfont_registry_charsets (registry, &encoding, &repertory) < 0) | 489 | if (font_registry_charsets (registry, &encoding, &repertory) < 0) |
| 571 | return NULL; | 490 | return NULL; |
| 572 | 491 | ||
| 573 | if (XINT (AREF (entity, FONT_SIZE_INDEX)) != 0) | 492 | if (XINT (AREF (entity, FONT_SIZE_INDEX)) != 0) |
| @@ -781,7 +700,7 @@ xfont_has_char (entity, c) | |||
| 781 | Lisp_Object registry = AREF (entity, FONT_REGISTRY_INDEX); | 700 | Lisp_Object registry = AREF (entity, FONT_REGISTRY_INDEX); |
| 782 | struct charset *repertory; | 701 | struct charset *repertory; |
| 783 | 702 | ||
| 784 | if (xfont_registry_charsets (registry, NULL, &repertory) < 0) | 703 | if (font_registry_charsets (registry, NULL, &repertory) < 0) |
| 785 | return -1; | 704 | return -1; |
| 786 | if (! repertory) | 705 | if (! repertory) |
| 787 | return -1; | 706 | return -1; |
| @@ -903,9 +822,6 @@ xfont_draw (s, from, to, x, y, with_background) | |||
| 903 | void | 822 | void |
| 904 | syms_of_xfont () | 823 | syms_of_xfont () |
| 905 | { | 824 | { |
| 906 | staticpro (&x_font_charset_alist); | ||
| 907 | x_font_charset_alist = Qnil; | ||
| 908 | |||
| 909 | DEFSYM (Qx, "x"); | 825 | DEFSYM (Qx, "x"); |
| 910 | xfont_driver.type = Qx; | 826 | xfont_driver.type = Qx; |
| 911 | register_font_driver (&xfont_driver, NULL); | 827 | register_font_driver (&xfont_driver, NULL); |