Skip to main content

font

Function font 

Source
pub fn font(family: impl Into<SharedString>) -> Font
Expand description

Returns a Font for family, with normal weight, width, and style.

Pass a family name from TextSystem::all_font_names or one you added with TextSystem::add_fonts. Chain Font::bold or Font::italic to change the style.

ยงExamples

let body = font("Lilex");
assert_eq!(body.family.as_ref(), "Lilex");
assert_eq!(body.weight, FontWeight::NORMAL);
assert_eq!(body.style, FontStyle::Normal);