pub struct FontSource {
pub url: String,
pub index: u32,
pub attribution: Option<String>,
}Expand description
A document-scoped font face (TTF / OTF / TTC bytes) consumed by the
text node’s font fallback stack. The url doubles as the font’s
asset key, like a sprite source’s image.
Fields§
§url: StringFont source url. Either a font file — http(s)://,
file:PATH, or a data: URL, like FileSource::src — or an
installed-font reference:
system:<family>[?weight=<100..900>&style=<normal|italic|oblique>]resolves a face by family name from the host’s installed fonts (e.g.system:Arial Unicode MS,system:Helvetica?weight=700). The family may be written with literal spaces or percent-encoded.weightdefaults to400,styletonormal.
A system: reference makes the recipe machine-dependent: the
same family resolves to whatever face that machine has installed,
so glyph shapes and character coverage can differ across
environments (and it is unavailable in the browser/wasm host,
where font bytes must be supplied directly). Reference a font file
for a fully portable, reproducible recipe.
index: u32Face index within a TrueType collection (.ttc); 0 (the
default) for single-face files. Ignored for system: urls — the
installed-font database reports the matched face’s own index.
attribution: Option<String>Trait Implementations§
Source§impl Clone for FontSource
impl Clone for FontSource
Source§fn clone(&self) -> FontSource
fn clone(&self) -> FontSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more