prefer local/specific config for a couple more cases

Avoid using `configuration()` when there may be a more specific
config with overrides that we can resolve.
This commit is contained in:
Wez Furlong committed 2021-04-16 09:04:51 -07:00
1 parent 76353a6240
commit 91cd2e22e4
3 files changed
+7 -4

No files matched your search

+4
View File
@@ -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<Rc<LoadedFont>> {
+2 -2
View File
@@ -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<T: Texture2d> GlyphCache<T> {
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,
+1 -2
View File
@@ -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,