diff --git a/src/config.rs b/src/config.rs index c872c9d5c..b8ed85157 100644 --- a/src/config.rs +++ b/src/config.rs @@ -195,6 +195,7 @@ impl TextStyle { } pub fn font_with_fallback(&self) -> Vec { + #[allow(unused_mut)] let mut font = self.font.clone(); #[cfg(target_os = "macos")] font.push(FontAttributes { diff --git a/src/font/fontconfigandfreetype.rs b/src/font/fontconfigandfreetype.rs index 8154ea6c0..01412d40a 100644 --- a/src/font/fontconfigandfreetype.rs +++ b/src/font/fontconfigandfreetype.rs @@ -18,7 +18,12 @@ impl FontConfigAndFreeType { } impl FontSystem for FontConfigAndFreeType { - fn load_font(&self, config: &Config, style: &TextStyle) -> Result, Error> { + fn load_font( + &self, + config: &Config, + style: &TextStyle, + font_scale: f64, + ) -> Result, Error> { let fonts = style.font_with_fallback(); let mut pattern = if fonts.len() >= 1 { let mut pattern = FontPattern::new()?; @@ -41,7 +46,7 @@ impl FontSystem for FontConfigAndFreeType { } else { FontPattern::parse(&style.fontconfig_pattern)? }; - pattern.add_double("size", config.font_size)?; + pattern.add_double("size", config.font_size * font_scale)?; pattern.add_double("dpi", config.dpi)?; Ok(Box::new(NamedFontImpl::new(pattern)?)) diff --git a/src/guiloop/x11.rs b/src/guiloop/x11.rs index 687ce1c0d..81e21c788 100644 --- a/src/guiloop/x11.rs +++ b/src/guiloop/x11.rs @@ -257,7 +257,7 @@ impl GuiEventLoop { // we always load the cell_height for font 0, // regardless of which font we are shaping here, // so that we can scale glyphs appropriately - let metrics = fontconfig.default_font_metrics(); + let metrics = fontconfig.default_font_metrics()?; let initial_cols = 80u16; let initial_rows = 24u16;