summaryrefslogtreecommitdiffstats
path: root/wgpu/src/text.rs
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 /wgpu/src/text.rs
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 'wgpu/src/text.rs')
-rw-r--r--wgpu/src/text.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index ef910c39..fb13545d 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -339,6 +339,14 @@ fn to_stretch(stretch: font::Stretch) -> glyphon::Stretch {
}
}
+fn to_style(style: font::Style) -> glyphon::Style {
+ match style {
+ font::Style::Normal => glyphon::Style::Normal,
+ font::Style::Italic => glyphon::Style::Italic,
+ font::Style::Oblique => glyphon::Style::Oblique,
+ }
+}
+
fn to_shaping(shaping: Shaping) -> glyphon::Shaping {
match shaping {
Shaping::Basic => glyphon::Shaping::Basic,
@@ -420,7 +428,8 @@ impl Cache {
glyphon::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),
);