Skip to main content

TtFont

Struct TtFont 

Source
pub struct TtFont {
Show 13 fields pub face_index: u32, pub data: Vec<u8>, pub hdr: Hdr, pub fm: Metrics, pub serial: u64, pub kind: u32, pub flags: u32, pub nglyphs: u32, pub upem: u32, pub tab: [(u32, u32); 25], pub names: [Vec<u8>; 5], pub cpal: u32, pub cpaln: u32, /* private fields */
}
Expand description

a runtime font context (TrueType or CFF outlines)

Fields§

§face_index: u32§data: Vec<u8>§hdr: Hdr§fm: Metrics§serial: u64§kind: u32§flags: u32§nglyphs: u32§upem: u32§tab: [(u32, u32); 25]§names: [Vec<u8>; 5]§cpal: u32§cpaln: u32

Implementations§

Source§

impl TtFont

Source

pub fn open( data: Vec<u8>, face: u32, ol: &mut Outline, serial: u64, ) -> Result<Box<TtFont>, i32>

ttf_open(data, face): the context, or ERR_*

Source

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

glyph for cp (0 = .notdef). Symbol fonts ((3,0) cmap) map like GDI: U+0000..U+00FF and the Windows-1252 characters to U+F000 + their code page byte [ttf_glyph]

Source

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

Source

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

advance (hmtx; the last long metric repeats) [ttf_adv]

Source

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

sum of the ‘kern’ format 0 values [tt_kern_table]

Source

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

GPOS ‘kern’ when present, else ‘kern’ [ttf_kern]

Source

pub fn name(&self, which: u32) -> &[u8] ⓘ

font_name of this font (“” for an unknown id) [ttf_name]

Source

pub fn prep(&self, glyph: u32, ol: &mut Outline) -> bool

the outline of glyph into the buffer (owner set either way): true = not empty [ttf_prep]

Source

pub fn bbox(&self, g: u32, ol: &mut Outline) -> Option<[i32; 4]>

control box (font units) and the prepared outline [ttf_box]

Source

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

append the outline to the path with the gp transform [ttf_path]

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