[util] Use post_parse in font_options_t
This commit is contained in:
parent
e0d7060f80
commit
24a9d8c78d
|
@ -51,7 +51,7 @@ struct font_options_t : face_options_t
|
|||
|
||||
void add_options (option_parser_t *parser);
|
||||
|
||||
hb_font_t *get_font () const;
|
||||
void post_parse (GError **error);
|
||||
|
||||
hb_variation_t *variations = nullptr;
|
||||
unsigned int num_variations = 0;
|
||||
|
@ -64,8 +64,7 @@ struct font_options_t : face_options_t
|
|||
char *font_funcs = nullptr;
|
||||
int ft_load_flags = 2;
|
||||
|
||||
private:
|
||||
mutable hb_font_t *font = nullptr;
|
||||
hb_font_t *font = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -80,12 +79,10 @@ static struct supported_font_funcs_t {
|
|||
{"ot", hb_ot_font_set_funcs},
|
||||
};
|
||||
|
||||
hb_font_t *
|
||||
font_options_t::get_font () const
|
||||
{
|
||||
if (font)
|
||||
return font;
|
||||
|
||||
void
|
||||
font_options_t::post_parse (GError **error)
|
||||
{
|
||||
font = hb_font_create (face);
|
||||
|
||||
if (font_size_x == FONT_SIZE_UPEM)
|
||||
|
@ -137,8 +134,6 @@ font_options_t::get_font () const
|
|||
#ifdef HAVE_FREETYPE
|
||||
hb_ft_font_set_load_flags (font, ft_load_flags);
|
||||
#endif
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ struct shape_closure_consumer_t
|
|||
void init (const font_options_t *font_opts)
|
||||
{
|
||||
glyphs = hb_set_create ();
|
||||
font = hb_font_reference (font_opts->get_font ());
|
||||
font = hb_font_reference (font_opts->font);
|
||||
failed = false;
|
||||
buffer = hb_buffer_create ();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ struct output_buffer_t : output_options_t
|
|||
get_file_handle ();
|
||||
gs = g_string_new (nullptr);
|
||||
line_no = 0;
|
||||
font = hb_font_reference (font_opts->get_font ());
|
||||
font = hb_font_reference (font_opts->font);
|
||||
|
||||
if (!output_format)
|
||||
serialize_format = HB_BUFFER_SERIALIZE_FORMAT_TEXT;
|
||||
|
|
|
@ -79,7 +79,7 @@ void free_ft_library ()
|
|||
static inline cairo_scaled_font_t *
|
||||
helper_cairo_create_scaled_font (const font_options_t *font_opts)
|
||||
{
|
||||
hb_font_t *font = hb_font_reference (font_opts->get_font ());
|
||||
hb_font_t *font = hb_font_reference (font_opts->font);
|
||||
|
||||
cairo_font_face_t *cairo_face;
|
||||
/* We cannot use the FT_Face from hb_font_t, as doing so will confuse hb_font_t because
|
||||
|
|
|
@ -42,7 +42,7 @@ struct shape_consumer_t : shape_options_t
|
|||
|
||||
void init (const font_options_t *font_opts)
|
||||
{
|
||||
font = hb_font_reference (font_opts->get_font ());
|
||||
font = hb_font_reference (font_opts->font);
|
||||
failed = false;
|
||||
buffer = hb_buffer_create ();
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ view_cairo_t::render (const font_options_t *font_opts)
|
|||
int x_sign = font_opts->font_size_x < 0 ? -1 : +1;
|
||||
int y_sign = font_opts->font_size_y < 0 ? -1 : +1;
|
||||
|
||||
hb_font_t *font = font_opts->get_font();
|
||||
hb_font_t *font = font_opts->font;
|
||||
|
||||
if (!have_font_extents)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue