diff options
author | Chris Morgan <me@chrismorgan.info> | 2019-08-25 20:46:52 +1000 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2019-08-25 14:30:42 +0200 |
commit | e69f259d0e68a1ac382028cad7a50eb4652ef12a (patch) | |
tree | 2ce124c6eb7e484ff1b5b42019feb53a4c09c182 /alacritty_terminal/src/config | |
parent | ad0365219f7f264ef0fdf0b3e4401bad7ac40e55 (diff) | |
download | alacritty-e69f259d0e68a1ac382028cad7a50eb4652ef12a.tar.gz alacritty-e69f259d0e68a1ac382028cad7a50eb4652ef12a.zip |
Add bold italic font support
If the terminal escape sequences for bold and italic text are active,
the text should be rendered as bold and italic. However, due to missing
support in Alacritty, it would always render this text in bold.
This adds support for combining the bold and italic escapes to render
text in both styles and allows users to override the font for this
scenario using the `font.bold_italic` configuration option.
Diffstat (limited to 'alacritty_terminal/src/config')
-rw-r--r-- | alacritty_terminal/src/config/font.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/alacritty_terminal/src/config/font.rs b/alacritty_terminal/src/config/font.rs index 3c78ad29..6148c982 100644 --- a/alacritty_terminal/src/config/font.rs +++ b/alacritty_terminal/src/config/font.rs @@ -23,11 +23,15 @@ pub struct Font { /// Bold font face #[serde(deserialize_with = "failure_default")] - italic: SecondaryFontDescription, + bold: SecondaryFontDescription, /// Italic font face #[serde(deserialize_with = "failure_default")] - bold: SecondaryFontDescription, + italic: SecondaryFontDescription, + + /// Bold italic font face + #[serde(deserialize_with = "failure_default")] + bold_italic: SecondaryFontDescription, /// Font size in points #[serde(deserialize_with = "DeserializeSize::deserialize")] @@ -53,6 +57,7 @@ impl Default for Font { normal: Default::default(), bold: Default::default(), italic: Default::default(), + bold_italic: Default::default(), glyph_offset: Default::default(), offset: Default::default(), #[cfg(target_os = "macos")] @@ -72,14 +77,19 @@ impl Font { &self.normal } + // Get bold font description + pub fn bold(&self) -> FontDescription { + self.bold.desc(&self.normal) + } + // Get italic font description pub fn italic(&self) -> FontDescription { self.italic.desc(&self.normal) } - // Get bold font description - pub fn bold(&self) -> FontDescription { - self.bold.desc(&self.normal) + // Get bold italic font description + pub fn bold_italic(&self) -> FontDescription { + self.bold_italic.desc(&self.normal) } #[cfg(target_os = "macos")] |