pub struct SvgFonts {
pub faces: Vec<FontFace>,
/* private fields */
}Expand description
The fonts of an SVG document: faces, the faces of each font stack, and the characters each face draws.
Fields§
§faces: Vec<FontFace>Implementations§
Source§impl SvgFonts
impl SvgFonts
Sourcepub fn text_attrs(&self, stack: &str) -> String
pub fn text_attrs(&self, stack: &str) -> String
font-family, font-weight, font-style attributes for a font stack
(“Open Sans Bold,Arial Unicode MS Bold”).
Sourcepub fn covers(&self, stack: &str, text: &str) -> bool
pub fn covers(&self, stack: &str, text: &str) -> bool
Whether text can be written as <text> with an exact font: the
stack’s first font was found and has every (non-space) character
(always, when fonts are referenced by name only).
Sourcepub fn baseline_shift(&self, stack: &str, tops: &[(u32, f64)]) -> f64
pub fn baseline_shift(&self, stack: &str, tops: &[(u32, f64)]) -> f64
Vertical shift (24 px glyph units, y down) from MapLibre’s glyph line
position to the font baseline. The SDF glyph top is measured from a
generator-specific line (fontnik: the ascender), so it is measured per
font: the median over glyphs of (ink top from the real outline - SDF
top). tops gives (codepoint, SDF top) for the glyphs available.
Sourcepub fn note_text(&self, stack: &str, text: &str)
pub fn note_text(&self, stack: &str, text: &str)
Record text drawn with stack (characters are assigned to fonts by
SvgFonts::finish).
Sourcepub async fn finish(&mut self, client: &Client, opts: &SvgOptions)
pub async fn finish(&mut self, client: &Client, opts: &SvgOptions)
Assign every recorded character to the first font of its stack that
has it, looking up fallback fonts (e.g. CJK) only when a character
needs them. Call before SvgFonts::font_face_css.
Sourcepub fn font_face_css(&self, embed: FontEmbed) -> String
pub fn font_face_css(&self, embed: FontEmbed) -> String
@font-face rules for the faces that draw something.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SvgFonts
impl RefUnwindSafe for SvgFonts
impl Send for SvgFonts
impl Sync for SvgFonts
impl Unpin for SvgFonts
impl UnsafeUnpin for SvgFonts
impl UnwindSafe for SvgFonts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more