[util] Add --ft-load-flags

Useful for performance testing.

Not hooked to cairo yet.  Just changes shaping, not rasterization.
This commit is contained in:
Behdad Esfahbod 2018-09-11 14:21:15 +02:00
parent 93f7596254
commit f90bab8560
3 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;