diff --git a/core/src/widget/text.rs b/core/src/widget/text.rs index 676d60a3..59f26b0d 100644 --- a/core/src/widget/text.rs +++ b/core/src/widget/text.rs @@ -99,6 +99,17 @@ where self } + /// Sets the [`Font`] of the [`Text`], if `Some`. + /// + /// [`Font`]: crate::text::Renderer::Font + pub fn font_maybe( + mut self, + font: Option>, + ) -> Self { + self.format.font = font.map(Into::into); + self + } + /// Sets the width of the [`Text`] boundaries. pub fn width(mut self, width: impl Into) -> Self { self.format.width = width.into();