Struct rckive_genpdf::fonts::Font
source · pub struct Font { /* private fields */ }
Expand description
A reference to a font cached by a FontCache
.
See the module documentation for details on the internals.
Implementations§
source§impl Font
impl Font
sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
Returns whether this font is a built-in PDF font.
sourcepub fn get_line_height(&self, font_size: u8) -> Mm
pub fn get_line_height(&self, font_size: u8) -> Mm
Returns the line height for text with this font and the given font size.
sourcepub fn glyph_height(&self, font_size: u8) -> Mm
pub fn glyph_height(&self, font_size: u8) -> Mm
Returns the glyph height for text with this font and the given font size.
sourcepub fn ascent(&self, font_size: u8) -> Mm
pub fn ascent(&self, font_size: u8) -> Mm
Returns the ascent for text with this font and the given font size.
sourcepub fn char_width(&self, font_cache: &FontCache, c: char, font_size: u8) -> Mm
pub fn char_width(&self, font_cache: &FontCache, c: char, font_size: u8) -> Mm
Returns the width of a character with this font and the given font size.
The given FontCache
must be the font cache that loaded this font.
sourcepub fn char_left_side_bearing(
&self,
font_cache: &FontCache,
c: char,
font_size: u8
) -> Mm
pub fn char_left_side_bearing(
&self,
font_cache: &FontCache,
c: char,
font_size: u8
) -> Mm
Returns the width of the empty space between the origin of the glyph bounding box and the leftmost edge of the character, for a given font and font size.
The given FontCache
must be the font cache that loaded this font.
sourcepub fn str_width(&self, font_cache: &FontCache, s: &str, font_size: u8) -> Mm
pub fn str_width(&self, font_cache: &FontCache, s: &str, font_size: u8) -> Mm
Returns the width of a string with this font and the given font size.
The given FontCache
must be the font cache that loaded this font.
sourcepub fn kerning<I>(&self, font_cache: &FontCache, iter: I) -> Vec<f32>where
I: IntoIterator<Item = char>,
pub fn kerning<I>(&self, font_cache: &FontCache, iter: I) -> Vec<f32>where
I: IntoIterator<Item = char>,
Returns the kerning data for the given sequence of characters.
The i-th value of the returned data is the amount of kerning to insert before the i-th character of the sequence.
The given FontCache
must be the font cache that loaded this font.