From 4b791f3ee1f14a31ad529dfd2a090451ff42f60e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 26 Sep 2023 08:18:11 -0700 Subject: [PATCH] renderer: always reset font group on config change --- src/renderer/Metal.zig | 15 ++++++++------- src/renderer/OpenGL.zig | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 8a621c3eb..d21b01449 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -975,13 +975,14 @@ fn prepKittyGraphics( /// Update the configuration. pub fn changeConfig(self: *Metal, config: *DerivedConfig) !void { - // If font thickening settings change, we need to reset our - // font texture completely because we need to re-render the glyphs. - if (self.config.font_thicken != config.font_thicken) { - self.font_group.reset(); - self.font_group.atlas_greyscale.clear(); - self.font_group.atlas_color.clear(); - } + // On configuration change we always reset our font group. There + // are a variety of configurations that can change font settings + // so to be safe we just always reset it. This has a performance hit + // when its not necessary but config reloading shouldn't be so + // common to cause a problem. + self.font_group.reset(); + self.font_group.atlas_greyscale.clear(); + self.font_group.atlas_color.clear(); // We always redo the font shaper in case font features changed. We // could check to see if there was an actual config change but this is diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index 67e682609..b27540635 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -1205,13 +1205,14 @@ fn gridSize(self: *const OpenGL, screen_size: renderer.ScreenSize) renderer.Grid /// Update the configuration. pub fn changeConfig(self: *OpenGL, config: *DerivedConfig) !void { - // If font thickening settings change, we need to reset our - // font texture completely because we need to re-render the glyphs. - if (self.config.font_thicken != config.font_thicken) { - self.font_group.reset(); - self.font_group.atlas_greyscale.clear(); - self.font_group.atlas_color.clear(); - } + // On configuration change we always reset our font group. There + // are a variety of configurations that can change font settings + // so to be safe we just always reset it. This has a performance hit + // when its not necessary but config reloading shouldn't be so + // common to cause a problem. + self.font_group.reset(); + self.font_group.atlas_greyscale.clear(); + self.font_group.atlas_color.clear(); // We always redo the font shaper in case font features changed. We // could check to see if there was an actual config change but this is