From 876d043fad0062a85ede5ab4f70c2e7f6d0e77ac Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Wed, 9 Jul 2014 10:25:35 +0400 Subject: [PATCH] Next minor cleanup of font subsystem. * font.h (enum font_property_index): Remove FONT_ENTITY_INDEX (no users) and FONT_FORMAT_INDEX (set by a few font drivers but never really used). (FONT_ENTITY_NOT_LOADABLE, FONT_ENTITY_SET_NOT_LOADABLE): Remove; unused. * ftfont.h (ftfont_font_format): Remove prototype. * ftfont.c (ftfont_font_format): Remove; now unused. (ftfont_open): * nsfont.m (nsfont_open): * w32font.c (w32font_open_internal): * w32uniscribe.c (uniscribe_open): * xfont.c (xfont_open): * xftfont.c (xftfont_open): All users changed. --- src/ChangeLog | 17 +++++++++++++++++ src/font.h | 15 --------------- src/ftfont.c | 41 ----------------------------------------- src/ftfont.h | 1 - src/nsfont.m | 3 --- src/w32font.c | 17 +---------------- src/w32uniscribe.c | 2 -- src/xfont.c | 2 -- src/xftfont.c | 2 -- 9 files changed, 18 insertions(+), 82 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ba56edda715..10984d5ce25 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2014-07-09 Dmitry Antipov + + Next minor cleanup of font subsystem. + * font.h (enum font_property_index): Remove FONT_ENTITY_INDEX (no + users) and FONT_FORMAT_INDEX (set by a few font drivers but never + really used). + (FONT_ENTITY_NOT_LOADABLE, FONT_ENTITY_SET_NOT_LOADABLE): Remove; + unused. + * ftfont.h (ftfont_font_format): Remove prototype. + * ftfont.c (ftfont_font_format): Remove; now unused. + (ftfont_open): + * nsfont.m (nsfont_open): + * w32font.c (w32font_open_internal): + * w32uniscribe.c (uniscribe_open): + * xfont.c (xfont_open): + * xftfont.c (xftfont_open): All users changed. + 2014-07-09 Eli Zaretskii * xdisp.c (move_it_to): Adjust calculation of line_start_x to what diff --git a/src/font.h b/src/font.h index 96c030c3af1..5bf0efb738a 100644 --- a/src/font.h +++ b/src/font.h @@ -162,9 +162,6 @@ enum font_property_index /* List of font-objects opened from the font-entity. */ FONT_OBJLIST_INDEX = FONT_SPEC_MAX, - /* Font-entity from which the font-object is opened. */ - FONT_ENTITY_INDEX = FONT_SPEC_MAX, - /* This value is the length of font-entity vector. */ FONT_ENTITY_MAX, @@ -182,9 +179,6 @@ enum font_property_index is not available. */ FONT_FILE_INDEX, - /* Format of the font (symbol) or nil if unknown. */ - FONT_FORMAT_INDEX, - /* This value is the length of font-object vector. */ FONT_OBJECT_MAX }; @@ -442,15 +436,6 @@ struct font_bitmap #define FONT_OBJECT_P(x) \ (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX) -/* True iff ENTITY can't be loaded. */ -#define FONT_ENTITY_NOT_LOADABLE(entity) \ - EQ (AREF (entity, FONT_OBJLIST_INDEX), Qt) - -/* Flag ENTITY not loadable. */ -#define FONT_ENTITY_SET_NOT_LOADABLE(entity) \ - ASET (entity, FONT_OBJLIST_INDEX, Qt) - - /* Check macros for various font-related objects. */ #define CHECK_FONT(x) \ diff --git a/src/ftfont.c b/src/ftfont.c index 2d75dc22679..419274a30aa 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -1223,7 +1223,6 @@ ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) font_object = font_build_object (VECSIZE (struct ftfont_info), Qfreetype, entity, size); ASET (font_object, FONT_FILE_INDEX, filename); - ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (NULL, filename)); font = XFONT_OBJECT (font_object); ftfont_info = (struct ftfont_info *) font; ftfont_info->ft_size = ft_face->size; @@ -2587,46 +2586,6 @@ ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256]) #endif /* HAVE_OTF_GET_VARIATION_GLYPHS */ #endif /* HAVE_LIBOTF */ -Lisp_Object -ftfont_font_format (FcPattern *pattern, Lisp_Object filename) -{ - FcChar8 *str; - -#ifdef FC_FONTFORMAT - if (pattern) - { - if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch) - return Qnil; - if (strcmp ((char *) str, "TrueType") == 0) - return intern ("truetype"); - if (strcmp ((char *) str, "Type 1") == 0) - return intern ("type1"); - if (strcmp ((char *) str, "PCF") == 0) - return intern ("pcf"); - if (strcmp ((char *) str, "BDF") == 0) - return intern ("bdf"); - } -#endif /* FC_FONTFORMAT */ - if (STRINGP (filename)) - { - int len = SBYTES (filename); - - if (len >= 4) - { - str = (FcChar8 *) (SDATA (filename) + len - 4); - if (xstrcasecmp ((char *) str, ".ttf") == 0) - return intern ("truetype"); - if (xstrcasecmp ((char *) str, ".pfb") == 0) - return intern ("type1"); - if (xstrcasecmp ((char *) str, ".pcf") == 0) - return intern ("pcf"); - if (xstrcasecmp ((char *) str, ".bdf") == 0) - return intern ("bdf"); - } - } - return intern ("unknown"); -} - static const char *const ftfont_booleans [] = { ":antialias", ":hinting", diff --git a/src/ftfont.h b/src/ftfont.h index 8c8674f3440..210b634c094 100644 --- a/src/ftfont.h +++ b/src/ftfont.h @@ -36,7 +36,6 @@ along with GNU Emacs. If not, see . */ #endif /* HAVE_M17N_FLT */ #endif /* HAVE_LIBOTF */ -extern Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); extern FcCharSet *ftfont_get_fc_charset (Lisp_Object); #endif /* EMACS_FTFONT_H */ diff --git a/src/nsfont.m b/src/nsfont.m index 4ed45991b93..98c25fcdedd 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -830,9 +830,6 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) font->baseline_offset = 0; font->relative_compose = 0; - font->props[FONT_FORMAT_INDEX] = Qns; - font->props[FONT_FILE_INDEX] = Qnil; - { const char *fontName = [[nsfont fontName] UTF8String]; diff --git a/src/w32font.c b/src/w32font.c index 43b592ee450..81e25eb0856 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -886,7 +886,7 @@ w32font_open_internal (struct frame *f, Lisp_Object font_entity, LOGFONT logfont; HDC dc; HFONT hfont, old_font; - Lisp_Object val, extra; + Lisp_Object val; struct w32font_info *w32_font; struct font * font; OUTLINETEXTMETRICW* metrics = NULL; @@ -979,21 +979,6 @@ w32font_open_internal (struct frame *f, Lisp_Object font_entity, font->default_ascent = w32_font->metrics.tmAscent; font->pixel_size = size; font->driver = &w32font_driver; - /* Use format cached during list, as the information we have access to - here is incomplete. */ - extra = AREF (font_entity, FONT_EXTRA_INDEX); - if (CONSP (extra)) - { - val = assq_no_quit (QCformat, extra); - if (CONSP (val)) - font->props[FONT_FORMAT_INDEX] = XCDR (val); - else - font->props[FONT_FORMAT_INDEX] = Qunknown; - } - else - font->props[FONT_FORMAT_INDEX] = Qunknown; - - font->props[FONT_FILE_INDEX] = Qnil; font->encoding_charset = -1; font->repertory_charset = -1; /* TODO: do we really want the minimum width here, which could be negative? */ diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 24fc753e708..d06586f973a 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -127,8 +127,6 @@ uniscribe_open (struct frame *f, Lisp_Object font_entity, int pixel_size) /* Uniscribe backend uses glyph indices. */ uniscribe_font->w32_font.glyph_idx = ETO_GLYPH_INDEX; - /* Mark the format as opentype */ - uniscribe_font->w32_font.font.props[FONT_FORMAT_INDEX] = Qopentype; uniscribe_font->w32_font.font.driver = &uniscribe_font_driver; return font_object; diff --git a/src/xfont.c b/src/xfont.c index baed9abbc7e..8996783541b 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -804,8 +804,6 @@ xfont_open (struct frame *f, Lisp_Object entity, int pixel_size) ASET (font_object, FONT_NAME_INDEX, make_string (buf, len)); } ASET (font_object, FONT_FULLNAME_INDEX, fullname); - ASET (font_object, FONT_FILE_INDEX, Qnil); - ASET (font_object, FONT_FORMAT_INDEX, Qx); font = XFONT_OBJECT (font_object); ((struct xfont_info *) font)->xfont = xfont; ((struct xfont_info *) font)->display = FRAME_X_DISPLAY (f); diff --git a/src/xftfont.c b/src/xftfont.c index 1ca3f92b239..9726a3b9911 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -343,8 +343,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) font_object = font_build_object (VECSIZE (struct xftfont_info), Qxft, entity, size); ASET (font_object, FONT_FILE_INDEX, filename); - ASET (font_object, FONT_FORMAT_INDEX, - ftfont_font_format (xftfont->pattern, filename)); font = XFONT_OBJECT (font_object); font->pixel_size = size; font->driver = &xftfont_driver; -- 2.39.2