summaryrefslogtreecommitdiff
path: root/src/macfont.m
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/macfont.m
parentdd4b913153a818dbd42cb395d2c36f216e09a8ec (diff)
downloademacs-ebb96114d88af64cbb72f42052cb359ba8010aa2.tar.gz
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/macfont.m')
-rw-r--r--src/macfont.m47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/macfont.m b/src/macfont.m
index b3a2fb84205..b2f3dff3097 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -38,8 +38,6 @@ Original author: YAMAMOTO Mitsuharu
#include <libkern/OSByteOrder.h>
-static struct font_driver macfont_driver;
-
static double mac_font_get_advance_width_for_glyph (CTFontRef, CGGlyph);
static CGRect mac_font_get_bounding_rect_for_glyph (CTFontRef, CGGlyph);
static CFArrayRef mac_font_create_available_families (void);
@@ -893,7 +891,7 @@ macfont_descriptor_entity (CTFontDescriptorRef desc, Lisp_Object extra,
entity = font_make_entity ();
- ASET (entity, FONT_TYPE_INDEX, macfont_driver.type);
+ ASET (entity, FONT_TYPE_INDEX, Qmac_ct);
ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1);
macfont_store_descriptor_attributes (desc, entity);
@@ -1663,34 +1661,23 @@ static int macfont_variation_glyphs (struct font *, int c,
unsigned variations[256]);
static void macfont_filter_properties (Lisp_Object, Lisp_Object);
-static struct font_driver macfont_driver =
+static struct font_driver const macfont_driver =
{
- LISPSYM_INITIALLY (Qmac_ct),
- 0, /* case insensitive */
- macfont_get_cache,
- macfont_list,
- macfont_match,
- macfont_list_family,
- macfont_free_entity,
- macfont_open,
- macfont_close,
- NULL, /* prepare_face */
- NULL, /* done_face */
- macfont_has_char,
- macfont_encode_char,
- macfont_text_extents,
- macfont_draw,
- NULL, /* get_bitmap */
- NULL, /* free_bitmap */
- NULL, /* anchor_point */
- NULL, /* otf_capability */
- NULL, /* otf_drive */
- NULL, /* start_for_frame */
- NULL, /* end_for_frame */
- macfont_shape,
- NULL, /* check */
- macfont_variation_glyphs,
- macfont_filter_properties,
+ type: LISPSYM_INITIALLY (Qmac_ct),
+ get_cache: macfont_get_cache,
+ list: macfont_list,
+ match: macfont_match,
+ list_family: macfont_list_family,
+ free_entity: macfont_free_entity,
+ open: macfont_open,
+ close: macfont_close,
+ has_char: macfont_has_char,
+ encode_char: macfont_encode_char,
+ text_extents: macfont_text_extents,
+ draw: macfont_draw,
+ shape: macfont_shape,
+ get_variation_glyphs: macfont_variation_glyphs,
+ filter_properties: macfont_filter_properties,
};
static Lisp_Object