Skip to main content

Font

Struct Font 

Source
pub struct Font {
    pub flags: u16,
    pub upem: i32,
    pub asc: i32,
    pub desc: i32,
    pub gap: i32,
    pub caph: i32,
    pub xh: i32,
    pub ulpos: i32,
    pub ulthick: i32,
    pub nglyphs: u32,
    pub fallback: u32,
    /* private fields */
}

Fields§

§flags: u16§upem: i32§asc: i32§desc: i32§gap: i32§caph: i32§xh: i32§ulpos: i32§ulthick: i32§nglyphs: u32§fallback: u32

Implementations§

Source§

impl Font

Source

pub fn parse(data: &'static [u8]) -> Option<Font>

font_register’s parse: None when the data is not SGF1

Source

pub fn new(data: &'static [u8]) -> Font

Source

pub fn hdr(&self) -> Hdr

Source

pub fn lookup(&self, cp: u32) -> Option<u32>

binary search over the ranges {u32 firstCp, u16 count, u16 firstGlyph} [font_lookup]

Source

pub fn glyph(&self, cp: u32) -> u32

Source

pub fn adv(&self, g: u32) -> i32

Source

pub fn kern(&self, g1: u32, g2: u32) -> i32

kern(l, r) = matrix[lclass[l] * kernR + rclass[r]] * 4 font units

Source

pub fn glyph_box(&self, g: u32) -> Option<[i32; 4]>

Source

pub fn path(&self, g: u32, gp: &mut Gp, path: &mut Path, depth: u32)

glyph_path: append the outline transformed by gp (implied on-curve midpoints, composites recursively)

Source

pub fn outline(&self, g: u32, dx: i32, dy: i32, depth: u32, ol: &mut Outline)

append glyph g (composites resolved) to the outline buffer: points in font units + (dx, dy), one contour per SGF1 contour [sgf_outline]

Auto Trait Implementations§

§

impl Forget for Font

§

impl Freeze for Font

§

impl RefUnwindSafe for Font

§

impl Send for Font

§

impl Sync for Font

§

impl Unpin for Font

§

impl UnsafeUnpin for Font

§

impl UnwindSafe for Font

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> ErasedDestructor for T
where T: 'static,

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

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.