pub struct Font(/* private fields */);Expand description
A font instance with runtime data
This represents a single font that can be used for text rendering. Fonts are managed by the FontAtlas and should not be created directly.
TODO: Currently using pointer wrapper approach for simplicity. Future improvement: Implement complete field mapping like imgui-rs for better type safety.
Note: Our dear-imgui-sys uses newer ImGui version with ImFontBaked architecture, while imgui-rs uses older version with direct field mapping. This difference requires careful consideration when implementing full mapping.
Implementations§
Source§impl Font
impl Font
Sourcepub fn is_glyph_in_font(&self, c: char) -> bool
pub fn is_glyph_in_font(&self, c: char) -> bool
Check if a glyph is available in this font
Sourcepub fn calc_text_size(
&self,
size: f32,
max_width: f32,
wrap_width: f32,
text: &str,
) -> [f32; 2]
pub fn calc_text_size( &self, size: f32, max_width: f32, wrap_width: f32, text: &str, ) -> [f32; 2]
Calculate text size for the given text
Sourcepub fn calc_word_wrap_position(
&self,
size: f32,
text: &str,
wrap_width: f32,
) -> usize
pub fn calc_word_wrap_position( &self, size: f32, text: &str, wrap_width: f32, ) -> usize
Calculate word wrap position for the given text
Sourcepub fn clear_output_data(&mut self)
pub fn clear_output_data(&mut self)
Clear output data (glyphs storage, UV coordinates)
Sourcepub fn add_remap_char(&mut self, from: char, to: char)
pub fn add_remap_char(&mut self, from: char, to: char)
Add character remapping
Sourcepub fn is_glyph_range_unused(&self, c_begin: u32, c_last: u32) -> bool
pub fn is_glyph_range_unused(&self, c_begin: u32, c_last: u32) -> bool
Check if a glyph range is unused