Struct rust_raylib::text::Font
source · pub struct Font { /* private fields */ }Expand description
Font, font texture and GlyphInfo array data
Implementations§
source§impl Font
impl Font
sourcepub fn glyph_count(&self) -> usize
pub fn glyph_count(&self) -> usize
Number of glyph characters
sourcepub fn glyph_padding(&self) -> u32
pub fn glyph_padding(&self) -> u32
Padding around the glyph characters
sourcepub fn from_file_ex(
file_name: &str,
font_size: u32,
chars: &[char]
) -> Option<Self>
pub fn from_file_ex( file_name: &str, font_size: u32, chars: &[char] ) -> Option<Self>
Load font from file with extended parameters
sourcepub fn from_image(
image: &Image,
key_color: Color,
first_char: char
) -> Option<Self>
pub fn from_image( image: &Image, key_color: Color, first_char: char ) -> Option<Self>
Load font from Image (XNA style)
sourcepub fn from_memory(
file_type: &str,
file_data: &[u8],
font_size: u32,
chars: &[char]
) -> Option<Self>
pub fn from_memory( file_type: &str, file_data: &[u8], font_size: u32, chars: &[char] ) -> Option<Self>
Load font from memory buffer, fileType refers to extension: i.e. ‘.ttf’
sourcepub fn export_as_code(&self, file_name: &str) -> bool
pub fn export_as_code(&self, file_name: &str) -> bool
Export font as code file, returns true on success
sourcepub fn measure_text(text: &str, font_size: u32) -> u32
pub fn measure_text(text: &str, font_size: u32) -> u32
Measure string width for default font
sourcepub fn measure_text_ex(
&self,
text: &str,
font_size: f32,
spacing: f32
) -> Vector2
pub fn measure_text_ex( &self, text: &str, font_size: f32, spacing: f32 ) -> Vector2
Measure string size for Font
sourcepub fn get_glyph_index(&self, codepoint: char) -> usize
pub fn get_glyph_index(&self, codepoint: char) -> usize
Get glyph index position in font for a codepoint (unicode character), fallback to ‘?’ if not found
sourcepub fn get_glyph_atlas_rect(&self, codepoint: char) -> Rectangle
pub fn get_glyph_atlas_rect(&self, codepoint: char) -> Rectangle
Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to ‘?’ if not found
sourcepub fn get_glyph_info(&self, codepoint: char) -> GlyphInfo
pub fn get_glyph_info(&self, codepoint: char) -> GlyphInfo
Get glyph font info data for a codepoint (unicode character), fallback to ‘?’ if not found
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Font
impl !Send for Font
impl !Sync for Font
impl Unpin for Font
impl UnwindSafe for Font
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
Mutably borrows from an owned value. Read more