add Text::new

This commit is contained in:
griffi-gh 2024-03-07 02:05:39 +01:00
parent 1a6d79b2fc
commit 45132db996

View file

@ -57,6 +57,13 @@ impl Default for Text {
} }
impl Text { impl Text {
pub fn new(text: impl Into<Cow<'static, str>>) -> Self {
Self {
text: text.into(),
..Default::default()
}
}
fn font(&self, f: FontHandle) -> FontHandle { fn font(&self, f: FontHandle) -> FontHandle {
self.font.unwrap_or(f) self.font.unwrap_or(f)
} }