mirror of
https://github.com/wez/wezterm.git
synced 2024-11-22 04:56:12 +03:00
fonts: remove last resort font
I was going to upgrade to the unicode 15 font, but in testing this I decided that the logic is slightly complex and the glyphs are often difficult to see at most terminal font sizes, which generates questions from users, so just fall back to notdef.
This commit is contained in:
parent
6282b1f9f2
commit
10cd78a81a
@ -65,10 +65,6 @@ If your distribution offers those fonts as installable packages, then it is
|
||||
recommended that you skip compiling in that font by disabling the associated
|
||||
feature:
|
||||
|
||||
* `vendor-last-resort-font` - causes
|
||||
[LastResortHE-Regular.ttf](https://github.com/unicode-org/last-resort-font)
|
||||
to be compiled in and used as a last resort font (you probably do NOT want to
|
||||
install this font globally).
|
||||
* `vendor-nerd-font-symbols-font` - causes [Symbols Nerd Font
|
||||
Mono](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/NerdFontsSymbolsOnly/complete/Symbols-1000-em%20Nerd%20Font%20Complete%20Mono.ttf)
|
||||
to be compiled in.
|
||||
|
Binary file not shown.
@ -45,6 +45,9 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
[#2500](https://github.com/wez/wezterm/issues/2500)
|
||||
* Cells with the invisible/hidden attribute are now invisible
|
||||
|
||||
#### Changed
|
||||
* Removed Last Resort fallback font
|
||||
|
||||
### 20220905-102802-7d4b8249
|
||||
|
||||
#### New
|
||||
|
@ -11,7 +11,6 @@ vendor-jetbrains = []
|
||||
vendor-roboto = []
|
||||
vendor-noto-emoji = []
|
||||
vendor-nerd-font-symbols = []
|
||||
vendor-last-resort = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
|
@ -95,20 +95,12 @@ impl LoadedFont {
|
||||
}
|
||||
|
||||
fn insert_fallback_handles(&self, extra_handles: Vec<ParsedFont>) -> anyhow::Result<bool> {
|
||||
let has_last_resort_font = cfg!(any(test, feature = "vendor-last-resort"));
|
||||
|
||||
let mut loaded = false;
|
||||
{
|
||||
let mut handles = self.handles.borrow_mut();
|
||||
for h in extra_handles {
|
||||
if !handles.iter().any(|existing| *existing == h) {
|
||||
if has_last_resort_font {
|
||||
let idx = handles.len() - 1;
|
||||
handles.insert(idx, h);
|
||||
self.rasterizers.borrow_mut().remove(&idx);
|
||||
} else {
|
||||
handles.push(h);
|
||||
}
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -739,8 +739,6 @@ pub(crate) fn load_built_in_fonts(font_info: &mut Vec<ParsedFont>) -> anyhow::Re
|
||||
&[font!("../../assets/fonts/NotoColorEmoji.ttf")],
|
||||
#[cfg(any(test, feature = "vendor-nerd-font-symbols"))]
|
||||
&[font!("../../assets/fonts/Symbols-Nerd-Font-Mono.ttf")],
|
||||
#[cfg(any(test, feature = "vendor-last-resort"))]
|
||||
&[font!("../../assets/fonts/LastResortHE-Regular.ttf")],
|
||||
];
|
||||
for bundle in built_ins {
|
||||
for (data, name) in bundle.iter() {
|
||||
|
@ -228,8 +228,7 @@ impl HarfbuzzShaper {
|
||||
|
||||
let shaped_any;
|
||||
|
||||
// We set this to true when we've run out of fallback fonts
|
||||
// to try, including any potential last resort font.
|
||||
// We set this to true when we've run out of fallback fonts to try.
|
||||
// In that case, we accept shaper info with codepoint==0 and
|
||||
// will use the notdef glyph from the base font.
|
||||
let mut no_more_fallbacks = false;
|
||||
@ -237,8 +236,6 @@ impl HarfbuzzShaper {
|
||||
loop {
|
||||
match self.load_fallback(font_idx).context("load_fallback")? {
|
||||
Some(mut pair) => {
|
||||
// Ignore presentation if we've reached the last resort font
|
||||
if !no_more_fallbacks && font_idx + 1 < self.fonts.len() {
|
||||
if let Some(p) = presentation {
|
||||
if pair.presentation != p {
|
||||
log::trace!(
|
||||
@ -251,7 +248,6 @@ impl HarfbuzzShaper {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
let point_size = font_size * self.handles[font_idx].scale.unwrap_or(1.);
|
||||
pair.face.set_font_size(point_size, dpi)?;
|
||||
|
||||
@ -282,17 +278,15 @@ impl HarfbuzzShaper {
|
||||
break;
|
||||
}
|
||||
None => {
|
||||
// Note: since we added a last resort font, this case
|
||||
// shouldn't ever get hit in practice, but if the last
|
||||
// resort font wasn't bundled and isn't installed,
|
||||
// we may land here.
|
||||
for c in s.chars() {
|
||||
no_glyphs.push(c);
|
||||
}
|
||||
|
||||
if presentation.is_some() {
|
||||
log::debug!("last resort, but no last resort font, retry shape with no presentation");
|
||||
// We hit the last resort and we have an explicit presentation.
|
||||
log::debug!(
|
||||
"Ran out of fallback options, retry shape with no presentation"
|
||||
);
|
||||
// Ran out of fallbacks and we have an explicit presentation.
|
||||
// This is a little awkward; we want to record the missing
|
||||
// glyphs so that we can resolve them async, but we also
|
||||
// want to try the current set of fonts without forcing
|
||||
@ -326,42 +320,6 @@ impl HarfbuzzShaper {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "vendor-last-resort"))]
|
||||
if font_idx > 0 && font_idx + 1 == self.fonts.len() {
|
||||
// We are the last resort font, so each codepoint is considered
|
||||
// to be worthy of a fallback lookup
|
||||
for c in s.chars() {
|
||||
no_glyphs.push(c);
|
||||
}
|
||||
|
||||
if presentation.is_some() {
|
||||
log::debug!("hit last resort, retry shape with no presentation");
|
||||
// We hit the last resort and we have an explicit presentation.
|
||||
// This is a little awkward; we want to record the missing
|
||||
// glyphs so that we can resolve them async, but we also
|
||||
// want to try the current set of fonts without forcing
|
||||
// the presentation match as we might find the results
|
||||
// that way.
|
||||
// Let's restart the shape but pretend that no specific
|
||||
// presentation was used.
|
||||
// We'll probably match the emoji presentation for something,
|
||||
// but might potentially discover the text presentation for
|
||||
// that glyph in a fallback font and swap it out a little
|
||||
// later after a flash of showing the emoji one.
|
||||
return self.do_shape(
|
||||
0,
|
||||
s,
|
||||
font_size,
|
||||
dpi,
|
||||
no_glyphs,
|
||||
None,
|
||||
direction,
|
||||
range,
|
||||
presentation_width,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let hb_infos = buf.glyph_infos();
|
||||
let positions = buf.glyph_positions();
|
||||
|
||||
|
@ -12,13 +12,11 @@ resolver = "2"
|
||||
default = ["vendored-fonts", "wayland"]
|
||||
wayland = ["window/wayland"]
|
||||
distro-defaults = ["config/distro-defaults"]
|
||||
vendor-last-resort-font = ["wezterm-font/vendor-last-resort"]
|
||||
vendor-nerd-font-symbols-font = ["wezterm-font/vendor-nerd-font-symbols"]
|
||||
vendor-jetbrains-font = ["wezterm-font/vendor-jetbrains"]
|
||||
vendor-roboto-font = ["wezterm-font/vendor-roboto"]
|
||||
vendor-noto-emoji-font = ["wezterm-font/vendor-noto-emoji"]
|
||||
vendored-fonts = [
|
||||
"vendor-last-resort-font",
|
||||
"vendor-nerd-font-symbols-font",
|
||||
"vendor-jetbrains-font",
|
||||
"vendor-roboto-font",
|
||||
|
Loading…
Reference in New Issue
Block a user