summaryrefslogtreecommitdiff
path: root/src/xfont.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-12-01 21:47:12 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2016-12-01 21:48:30 -0800
commitebb96114d88af64cbb72f42052cb359ba8010aa2 (patch)
tree88795f2e9bc74b5c1a96c04c8cfe069b7d5f601f /src/xfont.c
parentdd4b913153a818dbd42cb395d2c36f216e09a8ec (diff)
downloademacs-ebb96114d88af64cbb72f42052cb359ba8010aa2.tar.gz
emacs-ebb96114d88af64cbb72f42052cb359ba8010aa2.tar.bz2
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.c57
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)
? NULL : pcm);
}
-static Lisp_Object xfont_get_cache (struct frame *);
-static Lisp_Object xfont_list (struct frame *, Lisp_Object);
-static Lisp_Object xfont_match (struct frame *, Lisp_Object);
-static Lisp_Object xfont_list_family (struct frame *);
-static Lisp_Object xfont_open (struct frame *, Lisp_Object, int);
-static void xfont_close (struct font *);
-static void xfont_prepare_face (struct frame *, struct face *);
-static int xfont_has_char (Lisp_Object, int);
-static unsigned xfont_encode_char (struct font *, int);
-static void xfont_text_extents (struct font *, unsigned *, int,
- struct font_metrics *);
-static int xfont_draw (struct glyph_string *, int, int, int, int, bool);
-static int xfont_check (struct frame *, struct font *);
-
-struct font_driver xfont_driver =
- {
- LISPSYM_INITIALLY (Qx),
- false, /* case insensitive */
- xfont_get_cache,
- xfont_list,
- xfont_match,
- xfont_list_family,
- NULL,
- xfont_open,
- xfont_close,
- xfont_prepare_face,
- NULL,
- xfont_has_char,
- xfont_encode_char,
- xfont_text_extents,
- xfont_draw,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- xfont_check,
- NULL, /* get_variation_glyphs */
- NULL, /* filter_properties */
- };
-
-static Lisp_Object
+Lisp_Object
xfont_get_cache (struct frame *f)
{
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
@@ -1113,6 +1076,24 @@ xfont_check (struct frame *f, struct font *font)
}
+
+struct font_driver const xfont_driver =
+ {
+ type: LISPSYM_INITIALLY (Qx),
+ get_cache: xfont_get_cache,
+ list: xfont_list,
+ match: xfont_match,
+ list_family: xfont_list_family,
+ open: xfont_open,
+ close: xfont_close,
+ prepare_face: xfont_prepare_face,
+ has_char: xfont_has_char,
+ encode_char: xfont_encode_char,
+ text_extents: xfont_text_extents,
+ draw: xfont_draw,
+ check: xfont_check,
+ };
+
void
syms_of_xfont (void)
{