Struct FontsView

Source
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<'_>

Source

pub fn max_texture_side(&self) -> usize

Source

pub fn definitions(&self) -> &FontDefinitions

Source

pub fn image(&self) -> ColorImage

The full font atlas image.

Source

pub fn font_image_size(&self) -> [usize; 2]

Current size of the font image. Pass this to crate::Tessellator.

Source

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.

Source

pub fn has_glyph(&mut self, font_id: &FontId, c: char) -> bool

Can we display this glyph?

Source

pub fn has_glyphs(&mut self, font_id: &FontId, s: &str) -> bool

Can we display all the glyphs in this text?

Source

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.

Source

pub fn families(&self) -> Vec<FontFamily>

List of all known font families.

Source

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.

Source

pub fn num_galleys_in_cache(&self) -> usize

Source

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.

Source

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.

Source

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.

Source

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> Freeze for FontsView<'a>

§

impl<'a> !RefUnwindSafe for FontsView<'a>

§

impl<'a> Send for FontsView<'a>

§

impl<'a> Sync for FontsView<'a>

§

impl<'a> Unpin for FontsView<'a>

§

impl<'a> !UnwindSafe for FontsView<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.