summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-03-14 15:48:49 +0000
committerKhaled Hosny <khaledhosny@eglug.org>2013-03-14 15:48:49 +0000
commite265f0bf192527d6c83b273cd918b6c122a991a9 (patch)
treea0c2245c772d80ff26ace5e37fd1d37ead572416 /Build
parent7e8e56214b29dda841f215324c3f1e732e09c2e6 (diff)
Use FT_Get_Advance() instead of the slower FT_Load_Glyph()
git-svn-id: svn://tug.org/texlive/trunk@29387 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/xdvipdfmx/ChangeLog2
-rw-r--r--Build/source/texk/xdvipdfmx/src/dvi.c19
2 files changed, 17 insertions, 4 deletions
diff --git a/Build/source/texk/xdvipdfmx/ChangeLog b/Build/source/texk/xdvipdfmx/ChangeLog
index 1caa7c86b50..73e749b54bc 100644
--- a/Build/source/texk/xdvipdfmx/ChangeLog
+++ b/Build/source/texk/xdvipdfmx/ChangeLog
@@ -9,6 +9,8 @@
style names that we no longer use.
* src/dvi.c (read_native_font_record, do_native_font_def): Don't check
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().
2013-02-25 Peter Breitenlohner <peb@mppmu.mpg.de>
diff --git a/Build/source/texk/xdvipdfmx/src/dvi.c b/Build/source/texk/xdvipdfmx/src/dvi.c
index 4025c9793d9..c713732cce3 100644
--- a/Build/source/texk/xdvipdfmx/src/dvi.c
+++ b/Build/source/texk/xdvipdfmx/src/dvi.c
@@ -66,6 +66,7 @@
#include "ft2build.h"
#include FT_FREETYPE_H
#include FT_TRUETYPE_TABLES_H
+#include FT_ADVANCES_H
#endif
#define DVI_STACK_DEPTH_MAX 256u
@@ -1932,13 +1933,23 @@ do_glyph_array (int yLocsPresent)
}
for (i = 0; i < slen; i++) {
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_Load_Glyph(font->ft_face, glyph_id, FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
- font->glyph_widths[glyph_id] = (font->layout_dir == 0)
- ? font->ft_face->glyph->metrics.horiAdvance
- : font->ft_face->glyph->metrics.vertAdvance;
+ 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;
}
+
glyph_width = (double)font->size * (double)font->glyph_widths[glyph_id] / (double)font->ft_face->units_per_EM;
glyph_width = glyph_width * font->extend;
if (compute_boxes && link_annot && marked_depth >= tagged_depth) {