Skip to content

Commit d59b0de

Browse files
committed
Add font_maybe to Text.
1 parent 283d0e7 commit d59b0de

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/src/widget/text.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ where
100100
self
101101
}
102102

103+
/// Sets the [`Font`] of the [`Text`], if `Some`.
104+
///
105+
/// [`Font`]: crate::text::Renderer::Font
106+
pub fn font_maybe(
107+
mut self,
108+
font: Option<impl Into<Renderer::Font>>,
109+
) -> Self {
110+
self.format.font = font.map(Into::into);
111+
self
112+
}
113+
103114
/// Sets the width of the [`Text`] boundaries.
104115
pub fn width(mut self, width: impl Into<Length>) -> Self {
105116
self.format.width = width.into();

0 commit comments

Comments
 (0)