Feature/fallback fonts (#15306)
Supersedes https://github.com/zed-industries/zed/pull/12090 fixes #5180 fixes #5055 See original PR for an example of the feature at work. This PR changes the settings interface to be backwards compatible, and adds the `ui_font_fallbacks`, `buffer_font_fallbacks`, and `terminal.font_fallbacks` settings. Release Notes: - Added support for font fallbacks via three new settings: `ui_font_fallbacks`, `buffer_font_fallbacks`, and `terminal.font_fallbacks`.(#5180, #5055). --------- Co-authored-by: Junkui Zhang <364772080@qq.com>
This commit is contained in:
parent
3e31955b7f
commit
a1bd7a1297
30 changed files with 444 additions and 136 deletions
|
@ -6,9 +6,9 @@ use std::{
|
|||
|
||||
use crate::{
|
||||
black, phi, point, quad, rems, AbsoluteLength, Bounds, ContentMask, Corners, CornersRefinement,
|
||||
CursorStyle, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures, FontStyle, FontWeight,
|
||||
Hsla, Length, Pixels, Point, PointRefinement, Rgba, SharedString, Size, SizeRefinement, Styled,
|
||||
TextRun, WindowContext,
|
||||
CursorStyle, DefiniteLength, Edges, EdgesRefinement, Font, FontFallbacks, FontFeatures,
|
||||
FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rgba, SharedString, Size,
|
||||
SizeRefinement, Styled, TextRun, WindowContext,
|
||||
};
|
||||
use collections::HashSet;
|
||||
use refineable::Refineable;
|
||||
|
@ -180,6 +180,9 @@ pub struct TextStyle {
|
|||
/// The font features to use
|
||||
pub font_features: FontFeatures,
|
||||
|
||||
/// The fallback fonts to use
|
||||
pub font_fallbacks: Option<FontFallbacks>,
|
||||
|
||||
/// The font size to use, in pixels or rems.
|
||||
pub font_size: AbsoluteLength,
|
||||
|
||||
|
@ -218,6 +221,7 @@ impl Default for TextStyle {
|
|||
"Helvetica".into()
|
||||
},
|
||||
font_features: FontFeatures::default(),
|
||||
font_fallbacks: None,
|
||||
font_size: rems(1.).into(),
|
||||
line_height: phi(),
|
||||
font_weight: FontWeight::default(),
|
||||
|
@ -269,6 +273,7 @@ impl TextStyle {
|
|||
Font {
|
||||
family: self.font_family.clone(),
|
||||
features: self.font_features.clone(),
|
||||
fallbacks: self.font_fallbacks.clone(),
|
||||
weight: self.font_weight,
|
||||
style: self.font_style,
|
||||
}
|
||||
|
@ -286,6 +291,7 @@ impl TextStyle {
|
|||
font: Font {
|
||||
family: self.font_family.clone(),
|
||||
features: Default::default(),
|
||||
fallbacks: self.font_fallbacks.clone(),
|
||||
weight: self.font_weight,
|
||||
style: self.font_style,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue