summaryrefslogtreecommitdiffstats
path: root/tiny_skia/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-08-20 14:22:46 +0200
committerLibravatar GitHub <noreply@github.com>2023-08-20 14:22:46 +0200
commit3bea1f703cea137818c16bf41c7ea372bd8b91b9 (patch)
tree4d16eb329ec1630fac3f62ba2edc68d4209bc357 /tiny_skia/src
parent2a3cb0fa7ab5b2b532932012ca7f479bf331049c (diff)
parente86363837d8e3a6241a90cb5b895034f07106059 (diff)
downloadiced-3bea1f703cea137818c16bf41c7ea372bd8b91b9.tar.gz
iced-3bea1f703cea137818c16bf41c7ea372bd8b91b9.tar.bz2
iced-3bea1f703cea137818c16bf41c7ea372bd8b91b9.zip
Merge pull request #2041 from lufte/issue-2040
Make the style attribute available on Font
Diffstat (limited to 'tiny_skia/src')
-rw-r--r--tiny_skia/src/text.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/tiny_skia/src/text.rs b/tiny_skia/src/text.rs
index 15f25740..08fde4bf 100644
--- a/tiny_skia/src/text.rs
+++ b/tiny_skia/src/text.rs
@@ -233,6 +233,14 @@ fn to_stretch(stretch: font::Stretch) -> cosmic_text::Stretch {
}
}
+fn to_style(style: font::Style) -> cosmic_text::Style {
+ match style {
+ font::Style::Normal => cosmic_text::Style::Normal,
+ font::Style::Italic => cosmic_text::Style::Italic,
+ font::Style::Oblique => cosmic_text::Style::Oblique,
+ }
+}
+
fn to_shaping(shaping: Shaping) -> cosmic_text::Shaping {
match shaping {
Shaping::Basic => cosmic_text::Shaping::Basic,
@@ -411,7 +419,8 @@ impl Cache {
cosmic_text::Attrs::new()
.family(to_family(key.font.family))
.weight(to_weight(key.font.weight))
- .stretch(to_stretch(key.font.stretch)),
+ .stretch(to_stretch(key.font.stretch))
+ .style(to_style(key.font.style)),
to_shaping(key.shaping),
);