From c1c78ade71fabe826f695704acda836c7bc21bf4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 28 Jun 2022 13:19:12 -0600 Subject: [PATCH] [font] When font changes, drop font shaper data https://github.com/harfbuzz/harfbuzz/issues/3683#issuecomment-1168016509 --- src/hb-font.hh | 2 ++ src/hb-machinery.hh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hb-font.hh b/src/hb-font.hh index 452927ef6..bb402e23e 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -639,6 +639,8 @@ struct hb_font_t bool y_neg = y_scale < 0; y_mult = (y_neg ? -((int64_t) -y_scale << 16) : ((int64_t) y_scale << 16)) / upem; slant_xy = y_scale ? slant * x_scale / y_scale : 0.f; + + data.fini (); } hb_position_t em_mult (int16_t v, int64_t mult) diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index e52a6a412..ff2a99f5e 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -176,7 +176,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t void init0 () {} /* Init, when memory is already set to 0. No-op for us. */ void init () { instance.set_relaxed (nullptr); } - void fini () { do_destroy (instance.get ()); } + void fini () { do_destroy (instance.get ()); init (); } void free_instance () {