configure.ac | 2 +- src/hb-buffer.cc | 1 + src/hb-ft.cc | 23 ++++++++++++++++------- src/hb-ot-shape-complex-arabic.cc | 1 + util/common.hh | 4 +++- util/options.cc | 8 ++++---- util/options.hh | 4 ++-- 7 files changed, 28 insertions(+), 15 deletions(-)
New commits: commit 0b7e4d9f20b3ed947d0c441ca59b43c4097cdb0e Author: Behdad Esfahbod <[email protected]> Date: Mon Aug 15 20:41:59 2011 +0200 [ft] FT_Get_Advance() for advance-width callbacks Using graphite2's comparerenderer suggests that this makes hb-ft 15 times faster. No caching layer needed anymore. diff --git a/configure.ac b/configure.ac index 6cd1018..f42fb3c 100644 --- a/configure.ac +++ b/configure.ac @@ -134,7 +134,7 @@ AM_CONDITIONAL(HAVE_ICU, $have_icu) dnl ========================================================================== -PKG_CHECK_MODULES(FREETYPE, freetype2, have_freetype=true, have_freetype=false) +PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false) if $have_freetype; then AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library]) _save_libs="$LIBS" diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 25368f1..23c2cc0 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -31,6 +31,7 @@ #include "hb-font-private.hh" +#include FT_ADVANCES_H #include FT_TRUETYPE_TABLES_H @@ -47,9 +48,13 @@ * * - We don't handle any load_flags. That definitely has API implications. :( * I believe hb_ft_font_create() should take load_flags input. + * In particular, FT_Get_Advance() without the NO_HINTING flag seems to be + * buggy. * * - We don't handle / allow for emboldening / obliqueing. * + * - Rounding, etc? + * * - In the future, we should add constructors to create fonts in font space. * * - I believe transforms are not correctly implemented. FreeType does not @@ -89,12 +94,13 @@ hb_ft_get_glyph_h_advance (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { FT_Face ft_face = (FT_Face) font_data; - int load_flags = FT_LOAD_DEFAULT; + int load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING; + FT_Fixed v; - if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags))) + if (unlikely (FT_Get_Advance (ft_face, glyph, load_flags, &v))) return 0; - return ft_face->glyph->metrics.horiAdvance; + return v >> 10; } static hb_position_t @@ -104,14 +110,15 @@ hb_ft_get_glyph_v_advance (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { FT_Face ft_face = (FT_Face) font_data; - int load_flags = FT_LOAD_DEFAULT; + int load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING | FT_LOAD_VERTICAL_LAYOUT; + FT_Fixed v; - if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags))) + if (unlikely (FT_Get_Advance (ft_face, glyph, load_flags, &v))) return 0; /* Note: FreeType's vertical metrics grows downward while other FreeType coordinates * have a Y growing upward. Hence the extra negation. */ - return -ft_face->glyph->metrics.vertAdvance; + return -v >> 10; } static hb_bool_t diff --git a/util/common.hh b/util/common.hh index 5c8baab..58dec6f 100644 --- a/util/common.hh +++ b/util/common.hh @@ -44,6 +44,8 @@ #include <glib.h> #include <glib/gprintf.h> -void fail (const char *format, ...); + +void fail (const char *format, ...) G_GNUC_NORETURN; + #endif commit 97796453aab56873809a15b5e316cba8acea7449 Author: Behdad Esfahbod <[email protected]> Date: Mon Aug 15 19:03:43 2011 +0200 Fix falloffs of the GOption conversion diff --git a/util/options.cc b/util/options.cc index 2bc2c70..d623243 100644 --- a/util/options.cc +++ b/util/options.cc @@ -31,6 +31,8 @@ view_options_t view_opts[1]; shape_options_t shape_opts[1]; font_options_t font_opts[1]; +const char *out_file = "/dev/stdout"; +hb_bool_t debug = FALSE; static gboolean @@ -40,7 +42,7 @@ parse_margin (const char *name G_GNUC_UNUSED, GError **error G_GNUC_UNUSED) { view_options_t::margin_t &m = view_opts->margin; - switch (sscanf (arg, "%f %f %f %f", &m.t, &m.r, &m.b, &m.l)) { + switch (sscanf (arg, "%lf %lf %lf %lf", &m.t, &m.r, &m.b, &m.l)) { case 1: m.r = m.t; case 2: m.b = m.t; case 3: m.l = m.r; @@ -268,7 +270,7 @@ parse_options (int argc, char *argv[]) GOptionEntry entries[] = { {"version", 0, G_OPTION_FLAG_NO_ARG, - G_OPTION_ARG_CALLBACK, (gpointer) &show_version, "Show version numbers", NULL}, + G_OPTION_ARG_CALLBACK, (gpointer) &show_version, "Show version numbers", NULL}, {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Free all resources before exit", NULL}, {"output", 0, 0, G_OPTION_ARG_STRING, &out_file, "Set output file name", "filename"}, @@ -289,10 +291,8 @@ parse_options (int argc, char *argv[]) {NULL} }; - GError *error = NULL; GError *parse_error = NULL; GOptionContext *context; - size_t len; context = g_option_context_new ("- FONT-FILE TEXT"); diff --git a/util/options.hh b/util/options.hh index 4c6e973..9be0b6b 100644 --- a/util/options.hh +++ b/util/options.hh @@ -76,8 +76,8 @@ extern struct font_options_t } font_opts[1]; -static const char *out_file = "/dev/stdout"; -static hb_bool_t debug = FALSE; +extern const char *out_file; +extern hb_bool_t debug; void parse_options (int argc, char *argv[]); commit 4e9ff1dd6ee3ea63fd91a76a91d9725a10a294a0 Author: Behdad Esfahbod <[email protected]> Date: Mon Aug 15 16:21:22 2011 +0200 Pre-allocate buffers when adding string We do a conservative estimate of the number of characters, but still, this limits the number of buffer reallocs to a small constant. diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 3be3f44..3f46d68 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -723,6 +723,7 @@ hb_buffer_guess_properties (hb_buffer_t *buffer) } \ if (item_length == -1) \ item_length = text_length - item_offset; \ + buffer->ensure (buffer->len + item_length * sizeof (T) / 4); \ const T *next = (const T *) text + item_offset; \ const T *end = next + item_length; \ while (next < end) { \ commit 553bc3de82cfda8d83db26a93205e0d39440cbd1 Author: Behdad Esfahbod <[email protected]> Date: Mon Aug 15 16:21:06 2011 +0200 Minor diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 22c7f1b..25368f1 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -325,7 +325,7 @@ hb_ft_face_create_cached (FT_Face ft_face) return hb_face_reference ((hb_face_t *) ft_face->generic.data); } -void +static void _do_nothing (void) { } commit 254142bb67a5c520a304142301479eb5292592d1 Author: Behdad Esfahbod <[email protected]> Date: Mon Aug 15 16:15:44 2011 +0200 [ft] FT_Select_Charmap() when we create face diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 57ab034..22c7f1b 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -405,6 +405,8 @@ hb_ft_font_set_funcs (hb_font_t *font) return; } + FT_Select_Charmap (ft_face, FT_ENCODING_UNICODE); + FT_Set_Char_Size (ft_face, font->x_scale, font->y_scale, font->x_ppem * 72 * 64 / font->x_scale, commit a4cbd03dd17990783d8fd4c6be0c9c0d3d9cae5b Author: Behdad Esfahbod <[email protected]> Date: Mon Aug 15 09:52:05 2011 +0200 Apply 'locl' with 'ccmp' in Arabic shaper According to Peter Constable this is indeed what Uniscribe has been doing for years. Mozilla Bug 667166 - wrong shape of letter when it comes at the end of word in the arabic version of Firefox 5.0 diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 15b0aa4..2b863ef 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -163,6 +163,7 @@ _hb_ot_shape_complex_collect_features_arabic (hb_ot_map_builder_t *map, const hb */ map->add_bool_feature (HB_TAG('c','c','m','p')); + map->add_bool_feature (HB_TAG('l','o','c','l')); map->add_gsub_pause (NULL, NULL); _______________________________________________ HarfBuzz mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/harfbuzz
