Struct GlyphInstance

Source
pub struct GlyphInstance {
    pub face_id: u64,
    pub font_index: u32,
    pub glyph_id: u32,
    pub px_size: u16,
    pub x: f32,
    pub y: f32,
    pub color: Option<Color>,
}
Expand description

One positioned glyph in logical layout space.

The matching font bytes remain owned by crate::TextSystem. Coordinates are logical pixels relative to the layout origin; they are not rounded to device pixels. color is absent for layouts that use one caller-supplied paint color and present for styled runs that carry their own color.

§Examples

use ailloli_ui_text::GlyphInstance;

let glyph = GlyphInstance {
    face_id: 7,
    font_index: 0,
    glyph_id: 42,
    px_size: 16,
    x: 12.5,
    y: 20.0,
    color: None,
};
assert_eq!(glyph.glyph_id, 42);
assert_eq!(glyph.color, None);

Fields§

§face_id: u64

Stable identifier of the selected font face within the Parley database.

§font_index: u32

Face index inside a font collection; zero for ordinary single-face fonts.

§glyph_id: u32

Font-specific glyph identifier used for rasterization.

§px_size: u16

Requested font size in logical pixels, rounded and clamped to at least one.

§x: f32

Horizontal glyph origin in logical pixels.

§y: f32

Vertical glyph origin in logical pixels.

§color: Option<Color>

Per-run linear-RGBA color, or None when paint supplies a uniform color.

Trait Implementations§

Source§

impl Clone for GlyphInstance

Source§

fn clone(&self) -> GlyphInstance

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GlyphInstance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for GlyphInstance

Source§

fn eq(&self, other: &GlyphInstance) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for GlyphInstance

Source§

impl StructuralPartialEq for GlyphInstance

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> ErasedDestructor for T
where T: 'static,