Skip to main content

RaylibFont

Trait RaylibFont 

Source
pub trait RaylibFont: AsRef<Font> + AsMut<Font> {
    // Provided methods
    fn base_size(&self) -> i32 { ... }
    fn texture(&self) -> &Texture2D { ... }
    fn chars(&self) -> &[GlyphInfo] { ... }
    fn chars_mut(&mut self) -> &mut [GlyphInfo] { ... }
    fn is_font_valid(&self) -> bool { ... }
    fn export_font_as_code<A>(&self, filename: A) -> bool
       where A: Into<OsString> { ... }
    fn get_glyph_info(&self, codepoint: char) -> GlyphInfo { ... }
    fn get_glyph_index(&self, codepoint: char) -> i32 { ... }
    fn get_glyph_atlas_rec(&self, codepoint: char) -> Rectangle { ... }
    fn measure_text(&self, text: &str, font_size: f32, spacing: f32) -> Vector2 { ... }
}

Provided Methods§

Source

fn base_size(&self) -> i32

Source

fn texture(&self) -> &Texture2D

Source

fn chars(&self) -> &[GlyphInfo]

Source

fn chars_mut(&mut self) -> &mut [GlyphInfo]

Source

fn is_font_valid(&self) -> bool

Check if a font is valid

Source

fn export_font_as_code<A>(&self, filename: A) -> bool
where A: Into<OsString>,

Export font as code file, returns true on success

Source

fn get_glyph_info(&self, codepoint: char) -> GlyphInfo

Get glyph font info data for a codepoint (unicode character), fallback to ‘?’ if not found

Source

fn get_glyph_index(&self, codepoint: char) -> i32

Gets index position for a unicode character on font.

Source

fn get_glyph_atlas_rec(&self, codepoint: char) -> Rectangle

Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to ‘?’ if not found

Source

fn measure_text(&self, text: &str, font_size: f32, spacing: f32) -> Vector2

Measures string width in pixels for font.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§