diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c index e745a31..98cb9f1 100644 --- a/libass/ass_shaper.c +++ b/libass/ass_shaper.c @@ -29,7 +29,7 @@ #define MAX_RUNS 50 #ifdef CONFIG_HARFBUZZ -#include +#include enum { VERT = 0, VKNA, @@ -352,6 +352,7 @@ static hb_font_t *get_hb_font(ASS_Shaper *shaper, GlyphInfo *info) { ASS_Font *font = info->font; hb_font_t **hb_fonts; + struct ass_shaper_metrics_data *metrics; if (!font->shaper_priv) font->shaper_priv = calloc(sizeof(ASS_ShaperFontData), 1); @@ -359,18 +360,19 @@ static hb_font_t *get_hb_font(ASS_Shaper *shaper, GlyphInfo *info) hb_fonts = font->shaper_priv->fonts; if (!hb_fonts[info->face_index]) { + hb_font_funcs_t *funcs; + hb_fonts[info->face_index] = hb_ft_font_create(font->faces[info->face_index], NULL); // set up cached metrics access font->shaper_priv->metrics_data[info->face_index] = calloc(sizeof(struct ass_shaper_metrics_data), 1); - struct ass_shaper_metrics_data *metrics = - font->shaper_priv->metrics_data[info->face_index]; + metrics = font->shaper_priv->metrics_data[info->face_index]; metrics->metrics_cache = shaper->metrics_cache; metrics->vertical = info->font->desc.vertical; - hb_font_funcs_t *funcs = hb_font_funcs_create(); + funcs = hb_font_funcs_create(); font->shaper_priv->font_funcs[info->face_index] = funcs; hb_font_funcs_set_glyph_func(funcs, get_glyph, metrics, NULL); @@ -400,8 +402,7 @@ static hb_font_t *get_hb_font(ASS_Shaper *shaper, GlyphInfo *info) update_hb_size(hb_fonts[info->face_index], font->faces[info->face_index]); // update hash key for cached metrics - struct ass_shaper_metrics_data *metrics = - font->shaper_priv->metrics_data[info->face_index]; + metrics = font->shaper_priv->metrics_data[info->face_index]; metrics->hash_key.font = info->font; metrics->hash_key.face_index = info->face_index; metrics->hash_key.size = info->font_size;