diff options
Diffstat (limited to 'alacritty/src/renderer/text/glyph_cache.rs')
-rw-r--r-- | alacritty/src/renderer/text/glyph_cache.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs index b57b10b7..72415900 100644 --- a/alacritty/src/renderer/text/glyph_cache.rs +++ b/alacritty/src/renderer/text/glyph_cache.rs @@ -264,19 +264,22 @@ impl GlyphCache { loader.load_glyph(&glyph) } - /// Clear currently cached data in both GL and the registry. - pub fn clear_glyph_cache<L: LoadGlyph>(&mut self, loader: &mut L) { + /// Reset currently cached data in both GL and the registry to default state. + pub fn reset_glyph_cache<L: LoadGlyph>(&mut self, loader: &mut L) { loader.clear(); - self.cache = HashMap::default(); + self.cache = Default::default(); self.load_common_glyphs(loader); } - pub fn update_font_size<L: LoadGlyph>( + /// Update the inner font size. + /// + /// NOTE: To reload the renderers's fonts [`Self::reset_glyph_cache`] should be called + /// afterwards. + pub fn update_font_size( &mut self, font: &Font, scale_factor: f64, - loader: &mut L, ) -> Result<(), crossfont::Error> { // Update dpi scaling. self.rasterizer.update_dpr(scale_factor as f32); @@ -304,8 +307,6 @@ impl GlyphCache { self.metrics = metrics; self.builtin_box_drawing = font.builtin_box_drawing; - self.clear_glyph_cache(loader); - Ok(()) } |