Skip to content

Commit

Permalink
refactor: refactor font_styles function and add new font style
Browse files Browse the repository at this point in the history
- modify font_styles function to remove redundant mutability
- add new font style 'caskaydiacove nerd font italic' with specific attributes
- remove redundant font style for non-windows systems
  • Loading branch information
falcucci committed Sep 20, 2024
1 parent 11f126d commit 335a952
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ fn font_styles() {
synthesis: Synthesis,
}

let mut lines = vec![
let lines = vec![
(
"FiraCode Normal",
vec![StyleProperty::FontStack(FontStack::Source(
Expand Down Expand Up @@ -423,6 +423,22 @@ fn font_styles() {
},
},
),
(
"CaskaydiaCove Nerd Font Italic",
vec![
StyleProperty::FontStack(FontStack::Source("CaskaydiaCove Nerd Font")),
StyleProperty::FontStyle(FontStyle::Italic),
],
Expected {
fullname: "CaskaydiaCove NF Italic".into(),
attributes: Attributes::new(Stretch::NORMAL, Weight::NORMAL, Style::Italic),
synthesis: Synthesis {
vars: vec![],
embolden: false,
skew: 0.0.into(),
},
},
),
(
"Monaspace Xenon Var",
vec![StyleProperty::FontStack(FontStack::Source(
Expand Down Expand Up @@ -646,25 +662,6 @@ fn font_styles() {
},
),
];

#[cfg(not(target_os = "windows"))]
lines.push((
"CaskaydiaCove Nerd Font Italic",
vec![
StyleProperty::FontStack(FontStack::Source("CaskaydiaCove Nerd Font")),
StyleProperty::FontStyle(FontStyle::Italic),
],
Expected {
fullname: "CaskaydiaCove NF Italic".into(),
attributes: Attributes::new(Stretch::NORMAL, Weight::NORMAL, Style::Italic),
synthesis: Synthesis {
vars: vec![],
embolden: false,
skew: 0.0.into(),
},
},
));

let layout = shaper.layout_within_with(
&lines
.iter()
Expand Down

0 comments on commit 335a952

Please sign in to comment.