From e86363837d8e3a6241a90cb5b895034f07106059 Mon Sep 17 00:00:00 2001 From: lufte Date: Fri, 18 Aug 2023 18:46:22 -0300 Subject: Make the style attribute available on Font --- wgpu/src/text.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'wgpu/src/text.rs') 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), ); -- cgit