diff --git a/wezterm-font/src/lib.rs b/wezterm-font/src/lib.rs index a70041874..208cbb06b 100644 --- a/wezterm-font/src/lib.rs +++ b/wezterm-font/src/lib.rs @@ -523,6 +523,10 @@ impl FontConfiguration { self.inner.config_changed(config) } + pub fn config(&self) -> ConfigHandle { + self.inner.config.borrow().clone() + } + /// Given a text style, load (with caching) the font that best /// matches according to the fontconfig pattern. pub fn resolve_font(&self, style: &TextStyle) -> anyhow::Result> { diff --git a/wezterm-gui/src/glyphcache.rs b/wezterm-gui/src/glyphcache.rs index ec182b168..807a2f379 100644 --- a/wezterm-gui/src/glyphcache.rs +++ b/wezterm-gui/src/glyphcache.rs @@ -9,7 +9,7 @@ use ::window::glium; use ::window::glium::backend::Context as GliumContext; use ::window::glium::texture::SrgbTexture2d; use ::window::{Point, Rect}; -use config::{configuration, AllowSquareGlyphOverflow, TextStyle}; +use config::{AllowSquareGlyphOverflow, TextStyle}; use euclid::num::Zero; use lru::LruCache; use std::collections::HashMap; @@ -495,7 +495,7 @@ impl GlyphCache { let is_square_or_wide = aspect >= 0.9; let allow_width_overflow = if is_square_or_wide { - match configuration().allow_square_glyphs_to_overflow_width { + match self.fonts.config().allow_square_glyphs_to_overflow_width { AllowSquareGlyphOverflow::Never => false, AllowSquareGlyphOverflow::Always => true, AllowSquareGlyphOverflow::WhenFollowedBySpace => followed_by_space, diff --git a/wezterm-gui/src/utilsprites.rs b/wezterm-gui/src/utilsprites.rs index dd93531cc..c776dee25 100644 --- a/wezterm-gui/src/utilsprites.rs +++ b/wezterm-gui/src/utilsprites.rs @@ -4,7 +4,6 @@ use ::window::bitmaps::{BitmapImage, Image, Texture2d}; use ::window::color::SrgbaPixel; use ::window::{Point, Rect, Size}; use anyhow::Context; -use config::configuration; use std::rc::Rc; use termwiz::surface::CursorShape; use wezterm_font::units::*; @@ -26,7 +25,7 @@ impl RenderMetrics { .default_font_metrics() .context("failed to get font metrics!?")?; - let line_height = configuration().line_height; + let line_height = fonts.config().line_height; let (cell_height, cell_width) = ( (metrics.cell_height.get() * line_height).ceil() as usize,