mirror of
https://github.com/wez/wezterm.git
synced 2024-12-26 23:04:49 +03:00
CoreText renderer is now the default on macOS
I've added dingbats to the fallback list on macos as that is needed for some symbols we use in tools at work. With that, and some tweaks for allowing for missing letter glyphs when loading a symbol font as a fallback, we can make that the default for macOS Closes https://github.com/wez/wezterm/issues/5
This commit is contained in:
parent
c818225a5d
commit
332b0faeaa
@ -208,6 +208,12 @@ impl TextStyle {
|
||||
bold: None,
|
||||
italic: None,
|
||||
});
|
||||
#[cfg(target_os = "macos")]
|
||||
font.push(FontAttributes {
|
||||
family: "Zapf Dingbats".into(),
|
||||
bold: None,
|
||||
italic: None,
|
||||
});
|
||||
#[cfg(windows)]
|
||||
font.push(FontAttributes {
|
||||
family: "Segoe UI".into(),
|
||||
|
@ -108,7 +108,7 @@ fn glyph_index(ct_font: &CTFont, codepoint: char) -> Option<CGGlyph> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
struct Metrics {
|
||||
font_metrics: FontMetrics,
|
||||
ascent: f64,
|
||||
@ -150,8 +150,9 @@ impl CoreTextFontImpl {
|
||||
let w_metrics = metrics('W', &ct_font);
|
||||
let m_metrics = metrics('M', &ct_font);
|
||||
let zero_metrics = metrics('0', &ct_font);
|
||||
let metrics =
|
||||
w_metrics.unwrap_or_else(|| m_metrics.unwrap_or_else(|| zero_metrics.unwrap()));
|
||||
let metrics = w_metrics.unwrap_or_else(|| {
|
||||
m_metrics.unwrap_or_else(|| zero_metrics.unwrap_or_else(|| Default::default()))
|
||||
});
|
||||
Self {
|
||||
ct_font,
|
||||
hb_font,
|
||||
|
@ -58,10 +58,12 @@ impl Default for FontSystemSelection {
|
||||
not(feature = "force-rusttype")
|
||||
)) {
|
||||
FontSystemSelection::FontConfigAndFreeType
|
||||
} else if cfg!(not(feature = "force-rusttype")) {
|
||||
FontSystemSelection::FontLoaderAndFreeType
|
||||
} else {
|
||||
} else if cfg!(feature = "force-rusttype") {
|
||||
FontSystemSelection::FontLoaderAndRustType
|
||||
} else if cfg!(target_os = "macos") {
|
||||
FontSystemSelection::CoreText
|
||||
} else {
|
||||
FontSystemSelection::FontLoaderAndFreeType
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,7 +106,7 @@ impl std::str::FromStr for FontSystemSelection {
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.to_lowercase().as_ref() {
|
||||
"fontconfigandfreetype" => Ok(FontSystemSelection::FontConfigAndFreeType),
|
||||
"fontloadandfreetype" => Ok(FontSystemSelection::FontLoaderAndFreeType),
|
||||
"fontloaderandfreetype" => Ok(FontSystemSelection::FontLoaderAndFreeType),
|
||||
"fontloaderandrusttype" => Ok(FontSystemSelection::FontLoaderAndRustType),
|
||||
"coretext" => Ok(FontSystemSelection::CoreText),
|
||||
_ => Err(format_err!(
|
||||
|
Loading…
Reference in New Issue
Block a user