Skip to main content

LoadedFont

Struct LoadedFont 

Source
pub struct LoadedFont {
    pub atlas_slot: usize,
    pub metrics: FontMetrics,
    pub atlas_w: u32,
    pub atlas_h: u32,
    pub size_px: f32,
    pub cap_px: f32,
    pub supersample: f32,
}
Expand description

Per-font data kept in memory after init() so step() can build text quads each frame.

Fields§

§atlas_slot: usize

Index into the backend’s text atlas texture array.

§metrics: FontMetrics

Per-glyph metrics keyed by Unicode code point.

§atlas_w: u32

Atlas width in pixels.

§atlas_h: u32

Atlas height in pixels.

§size_px: f32

Rasterisation height (px) used to position glyphs vertically.

§cap_px: f32

Cap height (logical px): the bearing of an uppercase reference glyph, used to vertically center the visible text within its line box. The full em (size_px) is taller than the visible glyphs, so centering on the em alone leaves a gap above the caps; centering the cap band fixes that.

§supersample: f32

Atlas supersample factor: glyph atlas_w/atlas_h are stored in atlas texels, which are this many times larger than the glyph’s size in logical (layout) pixels. The on-screen quad divides by it so the text lays out at its requested size while the extra texels supersample the glyph.

Auto Trait Implementations§

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 = !

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.