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/macfont.m | |
| 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/macfont.m')
| -rw-r--r-- | src/macfont.m | 47 |
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 | |||
| 38 | 38 | ||
| 39 | #include <libkern/OSByteOrder.h> | 39 | #include <libkern/OSByteOrder.h> |
| 40 | 40 | ||
| 41 | static struct font_driver macfont_driver; | ||
| 42 | |||
| 43 | static double mac_font_get_advance_width_for_glyph (CTFontRef, CGGlyph); | 41 | static double mac_font_get_advance_width_for_glyph (CTFontRef, CGGlyph); |
| 44 | static CGRect mac_font_get_bounding_rect_for_glyph (CTFontRef, CGGlyph); | 42 | static CGRect mac_font_get_bounding_rect_for_glyph (CTFontRef, CGGlyph); |
| 45 | static CFArrayRef mac_font_create_available_families (void); | 43 | static CFArrayRef mac_font_create_available_families (void); |
| @@ -893,7 +891,7 @@ macfont_descriptor_entity (CTFontDescriptorRef desc, Lisp_Object extra, | |||
| 893 | 891 | ||
| 894 | entity = font_make_entity (); | 892 | entity = font_make_entity (); |
| 895 | 893 | ||
| 896 | ASET (entity, FONT_TYPE_INDEX, macfont_driver.type); | 894 | ASET (entity, FONT_TYPE_INDEX, Qmac_ct); |
| 897 | ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); | 895 | ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); |
| 898 | 896 | ||
| 899 | macfont_store_descriptor_attributes (desc, entity); | 897 | macfont_store_descriptor_attributes (desc, entity); |
| @@ -1663,34 +1661,23 @@ static int macfont_variation_glyphs (struct font *, int c, | |||
| 1663 | unsigned variations[256]); | 1661 | unsigned variations[256]); |
| 1664 | static void macfont_filter_properties (Lisp_Object, Lisp_Object); | 1662 | static void macfont_filter_properties (Lisp_Object, Lisp_Object); |
| 1665 | 1663 | ||
| 1666 | static struct font_driver macfont_driver = | 1664 | static struct font_driver const macfont_driver = |
| 1667 | { | 1665 | { |
| 1668 | LISPSYM_INITIALLY (Qmac_ct), | 1666 | type: LISPSYM_INITIALLY (Qmac_ct), |
| 1669 | 0, /* case insensitive */ | 1667 | get_cache: macfont_get_cache, |
| 1670 | macfont_get_cache, | 1668 | list: macfont_list, |
| 1671 | macfont_list, | 1669 | match: macfont_match, |
| 1672 | macfont_match, | 1670 | list_family: macfont_list_family, |
| 1673 | macfont_list_family, | 1671 | free_entity: macfont_free_entity, |
| 1674 | macfont_free_entity, | 1672 | open: macfont_open, |
| 1675 | macfont_open, | 1673 | close: macfont_close, |
| 1676 | macfont_close, | 1674 | has_char: macfont_has_char, |
| 1677 | NULL, /* prepare_face */ | 1675 | encode_char: macfont_encode_char, |
| 1678 | NULL, /* done_face */ | 1676 | text_extents: macfont_text_extents, |
| 1679 | macfont_has_char, | 1677 | draw: macfont_draw, |
| 1680 | macfont_encode_char, | 1678 | shape: macfont_shape, |
| 1681 | macfont_text_extents, | 1679 | get_variation_glyphs: macfont_variation_glyphs, |
| 1682 | macfont_draw, | 1680 | filter_properties: macfont_filter_properties, |
| 1683 | NULL, /* get_bitmap */ | ||
| 1684 | NULL, /* free_bitmap */ | ||
| 1685 | NULL, /* anchor_point */ | ||
| 1686 | NULL, /* otf_capability */ | ||
| 1687 | NULL, /* otf_drive */ | ||
| 1688 | NULL, /* start_for_frame */ | ||
| 1689 | NULL, /* end_for_frame */ | ||
| 1690 | macfont_shape, | ||
| 1691 | NULL, /* check */ | ||
| 1692 | macfont_variation_glyphs, | ||
| 1693 | macfont_filter_properties, | ||
| 1694 | }; | 1681 | }; |
| 1695 | 1682 | ||
| 1696 | static Lisp_Object | 1683 | static Lisp_Object |