diff --git a/config/src/lib.rs b/config/src/lib.rs index ee9e6c8b6..39c4432d9 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -460,6 +460,9 @@ pub struct Config { #[serde(default = "default_font_size")] pub font_size: f64, + #[serde(default = "default_one_point_oh_f64")] + pub line_height: f64, + #[serde(default)] pub allow_square_glyphs_to_overflow_width: AllowSquareGlyphOverflow, @@ -827,6 +830,10 @@ pub struct Config { pub enable_csi_u_key_encoding: bool, } +fn default_one_point_oh_f64() -> f64 { + 1.0 +} + fn default_one_point_oh() -> f32 { 1.0 } diff --git a/docs/changelog.markdown b/docs/changelog.markdown index 2da27828c..d3630af33 100644 --- a/docs/changelog.markdown +++ b/docs/changelog.markdown @@ -28,6 +28,7 @@ brief notes about them may accumulate here. * Revised pty output processing and removed the related `ratelimit_output_bytes_per_second` option * Workaround Cocoa leaking window position saved state file descriptors to child processes on macOS Big Sur * The 256 color cube now uses slightly brighter colors [#348](https://github.com/wez/wezterm/issues/348) +* New: added `line_height` configuration option to scale the computed cell height. The default is `1.0`, resulting in using the font-specified metrics. Setting it to `1.2` will result in a 20% larger cell height. ### 20201101-103216-403d002d diff --git a/docs/config/fonts.markdown b/docs/config/fonts.markdown index cca948471..fcf2fc208 100644 --- a/docs/config/fonts.markdown +++ b/docs/config/fonts.markdown @@ -28,6 +28,15 @@ return { -- emulators, you may wish to tune this value! dpi = 96.0, + -- (available in nightly builds) + -- Scale the effective cell height. + -- The cell height is computed based on your selected font_size + -- and dpi and then multiplied by line_height. Setting it to + -- eg: 1.2 will result in the spacing between lines being 20% + -- larger than the distance specified by the font author. + -- Setting it to eg: 0.9 will make it 10% smaller. + line_height = 1.0, + -- When true (the default), text that is set to ANSI color -- indices 0-7 will be shifted to the corresponding brighter -- color index (8-15) when the intensity is set to Bold. diff --git a/wezterm-gui/src/gui/utilsprites.rs b/wezterm-gui/src/gui/utilsprites.rs index a185de1a2..8b35b2660 100644 --- a/wezterm-gui/src/gui/utilsprites.rs +++ b/wezterm-gui/src/gui/utilsprites.rs @@ -2,6 +2,7 @@ use super::glyphcache::GlyphCache; use ::window::bitmaps::atlas::{OutOfTextureSpace, Sprite}; use ::window::bitmaps::{BitmapImage, Image, Texture2d}; use ::window::*; +use config::configuration; use std::rc::Rc; use termwiz::surface::CursorShape; use wezterm_font::units::*; @@ -24,8 +25,10 @@ impl RenderMetrics { .default_font_metrics() .expect("failed to get font metrics!?"); + let line_height = configuration().line_height; + let (cell_height, cell_width) = ( - metrics.cell_height.get().ceil() as usize, + (metrics.cell_height.get() * line_height).ceil() as usize, metrics.cell_width.get().ceil() as usize, );