aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2014-07-09 10:25:35 +0400
committerDmitry Antipov2014-07-09 10:25:35 +0400
commit876d043fad0062a85ede5ab4f70c2e7f6d0e77ac (patch)
treef4371a2bb4fbc392d9cbf96283373cfbff45d9c6 /src
parent388b22deb41bd53d9294c0e4dcfb6af286252884 (diff)
downloademacs-876d043fad0062a85ede5ab4f70c2e7f6d0e77ac.tar.gz
emacs-876d043fad0062a85ede5ab4f70c2e7f6d0e77ac.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog17
-rw-r--r--src/font.h15
-rw-r--r--src/ftfont.c41
-rw-r--r--src/ftfont.h1
-rw-r--r--src/nsfont.m3
-rw-r--r--src/w32font.c17
-rw-r--r--src/w32uniscribe.c2
-rw-r--r--src/xfont.c2
-rw-r--r--src/xftfont.c2
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 @@
12014-07-09 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Next minor cleanup of font subsystem.
4 * font.h (enum font_property_index): Remove FONT_ENTITY_INDEX (no
5 users) and FONT_FORMAT_INDEX (set by a few font drivers but never
6 really used).
7 (FONT_ENTITY_NOT_LOADABLE, FONT_ENTITY_SET_NOT_LOADABLE): Remove;
8 unused.
9 * ftfont.h (ftfont_font_format): Remove prototype.
10 * ftfont.c (ftfont_font_format): Remove; now unused.
11 (ftfont_open):
12 * nsfont.m (nsfont_open):
13 * w32font.c (w32font_open_internal):
14 * w32uniscribe.c (uniscribe_open):
15 * xfont.c (xfont_open):
16 * xftfont.c (xftfont_open): All users changed.
17
12014-07-09 Eli Zaretskii <eliz@gnu.org> 182014-07-09 Eli Zaretskii <eliz@gnu.org>
2 19
3 * xdisp.c (move_it_to): Adjust calculation of line_start_x to what 20 * 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
162 /* List of font-objects opened from the font-entity. */ 162 /* List of font-objects opened from the font-entity. */
163 FONT_OBJLIST_INDEX = FONT_SPEC_MAX, 163 FONT_OBJLIST_INDEX = FONT_SPEC_MAX,
164 164
165 /* Font-entity from which the font-object is opened. */
166 FONT_ENTITY_INDEX = FONT_SPEC_MAX,
167
168 /* This value is the length of font-entity vector. */ 165 /* This value is the length of font-entity vector. */
169 FONT_ENTITY_MAX, 166 FONT_ENTITY_MAX,
170 167
@@ -182,9 +179,6 @@ enum font_property_index
182 is not available. */ 179 is not available. */
183 FONT_FILE_INDEX, 180 FONT_FILE_INDEX,
184 181
185 /* Format of the font (symbol) or nil if unknown. */
186 FONT_FORMAT_INDEX,
187
188 /* This value is the length of font-object vector. */ 182 /* This value is the length of font-object vector. */
189 FONT_OBJECT_MAX 183 FONT_OBJECT_MAX
190 }; 184 };
@@ -442,15 +436,6 @@ struct font_bitmap
442#define FONT_OBJECT_P(x) \ 436#define FONT_OBJECT_P(x) \
443 (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX) 437 (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX)
444 438
445/* True iff ENTITY can't be loaded. */
446#define FONT_ENTITY_NOT_LOADABLE(entity) \
447 EQ (AREF (entity, FONT_OBJLIST_INDEX), Qt)
448
449/* Flag ENTITY not loadable. */
450#define FONT_ENTITY_SET_NOT_LOADABLE(entity) \
451 ASET (entity, FONT_OBJLIST_INDEX, Qt)
452
453
454/* Check macros for various font-related objects. */ 439/* Check macros for various font-related objects. */
455 440
456#define CHECK_FONT(x) \ 441#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)
1223 font_object = font_build_object (VECSIZE (struct ftfont_info), 1223 font_object = font_build_object (VECSIZE (struct ftfont_info),
1224 Qfreetype, entity, size); 1224 Qfreetype, entity, size);
1225 ASET (font_object, FONT_FILE_INDEX, filename); 1225 ASET (font_object, FONT_FILE_INDEX, filename);
1226 ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (NULL, filename));
1227 font = XFONT_OBJECT (font_object); 1226 font = XFONT_OBJECT (font_object);
1228 ftfont_info = (struct ftfont_info *) font; 1227 ftfont_info = (struct ftfont_info *) font;
1229 ftfont_info->ft_size = ft_face->size; 1228 ftfont_info->ft_size = ft_face->size;
@@ -2587,46 +2586,6 @@ ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
2587#endif /* HAVE_OTF_GET_VARIATION_GLYPHS */ 2586#endif /* HAVE_OTF_GET_VARIATION_GLYPHS */
2588#endif /* HAVE_LIBOTF */ 2587#endif /* HAVE_LIBOTF */
2589 2588
2590Lisp_Object
2591ftfont_font_format (FcPattern *pattern, Lisp_Object filename)
2592{
2593 FcChar8 *str;
2594
2595#ifdef FC_FONTFORMAT
2596 if (pattern)
2597 {
2598 if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch)
2599 return Qnil;
2600 if (strcmp ((char *) str, "TrueType") == 0)
2601 return intern ("truetype");
2602 if (strcmp ((char *) str, "Type 1") == 0)
2603 return intern ("type1");
2604 if (strcmp ((char *) str, "PCF") == 0)
2605 return intern ("pcf");
2606 if (strcmp ((char *) str, "BDF") == 0)
2607 return intern ("bdf");
2608 }
2609#endif /* FC_FONTFORMAT */
2610 if (STRINGP (filename))
2611 {
2612 int len = SBYTES (filename);
2613
2614 if (len >= 4)
2615 {
2616 str = (FcChar8 *) (SDATA (filename) + len - 4);
2617 if (xstrcasecmp ((char *) str, ".ttf") == 0)
2618 return intern ("truetype");
2619 if (xstrcasecmp ((char *) str, ".pfb") == 0)
2620 return intern ("type1");
2621 if (xstrcasecmp ((char *) str, ".pcf") == 0)
2622 return intern ("pcf");
2623 if (xstrcasecmp ((char *) str, ".bdf") == 0)
2624 return intern ("bdf");
2625 }
2626 }
2627 return intern ("unknown");
2628}
2629
2630static const char *const ftfont_booleans [] = { 2589static const char *const ftfont_booleans [] = {
2631 ":antialias", 2590 ":antialias",
2632 ":hinting", 2591 ":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 <http://www.gnu.org/licenses/>. */
36#endif /* HAVE_M17N_FLT */ 36#endif /* HAVE_M17N_FLT */
37#endif /* HAVE_LIBOTF */ 37#endif /* HAVE_LIBOTF */
38 38
39extern Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object);
40extern FcCharSet *ftfont_get_fc_charset (Lisp_Object); 39extern FcCharSet *ftfont_get_fc_charset (Lisp_Object);
41 40
42#endif /* EMACS_FTFONT_H */ 41#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)
830 font->baseline_offset = 0; 830 font->baseline_offset = 0;
831 font->relative_compose = 0; 831 font->relative_compose = 0;
832 832
833 font->props[FONT_FORMAT_INDEX] = Qns;
834 font->props[FONT_FILE_INDEX] = Qnil;
835
836 { 833 {
837 const char *fontName = [[nsfont fontName] UTF8String]; 834 const char *fontName = [[nsfont fontName] UTF8String];
838 835
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,
886 LOGFONT logfont; 886 LOGFONT logfont;
887 HDC dc; 887 HDC dc;
888 HFONT hfont, old_font; 888 HFONT hfont, old_font;
889 Lisp_Object val, extra; 889 Lisp_Object val;
890 struct w32font_info *w32_font; 890 struct w32font_info *w32_font;
891 struct font * font; 891 struct font * font;
892 OUTLINETEXTMETRICW* metrics = NULL; 892 OUTLINETEXTMETRICW* metrics = NULL;
@@ -979,21 +979,6 @@ w32font_open_internal (struct frame *f, Lisp_Object font_entity,
979 font->default_ascent = w32_font->metrics.tmAscent; 979 font->default_ascent = w32_font->metrics.tmAscent;
980 font->pixel_size = size; 980 font->pixel_size = size;
981 font->driver = &w32font_driver; 981 font->driver = &w32font_driver;
982 /* Use format cached during list, as the information we have access to
983 here is incomplete. */
984 extra = AREF (font_entity, FONT_EXTRA_INDEX);
985 if (CONSP (extra))
986 {
987 val = assq_no_quit (QCformat, extra);
988 if (CONSP (val))
989 font->props[FONT_FORMAT_INDEX] = XCDR (val);
990 else
991 font->props[FONT_FORMAT_INDEX] = Qunknown;
992 }
993 else
994 font->props[FONT_FORMAT_INDEX] = Qunknown;
995
996 font->props[FONT_FILE_INDEX] = Qnil;
997 font->encoding_charset = -1; 982 font->encoding_charset = -1;
998 font->repertory_charset = -1; 983 font->repertory_charset = -1;
999 /* TODO: do we really want the minimum width here, which could be negative? */ 984 /* 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)
127 /* Uniscribe backend uses glyph indices. */ 127 /* Uniscribe backend uses glyph indices. */
128 uniscribe_font->w32_font.glyph_idx = ETO_GLYPH_INDEX; 128 uniscribe_font->w32_font.glyph_idx = ETO_GLYPH_INDEX;
129 129
130 /* Mark the format as opentype */
131 uniscribe_font->w32_font.font.props[FONT_FORMAT_INDEX] = Qopentype;
132 uniscribe_font->w32_font.font.driver = &uniscribe_font_driver; 130 uniscribe_font->w32_font.font.driver = &uniscribe_font_driver;
133 131
134 return font_object; 132 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)
804 ASET (font_object, FONT_NAME_INDEX, make_string (buf, len)); 804 ASET (font_object, FONT_NAME_INDEX, make_string (buf, len));
805 } 805 }
806 ASET (font_object, FONT_FULLNAME_INDEX, fullname); 806 ASET (font_object, FONT_FULLNAME_INDEX, fullname);
807 ASET (font_object, FONT_FILE_INDEX, Qnil);
808 ASET (font_object, FONT_FORMAT_INDEX, Qx);
809 font = XFONT_OBJECT (font_object); 807 font = XFONT_OBJECT (font_object);
810 ((struct xfont_info *) font)->xfont = xfont; 808 ((struct xfont_info *) font)->xfont = xfont;
811 ((struct xfont_info *) font)->display = FRAME_X_DISPLAY (f); 809 ((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)
343 font_object = font_build_object (VECSIZE (struct xftfont_info), 343 font_object = font_build_object (VECSIZE (struct xftfont_info),
344 Qxft, entity, size); 344 Qxft, entity, size);
345 ASET (font_object, FONT_FILE_INDEX, filename); 345 ASET (font_object, FONT_FILE_INDEX, filename);
346 ASET (font_object, FONT_FORMAT_INDEX,
347 ftfont_font_format (xftfont->pattern, filename));
348 font = XFONT_OBJECT (font_object); 346 font = XFONT_OBJECT (font_object);
349 font->pixel_size = size; 347 font->pixel_size = size;
350 font->driver = &xftfont_driver; 348 font->driver = &xftfont_driver;