gui: bundle and use Roboto for title font on Linux + Windows
The default we use on macOS looks decent. Roboto is a similar looking font that we can use for the other platforms. I may make it the same on all three once I've had a chance to compare it on a mac.
This commit is contained in:
1 parent
e225589b05
commit
00a393b3d1
16 files changed
+16
-46
No files matched your search
+1
-1
@@ -20,6 +20,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
WezTerm bundles `JetBrains Mono` and `Noto Color Emoji` fonts.
|
||||
WezTerm bundles `JetBrains Mono`, `Noto Color Emoji` and `Roboto` fonts.
|
||||
Those are distributed under the terms of the OFL 1.1, the text of which
|
||||
can be found in the assets/fonts directory.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
-27
@@ -395,7 +395,6 @@ struct FontConfigInner {
|
||||
no_glyphs: RefCell<HashSet<char>>,
|
||||
title_font: RefCell<Option<Rc<LoadedFont>>>,
|
||||
fallback_channel: RefCell<Option<Sender<FallbackResolveInfo>>>,
|
||||
system_title_font: RefCell<Option<(ParsedFont, f64)>>,
|
||||
}
|
||||
|
||||
/// Matches and loads fonts for a given input style
|
||||
@@ -420,7 +419,6 @@ impl FontConfigInner {
|
||||
built_in: RefCell::new(Arc::new(FontDatabase::with_built_in()?)),
|
||||
no_glyphs: RefCell::new(HashSet::new()),
|
||||
fallback_channel: RefCell::new(None),
|
||||
system_title_font: RefCell::new(None),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -489,7 +487,7 @@ impl FontConfigInner {
|
||||
}
|
||||
}
|
||||
|
||||
let mut fonts = vec![if cfg!(target_os = "macos") {
|
||||
let fonts = vec![if cfg!(target_os = "macos") {
|
||||
// "SF Pro" or one of the San Francisco font variants
|
||||
// are the official fonts for the macOS UI, but those
|
||||
// are not directly accessible to non-Apple applications,
|
||||
@@ -498,16 +496,10 @@ impl FontConfigInner {
|
||||
// but has slightly different spacing.
|
||||
// It's close enough for me!
|
||||
bold("Galvji")
|
||||
} else if cfg!(windows) {
|
||||
FontAttributes::new("Segoe UI")
|
||||
} else {
|
||||
bold("Cantarell")
|
||||
bold("Roboto")
|
||||
}];
|
||||
|
||||
if !cfg!(windows) && !cfg!(target_os = "macos") {
|
||||
fonts.push(bold("DejaVu Sans"));
|
||||
}
|
||||
|
||||
let font_size = if cfg!(windows) { 10. } else { 12. };
|
||||
|
||||
(
|
||||
@@ -519,11 +511,6 @@ impl FontConfigInner {
|
||||
)
|
||||
}
|
||||
|
||||
fn advise_title_font(&self, info: Option<(ParsedFont, f64)>) {
|
||||
self.title_font.borrow_mut().take();
|
||||
*self.system_title_font.borrow_mut() = info;
|
||||
}
|
||||
|
||||
fn title_font(&self, myself: &Rc<Self>) -> anyhow::Result<Rc<LoadedFont>> {
|
||||
let config = self.config.borrow();
|
||||
|
||||
@@ -533,17 +520,10 @@ impl FontConfigInner {
|
||||
return Ok(Rc::clone(entry));
|
||||
}
|
||||
|
||||
let (sys_font, mut sys_size) = Self::last_ditch_title_font();
|
||||
let (sys_font, sys_size) = Self::last_ditch_title_font();
|
||||
|
||||
let mut handles = vec![];
|
||||
|
||||
if config.window_frame.font.is_none() {
|
||||
if let Some((font, size)) = self.system_title_font.borrow().as_ref() {
|
||||
handles.push(font.clone());
|
||||
sys_size = *size;
|
||||
}
|
||||
}
|
||||
|
||||
let font_size = config.window_frame.font_size.unwrap_or(sys_size);
|
||||
|
||||
let text_style = config
|
||||
@@ -879,10 +859,6 @@ impl FontConfiguration {
|
||||
self.inner.resolve_font(&self.inner, style)
|
||||
}
|
||||
|
||||
pub fn advise_title_font(&self, info: Option<(ParsedFont, f64)>) {
|
||||
self.inner.advise_title_font(info);
|
||||
}
|
||||
|
||||
pub fn change_scaling(&self, font_scale: f64, dpi: usize) -> (f64, usize) {
|
||||
self.inner.change_scaling(font_scale, dpi)
|
||||
}
|
||||
|
||||
@@ -537,6 +537,18 @@ pub(crate) fn load_built_in_fonts(font_info: &mut Vec<ParsedFont>) -> anyhow::Re
|
||||
font!("../../assets/fonts/JetBrainsMono-Regular.ttf"),
|
||||
font!("../../assets/fonts/JetBrainsMono-ThinItalic.ttf"),
|
||||
font!("../../assets/fonts/JetBrainsMono-Thin.ttf"),
|
||||
font!("../../assets/fonts/Roboto-Black.ttf"),
|
||||
font!("../../assets/fonts/Roboto-BlackItalic.ttf"),
|
||||
font!("../../assets/fonts/Roboto-Bold.ttf"),
|
||||
font!("../../assets/fonts/Roboto-BoldItalic.ttf"),
|
||||
font!("../../assets/fonts/Roboto-Italic.ttf"),
|
||||
font!("../../assets/fonts/Roboto-Light.ttf"),
|
||||
font!("../../assets/fonts/Roboto-LightItalic.ttf"),
|
||||
font!("../../assets/fonts/Roboto-Medium.ttf"),
|
||||
font!("../../assets/fonts/Roboto-MediumItalic.ttf"),
|
||||
font!("../../assets/fonts/Roboto-Regular.ttf"),
|
||||
font!("../../assets/fonts/Roboto-Thin.ttf"),
|
||||
font!("../../assets/fonts/Roboto-ThinItalic.ttf"),
|
||||
font!("../../assets/fonts/NotoColorEmoji.ttf"),
|
||||
font!("../../assets/fonts/PowerlineExtraSymbols.otf"),
|
||||
font!("../../assets/fonts/LastResortHE-Regular.ttf"),
|
||||
|
||||
@@ -579,24 +579,6 @@ impl TermWindow {
|
||||
let dpi = config.dpi.unwrap_or_else(|| ::window::default_dpi()) as usize;
|
||||
let fontconfig = Rc::new(FontConfiguration::new(Some(config.clone()), dpi)?);
|
||||
|
||||
// If we need the title font, it's easier to extract that information
|
||||
// from a cheeky temporary invisible window and use its metrics below.
|
||||
if config.use_fancy_tab_bar {
|
||||
let cheeky_window = Window::new_window(
|
||||
&*WINDOW_CLASS.lock().unwrap(),
|
||||
"wezterm",
|
||||
100,
|
||||
100,
|
||||
Some(&config),
|
||||
Rc::clone(&fontconfig),
|
||||
move |_, _| {},
|
||||
)
|
||||
.await?;
|
||||
|
||||
fontconfig.advise_title_font(cheeky_window.get_title_font_and_point_size());
|
||||
cheeky_window.close();
|
||||
}
|
||||
|
||||
let mux = Mux::get().expect("to be main thread with mux running");
|
||||
let size = match mux.get_active_tab_for_window(mux_window_id) {
|
||||
Some(tab) => tab.get_size(),
|
||||
|
||||
Reference in new issue
Block a user