diff options
| author | Paul Eggert | 2016-12-01 21:47:12 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-12-01 21:48:30 -0800 |
| commit | ebb96114d88af64cbb72f42052cb359ba8010aa2 (patch) | |
| tree | 88795f2e9bc74b5c1a96c04c8cfe069b7d5f601f /src/xfont.c | |
| parent | dd4b913153a818dbd42cb395d2c36f216e09a8ec (diff) | |
| download | emacs-ebb96114d88af64cbb72f42052cb359ba8010aa2.tar.gz emacs-ebb96114d88af64cbb72f42052cb359ba8010aa2.zip | |
Make struct font_drivers read-only
This simplifies the code a bit, and makes the structs more
shareable and less likely to become corrupt.
* src/alloc.c (cleanup_vector):
* src/font.c (valid_font_driver, font_prepare_cache)
(font_finish_cache, font_get_cache, font_clear_cache)
(register_font_driver, font_update_drivers):
* src/font.h (struct font, struct font_driver_list)
(valid_font_driver):
struct font_drivers are now const.
* src/font.c, src/ftcrfont.c, src/ftfont.c, src/nsfont.m, src/xfont.c:
Omit no-longer-necessary decls.
* src/ftcrfont.c (syms_of_ftcrfont):
* src/ftxfont.c (syms_of_ftxfont):
* src/xftfont.c (syms_of_xftfont):
Omit no-longer-necessary initialization code.
* src/ftcrfont.c (ftcrfont_driver):
* src/ftfont.c (ftfont_driver):
* src/ftxfont.c (ftxfont_driver):
* src/macfont.m (macfont_driver):
* src/nsfont.m (nsfont_driver):
* src/xfont.c (xfont_driver):
* src/xftfont.c (xftfont_driver):
Use C99-style initializer for ease of maintenance, and make it const.
* src/ftcrfont.c, src/ftxfont.c, src/xftfont.c:
Refer to functions like ftfont_text_extents directly.
* src/ftfont.c (ftfont_get_cache, ftfont_list, ftfont_list_family)
(ftfont_has_char, ftfont_encode_char, ftfont_text_extents)
(ftfont_get_bitmap, ftfont_anchor_point, ftfont_otf_capability)
(ftfont_variation_glyphs, ftfont_filter_properties)
(ftfont_combining_capability):
* src/xfont.c (xfont_get_cache):
Now extern, so that other modules’ struct font_drivers can use
them directly.
* src/macfont.m (macfont_descriptor_entity):
* src/nsfont.m (nsfont_open):
Use constant directly; this is clearer.
Diffstat (limited to 'src/xfont.c')
| -rw-r--r-- | src/xfont.c | 57 |
1 files changed, 19 insertions, 38 deletions
diff --git a/src/xfont.c b/src/xfont.c index ccb8f070626..5999f6715cc 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -113,44 +113,7 @@ xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b) | |||
| 113 | ? NULL : pcm); | 113 | ? NULL : pcm); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static Lisp_Object xfont_get_cache (struct frame *); | 116 | Lisp_Object |
| 117 | static Lisp_Object xfont_list (struct frame *, Lisp_Object); | ||
| 118 | static Lisp_Object xfont_match (struct frame *, Lisp_Object); | ||
| 119 | static Lisp_Object xfont_list_family (struct frame *); | ||
| 120 | static Lisp_Object xfont_open (struct frame *, Lisp_Object, int); | ||
| 121 | static void xfont_close (struct font *); | ||
| 122 | static void xfont_prepare_face (struct frame *, struct face *); | ||
| 123 | static int xfont_has_char (Lisp_Object, int); | ||
| 124 | static unsigned xfont_encode_char (struct font *, int); | ||
| 125 | static void xfont_text_extents (struct font *, unsigned *, int, | ||
| 126 | struct font_metrics *); | ||
| 127 | static int xfont_draw (struct glyph_string *, int, int, int, int, bool); | ||
| 128 | static int xfont_check (struct frame *, struct font *); | ||
| 129 | |||
| 130 | struct font_driver xfont_driver = | ||
| 131 | { | ||
| 132 | LISPSYM_INITIALLY (Qx), | ||
| 133 | false, /* case insensitive */ | ||
| 134 | xfont_get_cache, | ||
| 135 | xfont_list, | ||
| 136 | xfont_match, | ||
| 137 | xfont_list_family, | ||
| 138 | NULL, | ||
| 139 | xfont_open, | ||
| 140 | xfont_close, | ||
| 141 | xfont_prepare_face, | ||
| 142 | NULL, | ||
| 143 | xfont_has_char, | ||
| 144 | xfont_encode_char, | ||
| 145 | xfont_text_extents, | ||
| 146 | xfont_draw, | ||
| 147 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
| 148 | xfont_check, | ||
| 149 | NULL, /* get_variation_glyphs */ | ||
| 150 | NULL, /* filter_properties */ | ||
| 151 | }; | ||
| 152 | |||
| 153 | static Lisp_Object | ||
| 154 | xfont_get_cache (struct frame *f) | 117 | xfont_get_cache (struct frame *f) |
| 155 | { | 118 | { |
| 156 | Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); | 119 | Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| @@ -1113,6 +1076,24 @@ xfont_check (struct frame *f, struct font *font) | |||
| 1113 | } | 1076 | } |
| 1114 | 1077 | ||
| 1115 | 1078 | ||
| 1079 | |||
| 1080 | struct font_driver const xfont_driver = | ||
| 1081 | { | ||
| 1082 | type: LISPSYM_INITIALLY (Qx), | ||
| 1083 | get_cache: xfont_get_cache, | ||
| 1084 | list: xfont_list, | ||
| 1085 | match: xfont_match, | ||
| 1086 | list_family: xfont_list_family, | ||
| 1087 | open: xfont_open, | ||
| 1088 | close: xfont_close, | ||
| 1089 | prepare_face: xfont_prepare_face, | ||
| 1090 | has_char: xfont_has_char, | ||
| 1091 | encode_char: xfont_encode_char, | ||
| 1092 | text_extents: xfont_text_extents, | ||
| 1093 | draw: xfont_draw, | ||
| 1094 | check: xfont_check, | ||
| 1095 | }; | ||
| 1096 | |||
| 1116 | void | 1097 | void |
| 1117 | syms_of_xfont (void) | 1098 | syms_of_xfont (void) |
| 1118 | { | 1099 | { |