mirror of
https://github.com/alacritty/alacritty.git
synced 2025-02-17 15:57:08 -05:00
Fix crash on Windows (#2021)
The rusttype backend did not properly support manually specifying font styles, but instead chose to panic when they are specified. The rusttype implementation now provides a proper implementation for handling `bold`, `italic` and `regular` font styles. This fixes #2020.
This commit is contained in:
parent
5096426f9e
commit
31271c726e
4 changed files with 22 additions and 28 deletions
|
@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Crash when trying to start Alacritty on Windows
|
||||||
|
|
||||||
## Version 0.2.6
|
## Version 0.2.6
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -79,7 +79,7 @@ tabspaces: 8
|
||||||
# Font configuration (changes require restart)
|
# Font configuration (changes require restart)
|
||||||
font:
|
font:
|
||||||
# Normal (roman) font face
|
# Normal (roman) font face
|
||||||
normal:
|
#normal:
|
||||||
# Font family
|
# Font family
|
||||||
#
|
#
|
||||||
# Default:
|
# Default:
|
||||||
|
@ -89,10 +89,10 @@ font:
|
||||||
#family: monospace
|
#family: monospace
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
# The `style` can be specified to pick a specific face.
|
||||||
style: Regular
|
#style: Regular
|
||||||
|
|
||||||
# Bold font face
|
# Bold font face
|
||||||
bold:
|
#bold:
|
||||||
# Font family
|
# Font family
|
||||||
#
|
#
|
||||||
# If the bold family is not specified, it will fall back to the
|
# If the bold family is not specified, it will fall back to the
|
||||||
|
@ -100,10 +100,10 @@ font:
|
||||||
#family: monospace
|
#family: monospace
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
# The `style` can be specified to pick a specific face.
|
||||||
style: Bold
|
#style: Bold
|
||||||
|
|
||||||
# Italic font face
|
# Italic font face
|
||||||
italic:
|
#italic:
|
||||||
# Font family
|
# Font family
|
||||||
#
|
#
|
||||||
# If the italic family is not specified, it will fall back to the
|
# If the italic family is not specified, it will fall back to the
|
||||||
|
@ -111,7 +111,7 @@ font:
|
||||||
#family: monospace
|
#family: monospace
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
# The `style` can be specified to pick a specific face.
|
||||||
style: Italic
|
#style: Italic
|
||||||
|
|
||||||
# Point size
|
# Point size
|
||||||
size: 11.0
|
size: 11.0
|
||||||
|
|
|
@ -61,7 +61,13 @@ impl crate::Rasterize for RustTypeRasterizer {
|
||||||
.monospace();
|
.monospace();
|
||||||
|
|
||||||
let fp = match desc.style {
|
let fp = match desc.style {
|
||||||
Style::Specific(_) => unimplemented!(""),
|
Style::Specific(ref style) => {
|
||||||
|
match style.to_lowercase().as_str() {
|
||||||
|
"italic" => fp.italic(),
|
||||||
|
"bold" => fp.bold(),
|
||||||
|
_ => fp,
|
||||||
|
}
|
||||||
|
},
|
||||||
Style::Description { slant, weight } => {
|
Style::Description { slant, weight } => {
|
||||||
let fp = match slant {
|
let fp = match slant {
|
||||||
Slant::Normal => fp,
|
Slant::Normal => fp,
|
||||||
|
|
|
@ -2060,9 +2060,9 @@ impl Default for Font {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use_thin_strokes: true,
|
use_thin_strokes: true,
|
||||||
size: default_font_size(),
|
size: default_font_size(),
|
||||||
normal: FontDescription::new_with_style("Regular"),
|
normal: Default::default(),
|
||||||
bold: SecondaryFontDescription::new_with_style("Bold"),
|
bold: Default::default(),
|
||||||
italic: SecondaryFontDescription::new_with_style("Italic"),
|
italic: Default::default(),
|
||||||
scale_with_dpi: Default::default(),
|
scale_with_dpi: Default::default(),
|
||||||
glyph_offset: Default::default(),
|
glyph_offset: Default::default(),
|
||||||
offset: Default::default(),
|
offset: Default::default(),
|
||||||
|
@ -2152,15 +2152,6 @@ impl Default for FontDescription {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FontDescription {
|
|
||||||
fn new_with_style(style: &str) -> Self {
|
|
||||||
Self {
|
|
||||||
style: Some(style.into()),
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Description of the italic and bold font
|
/// Description of the italic and bold font
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[derive(Debug, Default, Deserialize, Clone, PartialEq, Eq)]
|
#[derive(Debug, Default, Deserialize, Clone, PartialEq, Eq)]
|
||||||
|
@ -2180,15 +2171,6 @@ impl SecondaryFontDescription {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SecondaryFontDescription {
|
|
||||||
fn new_with_style(style: &str) -> Self {
|
|
||||||
Self {
|
|
||||||
style: Some(style.into()),
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Monitor {
|
pub struct Monitor {
|
||||||
_thread: ::std::thread::JoinHandle<()>,
|
_thread: ::std::thread::JoinHandle<()>,
|
||||||
rx: mpsc::Receiver<Config>,
|
rx: mpsc::Receiver<Config>,
|
||||||
|
|
Loading…
Add table
Reference in a new issue