From 7abcdfb8fd9d3ac61a36c7e1e2284cbdb05fac75 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 14 Mar 2013 15:48:55 +0000 Subject: Drop no longer needed glyph_widths cache git-svn-id: svn://tug.org/texlive/trunk@29388 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/xdvipdfmx/ChangeLog | 2 ++ Build/source/texk/xdvipdfmx/src/dvi.c | 35 ++++++++++--------------------- Build/source/texk/xdvipdfmx/src/fontmap.c | 7 ------- Build/source/texk/xdvipdfmx/src/fontmap.h | 1 - 4 files changed, 13 insertions(+), 32 deletions(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/xdvipdfmx/ChangeLog b/Build/source/texk/xdvipdfmx/ChangeLog index 73e749b54bc..99d540390c7 100644 --- a/Build/source/texk/xdvipdfmx/ChangeLog +++ b/Build/source/texk/xdvipdfmx/ChangeLog @@ -11,6 +11,8 @@ for XDV_FLAG_FONTTYPE_* flags as they do nothing. * src/dvi.c (do_glyph_array): Use FT_Get_Advance() instead of the slower FT_Load_Glyph(). + * src/dvi.c, src/fontmap.c, src/fontmap.h: Drop no longer needed + glyph_widths cache. 2013-02-25 Peter Breitenlohner diff --git a/Build/source/texk/xdvipdfmx/src/dvi.c b/Build/source/texk/xdvipdfmx/src/dvi.c index c713732cce3..e4f56d73969 100644 --- a/Build/source/texk/xdvipdfmx/src/dvi.c +++ b/Build/source/texk/xdvipdfmx/src/dvi.c @@ -128,7 +128,6 @@ static struct loaded_font #ifdef XETEX unsigned long rgba_color; FT_Face ft_face; - unsigned short *glyph_widths; int layout_dir; float extend; float slant; @@ -1063,14 +1062,6 @@ dvi_locate_native_font (const char *ps_name, free(fontmap_key); loaded_fonts[cur_id].ft_face = mrec->opt.ft_face; - if (mrec->opt.glyph_widths == NULL) { - /* this is the first loaded_font that refers to this fontmap record, - so allocate the glyph_width cache and save it in the fontmap */ - mrec->opt.glyph_widths = NEW(mrec->opt.ft_face->num_glyphs, unsigned short); - for (i = 0; i < mrec->opt.ft_face->num_glyphs; ++i) - mrec->opt.glyph_widths[i] = 0xffff; - } - loaded_fonts[cur_id].glyph_widths = mrec->opt.glyph_widths; loaded_fonts[cur_id].layout_dir = layout_dir; loaded_fonts[cur_id].extend = mrec->opt.extend; loaded_fonts[cur_id].slant = mrec->opt.slant; @@ -1935,22 +1926,18 @@ do_glyph_array (int yLocsPresent) glyph_id = get_buffered_unsigned_pair(); /* freetype glyph index */ if (glyph_id < font->ft_face->num_glyphs) { - if (font->glyph_widths[glyph_id] == 0xffff) { - FT_Error error; - FT_Fixed advance; - int flags = FT_LOAD_NO_SCALE; - - if (font->layout_dir == 1) - flags |= FT_LOAD_VERTICAL_LAYOUT; - - error = FT_Get_Advance(font->ft_face, glyph_id, flags, &advance); - if (error) - font->glyph_widths[glyph_id] = 0; - else - font->glyph_widths[glyph_id] = advance; - } + FT_Error error; + FT_Fixed advance; + int flags = FT_LOAD_NO_SCALE; + + if (font->layout_dir == 1) + flags |= FT_LOAD_VERTICAL_LAYOUT; + + error = FT_Get_Advance(font->ft_face, glyph_id, flags, &advance); + if (error) + advance = 0; - glyph_width = (double)font->size * (double)font->glyph_widths[glyph_id] / (double)font->ft_face->units_per_EM; + glyph_width = (double)font->size * (double)advance / (double)font->ft_face->units_per_EM; glyph_width = glyph_width * font->extend; if (compute_boxes && link_annot && marked_depth >= tagged_depth) { pdf_rect rect; diff --git a/Build/source/texk/xdvipdfmx/src/fontmap.c b/Build/source/texk/xdvipdfmx/src/fontmap.c index 12957ddda30..044dea7d803 100644 --- a/Build/source/texk/xdvipdfmx/src/fontmap.c +++ b/Build/source/texk/xdvipdfmx/src/fontmap.c @@ -86,7 +86,6 @@ pdf_init_fontmap_record (fontmap_rec *mrec) #ifdef XETEX mrec->opt.ft_face = NULL; - mrec->opt.glyph_widths = NULL; #endif } @@ -112,10 +111,6 @@ pdf_clear_fontmap_record (fontmap_rec *mrec) RELEASE(mrec->opt.otl_tags); if (mrec->opt.charcoll) RELEASE(mrec->opt.charcoll); -#ifdef XETEX - if (mrec->opt.glyph_widths) - RELEASE(mrec->opt.glyph_widths); -#endif pdf_init_fontmap_record(mrec); } @@ -160,7 +155,6 @@ pdf_copy_fontmap_record (fontmap_rec *dst, const fontmap_rec *src) #ifdef XETEX dst->opt.ft_face = src->opt.ft_face; - dst->opt.glyph_widths = src->opt.glyph_widths; #endif } @@ -1077,7 +1071,6 @@ pdf_insert_native_fontmap_record (const char *name, const char *path, int index, mrec->font_name = (path != NULL) ? mstrdup(path) : NULL; mrec->opt.index = index; mrec->opt.ft_face = face; - mrec->opt.glyph_widths = NULL; if (layout_dir != 0) mrec->opt.flags |= FONTMAP_OPT_VERT; diff --git a/Build/source/texk/xdvipdfmx/src/fontmap.h b/Build/source/texk/xdvipdfmx/src/fontmap.h index c257e692c78..fee6f238fa5 100644 --- a/Build/source/texk/xdvipdfmx/src/fontmap.h +++ b/Build/source/texk/xdvipdfmx/src/fontmap.h @@ -60,7 +60,6 @@ typedef struct fontmap_opt { int stemv; /* StemV value especially for CJK fonts */ #ifdef XETEX FT_Face ft_face; - unsigned short *glyph_widths; #endif } fontmap_opt; -- cgit v1.2.3