Struct font_atlas::RenderedFont
[−]
[src]
pub struct RenderedFont<I> {
// some fields omitted
}A representation of a fully-rendered font that contains a atlas image and the metadata required to draw from it.
Methods
impl<I> RenderedFont<I>
fn new(family_name: Option<String>, style_name: Option<String>, image: I, line_height: u32, max_width: u32, char_info: HashMap<char, CharInfo>, kerning: HashMap<(char, char), (i32, i32)>) -> RenderedFont<I>
fn kerning(&self, a: char, b: char) -> (i32, i32)
Returns the offsets (dx, dy) in pixels that should be applied
to the difference in position between chars a and b where
a comes immediately before b in the text.
If the font doesn't specify a special kerning between these
characters, (0, 0) is returned instead.
fn line_height(&self) -> u32
Returns the suggested distance between lines of text.
fn max_width(&self) -> u32
Returns the maximum width of a single char using this font.
fn char_info(&self, c: char) -> Option<CharInfo>
Returns the offset and advance information regarding the specified character.
fn family_name(&self) -> Option<&str>
Returns the name of this font family e.g. Times New Roman
fn style_name(&self) -> Option<&str>
Returns the name of the style e.g. (Bold).
fn image(&self) -> &I
Returns a reference to the contained image.
fn image_mut(&mut self) -> &mut I
Returns a mutable reference to the contained image.
fn map<A, F>(self, mapping_fn: F) -> RenderedFont<A> where F: FnOnce(I) -> A
Applies a transformation function to the image of this rendered font producing a new rendered font with that image.
fn positions_for(&self, text: &str) -> Vec<OutputPosition>
Given a string, this function returns a vec containing all of the positions of each character as it should be rendered to the screen.
The position is relative to the (0, 0) coordinate, and progress in the +x, +y direction.