diff options
author | 2023-03-30 02:01:20 +0200 | |
---|---|---|
committer | 2023-03-30 02:01:20 +0200 | |
commit | 0b459c8e240abf83bb62902a504c018194acdbb6 (patch) | |
tree | 0b53bd1beae76465d6a5b5659a46b059d1dd14c3 /tiny_skia | |
parent | 707de9d788dc3c49d4ac57a19afac1bb938b78d9 (diff) | |
download | iced-0b459c8e240abf83bb62902a504c018194acdbb6.tar.gz iced-0b459c8e240abf83bb62902a504c018194acdbb6.tar.bz2 iced-0b459c8e240abf83bb62902a504c018194acdbb6.zip |
Introduce `font::Stretch`
Diffstat (limited to 'tiny_skia')
-rw-r--r-- | tiny_skia/src/text.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tiny_skia/src/text.rs b/tiny_skia/src/text.rs index c9bb9873..865132b4 100644 --- a/tiny_skia/src/text.rs +++ b/tiny_skia/src/text.rs @@ -209,6 +209,20 @@ fn to_weight(weight: font::Weight) -> cosmic_text::Weight { } } +fn to_stretch(stretch: font::Stretch) -> cosmic_text::Stretch { + match stretch { + font::Stretch::UltraCondensed => cosmic_text::Stretch::UltraCondensed, + font::Stretch::ExtraCondensed => cosmic_text::Stretch::ExtraCondensed, + font::Stretch::Condensed => cosmic_text::Stretch::Condensed, + font::Stretch::SemiCondensed => cosmic_text::Stretch::SemiCondensed, + font::Stretch::Normal => cosmic_text::Stretch::Normal, + font::Stretch::SemiExpanded => cosmic_text::Stretch::SemiExpanded, + font::Stretch::Expanded => cosmic_text::Stretch::Expanded, + font::Stretch::ExtraExpanded => cosmic_text::Stretch::ExtraExpanded, + font::Stretch::UltraExpanded => cosmic_text::Stretch::UltraExpanded, + } +} + #[derive(Debug, Clone, Default)] struct GlyphCache { entries: FxHashMap< @@ -371,6 +385,7 @@ impl Cache { cosmic_text::Attrs::new() .family(to_family(key.font.family)) .weight(to_weight(key.font.weight)) + .stretch(to_stretch(key.font.stretch)) .monospaced( key.font.monospaced || matches!( |