ls-fonts: emulate the effect of normalize_output_to_unicode_nfc
This aids in debugging:
```
; wezterm --config normalize_output_to_unicode_nfc=false ls-fonts --text $(echo a$'\u301\u302')
LeftToRight
0 x_adv=8 cells=1 glyph=aacute,190 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
/usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
0 á̂ \u{61}\u{301}\u{302} x_adv=0 cells=0 glyph=uni0302,1646 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
/usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
```
```
; ./target/debug/wezterm --config normalize_output_to_unicode_nfc=true ls-fonts --text $(echo a$'\u301\u302')
LeftToRight
0 x_adv=8 cells=1 glyph=aacute,190 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
/usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
0 á̂ \u{e1}\u{302} x_adv=0 cells=0 glyph=uni0302,1646 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
/usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
```
refs: #3093
This commit is contained in:
1 file changed
+9
-1
@@ -25,6 +25,7 @@ use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use termwiz::cell::{CellAttributes, UnicodeVersion};
|
||||
use termwiz::surface::{Line, SEQ_ZERO};
|
||||
use unicode_normalization::UnicodeNormalization;
|
||||
use wezterm_bidi::Direction;
|
||||
use wezterm_client::domain::{ClientDomain, ClientDomainConfig};
|
||||
use wezterm_font::shaper::PresentationWidth;
|
||||
@@ -866,8 +867,15 @@ pub fn run_ls_fonts(config: config::ConfigHandle, cmd: &LsFontsCommand) -> anyho
|
||||
};
|
||||
|
||||
if let Some(text) = &text {
|
||||
// Emulate the effect of output normalization
|
||||
let text = if config.normalize_output_to_unicode_nfc {
|
||||
text.nfc().collect()
|
||||
} else {
|
||||
text.to_string()
|
||||
};
|
||||
|
||||
let line = Line::from_text(
|
||||
text,
|
||||
&text,
|
||||
&CellAttributes::default(),
|
||||
SEQ_ZERO,
|
||||
Some(unicode_version),
|
||||
|
||||
Reference in new issue
Block a user