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 FontsImplImplementations§
Source§impl FontsView<'_>
impl FontsView<'_>
pub fn options(&self) -> &TextOptions
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.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for FontsView<'a>
impl<'a> !UnwindSafe for FontsView<'a>
impl<'a> Freeze for FontsView<'a>
impl<'a> Send for FontsView<'a>
impl<'a> Sync for FontsView<'a>
impl<'a> Unpin for FontsView<'a>
impl<'a> UnsafeUnpin for FontsView<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more