From 22522dc39eef241c1aa354ef39b86b8f2d67ba53 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 22 Mar 2021 11:36:45 -0700 Subject: [PATCH] render more symbol/icon/emoji at double width by default Default `allow_square_glyphs_to_overflow_width="WhenFollowedBySpace"`, and expand its meaning from mostly square glyphs to glyphs that are also wider than they are tall. refs: https://github.com/wez/wezterm/issues/565 --- config/src/font.rs | 2 +- docs/changelog.md | 1 + .../lua/config/allow_square_glyphs_to_overflow_width.md | 8 ++++++++ wezterm-gui/src/glyphcache.rs | 9 +++++---- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/config/src/font.rs b/config/src/font.rs index 08dc0108f..730f1cd2b 100644 --- a/config/src/font.rs +++ b/config/src/font.rs @@ -354,7 +354,7 @@ pub enum AllowSquareGlyphOverflow { impl Default for AllowSquareGlyphOverflow { fn default() -> Self { - Self::Never + Self::WhenFollowedBySpace } } diff --git a/docs/changelog.md b/docs/changelog.md index a52663d12..16e5385bd 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -20,6 +20,7 @@ brief notes about them may accumulate here. * Fixed: panic when dismissing the tab navigator [#542](https://github.com/wez/wezterm/issues/542) * Fixed: font fallback on macOS returns unresolvable `.AppleSymbolsFB` rather than `Apple Symbols`, leading to slowdowns when rendering symbols [#506](https://github.com/wez/wezterm/issues/506) * Fixed: laggy repaints for large windows particularly on Windows, but applicable to all systems. Tuned and triple-buffered vertex buffer updates. [#546](https://github.com/wez/wezterm/issues/546) +* Changed: [allow_square_glyphs_to_overflow_width](config/lua/config/allow_square_glyphs_to_overflow_width.md) now defaults to `WhenFollowedBySpace` and applies to more symbol glyphs. [#565](https://github.com/wez/wezterm/issues/565) ### 20210314-114017-04b7cedd diff --git a/docs/config/lua/config/allow_square_glyphs_to_overflow_width.md b/docs/config/lua/config/allow_square_glyphs_to_overflow_width.md index 5ead2eb6b..e7a85d20d 100644 --- a/docs/config/lua/config/allow_square_glyphs_to_overflow_width.md +++ b/docs/config/lua/config/allow_square_glyphs_to_overflow_width.md @@ -9,3 +9,11 @@ Configures how square symbol glyph's cell is rendered: * "Always" - overflow the cell regardless of the next cell being a space. * "Never" (the default) - strictly respect the cell width. + +*Since: nightly builds* + +This setting now applies to any glyph with an aspect ratio +larger than 0.9, which covers more symbol glyphs than in +earlier releases. + +The default value for this setting has changed to `WhenFollowedBySpace`. diff --git a/wezterm-gui/src/glyphcache.rs b/wezterm-gui/src/glyphcache.rs index c5cefec11..db11c4797 100644 --- a/wezterm-gui/src/glyphcache.rs +++ b/wezterm-gui/src/glyphcache.rs @@ -440,9 +440,9 @@ impl GlyphCache { base_metrics.cell_width.get() / (idx_metrics.cell_width.get() / info.num_cells as f64); let aspect = (idx_metrics.cell_height / idx_metrics.cell_width).get(); - let is_square = aspect >= 0.9 && aspect <= 1.1; + let is_square_or_wide = aspect >= 0.9; - let allow_width_overflow = if is_square { + let allow_width_overflow = if is_square_or_wide { match configuration().allow_square_glyphs_to_overflow_width { AllowSquareGlyphOverflow::Never => false, AllowSquareGlyphOverflow::Always => true, @@ -489,13 +489,14 @@ impl GlyphCache { let (scale, raw_im) = if scale != 1.0 { log::trace!( - "physically scaling {:?} by {} bcos {}x{} > {:?}x{:?}", + "physically scaling {:?} by {} bcos {}x{} > {:?}x{:?}. aspect={}", info, scale, glyph.width, glyph.height, cell_width, - cell_height + cell_height, + aspect, ); (1.0, raw_im.scale_by(scale)) } else {