Struct epaint::text::font::FontImpl

source ·
pub struct FontImpl {
    name: String,
    ab_glyph_font: FontArc,
    scale_in_pixels: u32,
    height_in_points: f32,
    y_offset_in_points: f32,
    ascent: f32,
    pixels_per_point: f32,
    glyph_info_cache: RwLock<HashMap<char, GlyphInfo>>,
    atlas: Arc<Mutex<TextureAtlas>>,
}
Expand description

A specific font with a size. The interface uses points as the unit for everything.

Fields§

§name: String§ab_glyph_font: FontArc§scale_in_pixels: u32

Maximum character height

§height_in_points: f32§y_offset_in_points: f32§ascent: f32§pixels_per_point: f32§glyph_info_cache: RwLock<HashMap<char, GlyphInfo>>§atlas: Arc<Mutex<TextureAtlas>>

Implementations§

source§

impl FontImpl

source

pub fn new( atlas: Arc<Mutex<TextureAtlas>>, pixels_per_point: f32, name: String, ab_glyph_font: FontArc, scale_in_pixels: f32, tweak: FontTweak, ) -> Self

source

fn ignore_character(&self, chr: char) -> bool

Code points that will always be replaced by the replacement character.

See also invisible_char.

source

fn characters(&self) -> impl Iterator<Item = char> + '_

An un-ordered iterator over all supported characters.

source

fn glyph_info(&self, c: char) -> Option<GlyphInfo>

\n will result in None

source

pub fn pair_kerning(&self, last_glyph_id: GlyphId, glyph_id: GlyphId) -> f32

source

pub fn row_height(&self) -> f32

Height of one row of text in points.

source

pub fn pixels_per_point(&self) -> f32

source

pub fn ascent(&self) -> f32

This is the distance from the top to the baseline.

Unit: points.

source

fn allocate_glyph(&self, glyph_id: GlyphId) -> GlyphInfo

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