From f90bab8560816b60b4b3f2379b36c08756b21e6c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 11 Sep 2018 14:21:15 +0200 Subject: [PATCH] [util] Add --ft-load-flags Useful for performance testing. Not hooked to cairo yet. Just changes shaping, not rasterization. --- util/helper-cairo.cc | 2 +- util/options.cc | 4 ++++ util/options.hh | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc index 3eaf90a..5914ab7 100644 --- a/util/helper-cairo.cc +++ b/util/helper-cairo.cc @@ -125,7 +125,7 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts) } #endif - cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0); + cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, font_opts->ft_load_flags); } cairo_matrix_t ctm, font_matrix; cairo_font_options_t *font_options; diff --git a/util/options.cc b/util/options.cc index 2902807..0ab16d6 100644 --- a/util/options.cc +++ b/util/options.cc @@ -556,6 +556,7 @@ font_options_t::add_options (option_parser_t *parser) {"font-ppem", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_font_ppem, "Set x,y pixels per EM (default: 0; disabled)", "1/2 integers"}, {"font-ptem", 0, 0, G_OPTION_ARG_DOUBLE, &this->ptem, "Set font point-size (default: 0; disabled)", "point-size"}, {"font-funcs", 0, 0, G_OPTION_ARG_STRING, &this->font_funcs, text, "impl"}, + {"ft-load-flags", 0, 0, G_OPTION_ARG_INT, &this->ft_load_flags, "Set FreeType load-flags (default: 2)", "integer"}, {nullptr} }; parser->add_group (entries, @@ -717,6 +718,9 @@ font_options_t::get_font (void) const } } set_font_funcs (font); +#ifdef HAVE_FREETYPE + hb_ft_font_set_load_flags (font, ft_load_flags); +#endif return font; } diff --git a/util/options.hh b/util/options.hh index 3457909..456e0a0 100644 --- a/util/options.hh +++ b/util/options.hh @@ -454,6 +454,7 @@ struct font_options_t : option_group_t face_index = 0; font_size_x = font_size_y = default_font_size; font_funcs = nullptr; + ft_load_flags = 2; blob = nullptr; font = nullptr; @@ -484,6 +485,7 @@ struct font_options_t : option_group_t mutable double font_size_x; mutable double font_size_y; char *font_funcs; + int ft_load_flags; private: mutable hb_font_t *font; -- 2.7.4