diff --git a/frontends/rioterm/src/renderer/mod.rs b/frontends/rioterm/src/renderer/mod.rs index 0617274a0b..90220b6f8e 100644 --- a/frontends/rioterm/src/renderer/mod.rs +++ b/frontends/rioterm/src/renderer/mod.rs @@ -29,7 +29,6 @@ use unicode_width::UnicodeWidthChar; pub struct Renderer { is_vi_mode_enabled: bool, draw_bold_text_with_light_colors: bool, - builtin_box_drawing: bool, pub named_colors: Colors, pub colors: List, pub navigation: ScreenNavigation, @@ -51,11 +50,6 @@ pub struct Renderer { active_search: Option, } -const POWERLINE_TRIANGLE_LTR: char = '\u{e0b0}'; -// const POWERLINE_ARROW_LTR: char = '\u{e0b1}'; -// const POWERLINE_TRIANGLE_RTL: char = '\u{e0b2}'; -const POWERLINE_ARROW_RTL: char = '\u{e0b3}'; - impl Renderer { pub fn new( config: &Config, @@ -85,7 +79,6 @@ impl Renderer { } Renderer { - builtin_box_drawing: config.fonts.builtin_box_drawing, draw_bold_text_with_light_colors: config.draw_bold_text_with_light_colors, macos_use_unified_titlebar: config.window.macos_use_unified_titlebar, config_blinking_interval: config.cursor.blinking_interval.clamp(350, 1200), @@ -339,35 +332,21 @@ impl Renderer { let mut width = square.c.width().unwrap_or(1) as f32; let mut font_ctx = self.font_context.inner.lock(); - match (self.builtin_box_drawing, square_content) { - // Box drawing characters and block elements. - (true, '\u{2500}'..='\u{259f}' | '\u{1fb00}'..='\u{1fb3b}') => { - style.font_id = 0; - } - - // Powerline symbols: '','','','' - (true, POWERLINE_TRIANGLE_LTR..=POWERLINE_ARROW_RTL) => { - style.font_id = 0; - } - - _ => { - // There is no simple way to define what's emoji - // could have to refer to the Unicode tables. However it could - // be leading to misleading results. For example if we used - // unicode and internationalization functionalities like - // https://github.com/open-i18n/rust-unic/, then characters - // like "◼" would be valid emojis. For a terminal context, - // the character "◼" is not an emoji and should be treated as - // single width. So, we completely rely on what font is - // being used and then set width 2 for it. - if let Some((font_id, is_emoji)) = - font_ctx.find_best_font_match(square_content, &style) - { - style.font_id = font_id; - if is_emoji { - width = 2.0; - } - } + // There is no simple way to define what's emoji + // could have to refer to the Unicode tables. However it could + // be leading to misleading results. For example if we used + // unicode and internationalization functionalities like + // https://github.com/open-i18n/rust-unic/, then characters + // like "◼" would be valid emojis. For a terminal context, + // the character "◼" is not an emoji and should be treated as + // single width. So, we completely rely on what font is + // being used and then set width 2 for it. + if let Some((font_id, is_emoji)) = + font_ctx.find_best_font_match(square_content, &style) + { + style.font_id = font_id; + if is_emoji { + width = 2.0; } } diff --git a/sugarloaf/src/font/mod.rs b/sugarloaf/src/font/mod.rs index 8a81859d41..4df84ac275 100644 --- a/sugarloaf/src/font/mod.rs +++ b/sugarloaf/src/font/mod.rs @@ -26,6 +26,23 @@ use std::sync::Arc; pub use crate::font_introspector::{Style, Weight}; +// const POWERLINE_TRIANGLE_LTR: char = '\u{e0b0}'; +// const POWERLINE_ARROW_LTR: char = '\u{e0b1}'; +// const POWERLINE_TRIANGLE_RTL: char = '\u{e0b2}'; +// const POWERLINE_ARROW_RTL: char = '\u{e0b3}'; +// match (self.builtin_box_drawing, square_content) { +// // Box drawing characters and block elements. +// (true, '\u{2500}'..='\u{259f}' | '\u{1fb00}'..='\u{1fb3b}') => { +// style.font_id = 0; +// } + +// // Powerline symbols: '','','','' +// (true, POWERLINE_TRIANGLE_LTR..=POWERLINE_ARROW_RTL) => { +// style.font_id = 0; +// } + +// _ => { + pub fn lookup_for_font_match( cluster: &mut CharCluster, synth: &mut Synthesis, @@ -36,8 +53,7 @@ pub fn lookup_for_font_match( let mut font_synth = Synthesis::default(); let fonts_len: usize = library.inner.len(); - // Note: zero it's a built-in fallback font - for font_id in 1..fonts_len { + for font_id in 0..fonts_len { let mut is_emoji = false; if let Some(font) = library.inner.get(&font_id) { @@ -262,11 +278,6 @@ impl FontLibraryData { let mut db = loader::Database::new(); db.load_system_fonts(); - // Index zero is a fallback font, it will not be looked up - // unless it's flagged to allow builtin fallback - // this is used mostly by box drawing characters - self.insert(load_fallback_from_memory(&spec.regular)); - match find_font(&db, spec.regular, false, false) { FindResult::Found(data) => { self.insert(data);