Struct theme_parser::parser::pff2::Pff2

source ·
pub struct Pff2<T: FontValidation> {
    pub name: String,
    pub family: String,
    pub point_size: u16,
    pub weight: String,
    pub max_char_width: u16,
    pub max_char_height: u16,
    pub ascent: u16,
    pub descent: u16,
    pub leading: u16,
    pub glyphs: OwnedSlice<[Glyph]>,
    /* private fields */
}
Expand description

The PFF2 font, see Parser and Font type aliases.

Only contains relevant to GRUB metadata about the font as well as the glyph list.

Fields§

§name: String

Font name. Usually includes family, point size and weight

§family: String

Font family

§point_size: u16

Size of the font

§weight: String

Weight could be anything like normal, bold or italic

§max_char_width: u16

The dimetions of the glyphs

§max_char_height: u16

The dimetions of the glyphs

§ascent: u16

The highest point on the glyph (like the top of M)

§descent: u16

The lowest point on the glyph (like the bottom of g)

§leading: u16

The distance between baselines

§glyphs: OwnedSlice<[Glyph]>

A list of glyphs that are in the font

Implementations§

source§

impl Pff2<Unchecked>

source

pub fn parse(input: &[u8]) -> Result<Self, ParserError>

Constructs Self from a PFF2 buffer.

source

pub fn validate(self) -> Result<Font, FontValidationError>

Validates Self to be a valid font that can be used for rendering. See FontValidationError for reasons a font may be invalid.

source§

impl<T: FontValidation> Pff2<T>

source

pub fn glyph(&self, c: u32) -> Option<&Glyph>

Trait Implementations§

source§

impl<T: Clone + FontValidation> Clone for Pff2<T>

source§

fn clone(&self) -> Pff2<T>

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<T: Debug + FontValidation> Debug for Pff2<T>

source§

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

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

impl<T: FontValidation> Default for Pff2<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: PartialEq + FontValidation> PartialEq for Pff2<T>

source§

fn eq(&self, other: &Pff2<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Eq + FontValidation> Eq for Pff2<T>

source§

impl<T: FontValidation> StructuralEq for Pff2<T>

source§

impl<T: FontValidation> StructuralPartialEq for Pff2<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Pff2<T>
where T: RefUnwindSafe,

§

impl<T> !Send for Pff2<T>

§

impl<T> !Sync for Pff2<T>

§

impl<T> Unpin for Pff2<T>
where T: Unpin,

§

impl<T> UnwindSafe for Pff2<T>
where T: UnwindSafe,

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

§

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>,

§

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>,

§

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.