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
|
@ -1,8 +1,10 @@
|
|||
mod font_fallbacks;
|
||||
mod font_features;
|
||||
mod line;
|
||||
mod line_layout;
|
||||
mod line_wrapper;
|
||||
|
||||
pub use font_fallbacks::*;
|
||||
pub use font_features::*;
|
||||
pub use line::*;
|
||||
pub use line_layout::*;
|
||||
|
@ -62,8 +64,7 @@ impl TextSystem {
|
|||
wrapper_pool: Mutex::default(),
|
||||
font_runs_pool: Mutex::default(),
|
||||
fallback_font_stack: smallvec![
|
||||
// TODO: This is currently Zed-specific.
|
||||
// We should allow GPUI users to provide their own fallback font stack.
|
||||
// TODO: Remove this when Linux have implemented setting fallbacks.
|
||||
font("Zed Plex Mono"),
|
||||
font("Helvetica"),
|
||||
font("Segoe UI"), // Windows
|
||||
|
@ -683,6 +684,9 @@ pub struct Font {
|
|||
/// The font features to use.
|
||||
pub features: FontFeatures,
|
||||
|
||||
/// The fallbacks fonts to use.
|
||||
pub fallbacks: Option<FontFallbacks>,
|
||||
|
||||
/// The font weight.
|
||||
pub weight: FontWeight,
|
||||
|
||||
|
@ -697,6 +701,7 @@ pub fn font(family: impl Into<SharedString>) -> Font {
|
|||
features: FontFeatures::default(),
|
||||
weight: FontWeight::default(),
|
||||
style: FontStyle::default(),
|
||||
fallbacks: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue