From 68f25e2c26de2c5c3624bf0fe6d12a0e9c35e861 Mon Sep 17 00:00:00 2001 From: Rodger Combs Date: Tue, 5 Sep 2017 21:15:40 -0500 Subject: ass_set_fonts: empty cache as well --- libass/ass_render_api.c | 4 ++++ libass/ass_shaper.c | 7 +++++++ libass/ass_shaper.h | 1 + 3 files changed, 12 insertions(+) diff --git a/libass/ass_render_api.c b/libass/ass_render_api.c index 2e61b7e..4930c44 100644 --- a/libass/ass_render_api.c +++ b/libass/ass_render_api.c @@ -146,6 +146,10 @@ void ass_set_fonts(ASS_Renderer *priv, const char *default_font, ass_reconfigure(priv); + ass_cache_empty(priv->cache.font_cache); + if (priv->shaper) + ass_shaper_empty_cache(priv->shaper); + if (priv->fontselect) ass_fontselect_free(priv->fontselect); priv->fontselect = ass_fontselect_init(priv->library, priv->ftlibrary, diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c index 5f24c5a..657885b 100644 --- a/libass/ass_shaper.c +++ b/libass/ass_shaper.c @@ -121,6 +121,13 @@ void ass_shaper_free(ASS_Shaper *shaper) free(shaper); } +void ass_shaper_empty_cache(ASS_Shaper *shaper) +{ +#ifdef CONFIG_HARFBUZZ + ass_cache_empty(shaper->metrics_cache); +#endif +} + void ass_shaper_font_data_free(ASS_ShaperFontData *priv) { #ifdef CONFIG_HARFBUZZ diff --git a/libass/ass_shaper.h b/libass/ass_shaper.h index 0d1dfc2..f6404fe 100644 --- a/libass/ass_shaper.h +++ b/libass/ass_shaper.h @@ -27,6 +27,7 @@ typedef struct ass_shaper ASS_Shaper; void ass_shaper_info(ASS_Library *lib); ASS_Shaper *ass_shaper_new(size_t prealloc); void ass_shaper_free(ASS_Shaper *shaper); +void ass_shaper_empty_cache(ASS_Shaper *shaper); void ass_shaper_set_kerning(ASS_Shaper *shaper, int kern); void ass_shaper_find_runs(ASS_Shaper *shaper, ASS_Renderer *render_priv, GlyphInfo *glyphs, size_t len); -- cgit v1.2.3