pub struct FontsView<'a> {
pub fonts: &'a mut FontsImpl,
/* private fields */
}
Expand description
The context’s collection of fonts, with this context’s pixels_per_point
. This is what you use to do text layout.
Fields§
§fonts: &'a mut FontsImpl
Implementations§
Source§impl FontsView<'_>
impl FontsView<'_>
pub fn max_texture_side(&self) -> usize
pub fn definitions(&self) -> &FontDefinitions
Sourcepub fn image(&self) -> ColorImage
pub fn image(&self) -> ColorImage
The full font atlas image.
Sourcepub fn font_image_size(&self) -> [usize; 2]
pub fn font_image_size(&self) -> [usize; 2]
Current size of the font image.
Pass this to crate::Tessellator
.
Sourcepub fn glyph_width(&mut self, font_id: &FontId, c: char) -> f32
pub fn glyph_width(&mut self, font_id: &FontId, c: char) -> f32
Width of this character in points.
If the font doesn’t exist, this will return 0.0
.
Sourcepub fn has_glyphs(&mut self, font_id: &FontId, s: &str) -> bool
pub fn has_glyphs(&mut self, font_id: &FontId, s: &str) -> bool
Can we display all the glyphs in this text?
Sourcepub fn row_height(&mut self, font_id: &FontId) -> f32
pub fn row_height(&mut self, font_id: &FontId) -> f32
Height of one row of text in points.
Returns a value rounded to emath::GUI_ROUNDING
.
Sourcepub fn families(&self) -> Vec<FontFamily>
pub fn families(&self) -> Vec<FontFamily>
List of all known font families.
Sourcepub fn layout_job(&mut self, job: LayoutJob) -> Arc<Galley>
pub fn layout_job(&mut self, job: LayoutJob) -> Arc<Galley>
Layout some text.
This is the most advanced layout function.
See also Self::layout
, Self::layout_no_wrap
and
Self::layout_delayed_color
.
The implementation uses memoization so repeated calls are cheap.
pub fn num_galleys_in_cache(&self) -> usize
Sourcepub fn font_atlas_fill_ratio(&self) -> f32
pub fn font_atlas_fill_ratio(&self) -> f32
How full is the font atlas?
This increases as new fonts and/or glyphs are used,
but can also decrease in a call to Fonts::begin_pass
.
Sourcepub fn layout(
&mut self,
text: String,
font_id: FontId,
color: Color32,
wrap_width: f32,
) -> Arc<Galley>
pub fn layout( &mut self, text: String, font_id: FontId, color: Color32, wrap_width: f32, ) -> Arc<Galley>
Will wrap text at the given width and line break at \n
.
The implementation uses memoization so repeated calls are cheap.
Sourcepub fn layout_no_wrap(
&mut self,
text: String,
font_id: FontId,
color: Color32,
) -> Arc<Galley>
pub fn layout_no_wrap( &mut self, text: String, font_id: FontId, color: Color32, ) -> Arc<Galley>
Will line break at \n
.
The implementation uses memoization so repeated calls are cheap.
Sourcepub fn layout_delayed_color(
&mut self,
text: String,
font_id: FontId,
wrap_width: f32,
) -> Arc<Galley>
pub fn layout_delayed_color( &mut self, text: String, font_id: FontId, wrap_width: f32, ) -> Arc<Galley>
Like Self::layout
, made for when you want to pick a color for the text later.
The implementation uses memoization so repeated calls are cheap.