Skip to main content

Glyph

Struct Glyph 

Source
pub struct Glyph {
    pub name: String,
    pub encoding: Encoding,
    pub width_horizontal: Option<GlyphWidth>,
    pub width_vertical: Option<GlyphWidth>,
    pub bounding_box: BoundingBox,
    pub origin_offset: Option<Coord>,
    pub bitmap: Vec<u8>,
}
Expand description

Glyph.

Fields§

§name: String

Name.

Specified by STARTCHAR.

§encoding: Encoding

Encoding.

Specified by ENCODING.

§width_horizontal: Option<GlyphWidth>

Width for writing mode 0.

Specified by DWIDTH and SWIDTH and used for METRICSSET 0 and METRICSSET 2.

§width_vertical: Option<GlyphWidth>

Width for writing mode 1.

Specified by DWIDTH1 and SWIDTH1 and used for METRICSSET 1 and METRICSSET 2.

§bounding_box: BoundingBox

Bounding box.

Specified by BBX.

§origin_offset: Option<Coord>

Origin offset between writing mode 0 and 1.

Specified by VVECTOR.

§bitmap: Vec<u8>

Bitmap data.

Specified by the hex values between BITMAP and ENDCHAR.

Implementations§

Source§

impl Glyph

Source

pub fn pixel(&self, x: usize, y: usize) -> Option<bool>

Returns a pixel from the bitmap.

This method doesn’t use the BDF coordinate system. The coordinates are relative to the top left corner of the bounding box and don’t take the offset into account. Y coordinates increase downwards.

Returns None if the coordinates are outside the bitmap.

Source

pub fn pixels(&self) -> impl Iterator<Item = bool> + '_

Returns an iterator over the pixels in the glyph bitmap.

Iteration starts at the top left corner of the bounding box and ends at the bottom right corner.

Trait Implementations§

Source§

impl Clone for Glyph

Source§

fn clone(&self) -> Glyph

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Glyph

Source§

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

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

impl Default for Glyph

Source§

fn default() -> Glyph

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

impl PartialEq for Glyph

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Glyph

Auto Trait Implementations§

§

impl Freeze for Glyph

§

impl RefUnwindSafe for Glyph

§

impl Send for Glyph

§

impl Sync for Glyph

§

impl Unpin for Glyph

§

impl UnsafeUnpin for Glyph

§

impl UnwindSafe for Glyph

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