diff options
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | alacritty.yml | 7 | ||||
-rw-r--r-- | alacritty/src/config/font.rs | 21 | ||||
-rw-r--r-- | alacritty/src/renderer/mod.rs | 10 |
4 files changed, 40 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c8e27b..ec1e7b67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Minimum Rust version has been bumped to 1.56.0 +### Added + + - Option `font.builtin_box_drawing` to disable the built-in font for drawing box characters + ### Changed - The `--help` output was reworked with a new colorful syntax diff --git a/alacritty.yml b/alacritty.yml index 00c16ce3..c9959497 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -178,6 +178,13 @@ # it is recommended to set `use_thin_strokes` to `false`. #use_thin_strokes: true + # Use built-in font for box drawing characters. + # + # If `true`, Alacritty will use a custom built-in font for box drawing + # characters (Unicode points 2500 - 259f). + # + #builtin_box_drawing: true + # If `true`, bold text is drawn using the bright color variants. #draw_bold_text_with_bright_colors: false diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs index 3dc11671..cdd84ff9 100644 --- a/alacritty/src/config/font.rs +++ b/alacritty/src/config/font.rs @@ -14,7 +14,7 @@ use crate::config::ui_config::Delta; /// field in this struct. It might be nice in the future to have defaults for /// each value independently. Alternatively, maybe erroring when the user /// doesn't provide complete config is Ok. -#[derive(ConfigDeserialize, Default, Debug, Clone, PartialEq, Eq)] +#[derive(ConfigDeserialize, Debug, Clone, PartialEq, Eq)] pub struct Font { /// Extra spacing per character. pub offset: Delta<i8>, @@ -38,6 +38,9 @@ pub struct Font { /// Font size in points. size: Size, + + /// Whether to use the built-in font for box drawing characters. + pub builtin_box_drawing: bool, } impl Font { @@ -72,6 +75,22 @@ impl Font { } } +impl Default for Font { + fn default() -> Font { + Self { + builtin_box_drawing: true, + use_thin_strokes: Default::default(), + glyph_offset: Default::default(), + bold_italic: Default::default(), + italic: Default::default(), + offset: Default::default(), + normal: Default::default(), + bold: Default::default(), + size: Default::default(), + } + } +} + /// Description of the normal font. #[derive(ConfigDeserialize, Debug, Clone, PartialEq, Eq)] pub struct FontDescription { diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs index 33c6a7e3..50a0e7d7 100644 --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -137,6 +137,9 @@ pub struct GlyphCache { /// Font metrics. metrics: crossfont::Metrics, + + /// Whether to use the built-in font for box drawing characters. + builtin_box_drawing: bool, } impl GlyphCache { @@ -167,6 +170,7 @@ impl GlyphCache { bold_italic_key: bold_italic, glyph_offset: font.glyph_offset, metrics, + builtin_box_drawing: font.builtin_box_drawing, }; cache.load_common_glyphs(loader); @@ -268,7 +272,10 @@ impl GlyphCache { // Rasterize the glyph using the built-in font for special characters or the user's font // for everything else. - let rasterized = builtin_font::builtin_glyph(glyph_key.character, &self.metrics) + let rasterized = self + .builtin_box_drawing + .then(|| builtin_font::builtin_glyph(glyph_key.character, &self.metrics)) + .flatten() .map_or_else(|| self.rasterizer.get_glyph(glyph_key), Ok); let glyph = match rasterized { @@ -355,6 +362,7 @@ impl GlyphCache { self.italic_key = italic; self.bold_italic_key = bold_italic; self.metrics = metrics; + self.builtin_box_drawing = font.builtin_box_drawing; self.clear_glyph_cache(loader); |