Skip to content

FontRequest

What a text asks of a family: the properties pick_closest matches. The default is CSS’s initial value: weight 400, normal style, normal width.

use helpers4::font::FontRequest;

Cargo feature font (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features font

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.11", default-features = false, features = ["font"] }
pub struct FontRequest { /* private fields */ }
use helpers4::font::{FontRequest, FontStyle};

let request = FontRequest::default();
assert_eq!((request.weight, request.style, request.stretch), (400.0, FontStyle::Normal, 100.0));
assert_eq!(FontRequest::new(600.0, FontStyle::Italic).weight, 600.0);

src/font/font_request.rs