diff options
| author | 2024-07-21 13:01:27 +0200 | |
|---|---|---|
| committer | 2024-07-21 13:01:27 +0200 | |
| commit | 54500e61ed0ff2309f06dd5b441f9f5b627e05c9 (patch) | |
| tree | ec26bc47d08ca17286fe8f3fdd8494aa545ea78b /graphics/src | |
| parent | 9bfaf2840cffe35d689bd115a308d21961ab082a (diff) | |
| download | iced-54500e61ed0ff2309f06dd5b441f9f5b627e05c9.tar.gz iced-54500e61ed0ff2309f06dd5b441f9f5b627e05c9.tar.bz2 iced-54500e61ed0ff2309f06dd5b441f9f5b627e05c9.zip  | |
Simplify font attributes in `Paragraph::with_spans`
Diffstat (limited to '')
| -rw-r--r-- | graphics/src/text/paragraph.rs | 10 | 
1 files changed, 1 insertions, 9 deletions
diff --git a/graphics/src/text/paragraph.rs b/graphics/src/text/paragraph.rs index b69110b2..da703ceb 100644 --- a/graphics/src/text/paragraph.rs +++ b/graphics/src/text/paragraph.rs @@ -123,15 +123,7 @@ impl core::text::Paragraph for Paragraph {          buffer.set_rich_text(              font_system.raw(),              text.content.iter().enumerate().map(|(i, span)| { -                let attrs = if let Some(font) = span.font { -                    cosmic_text::Attrs::new() -                        .family(text::to_family(font.family)) -                        .weight(text::to_weight(font.weight)) -                        .stretch(text::to_stretch(font.stretch)) -                        .style(text::to_style(font.style)) -                } else { -                    text::to_attributes(text.font) -                }; +                let attrs = text::to_attributes(span.font.unwrap_or(text.font));                  let attrs = match (span.size, span.line_height) {                      (None, None) => attrs,  | 
