mirror of
https://github.com/alacritty/alacritty.git
synced 2026-12-06 19:22:26 +03:00
Add option to control built-in box drawing chars
This commit adds the config `font.builtin_box_drawing` option to control built-in font, which is enabled by default.
This commit is contained in:
1 parent
d1deff9fae
commit
094c2c9269
4 files changed
+40
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user