pub enum Font {
Builtin {
encoding: Encoding,
},
TrueType {
encoding: Encoding,
data: Vec<u8>,
},
}Expand description
A resolved font ready to place glyphs.
Variants§
Builtin
The built-in fallback: a 5×7 bitmap alphabet, used when the document carries no usable font program (all of the base-14 cases).
TrueType
An embedded TrueType program.
Implementations§
Source§impl Font
impl Font
Sourcepub fn true_type(encoding: Encoding, data: Vec<u8>) -> Option<Self>
pub fn true_type(encoding: Encoding, data: Vec<u8>) -> Option<Self>
An embedded TrueType program, rejected when it cannot be parsed.
Sourcepub fn glyph(&self, code: u8) -> Option<Glyph>
pub fn glyph(&self, code: u8) -> Option<Glyph>
The outline and advance for a byte code, or None when there is no
glyph for it.
Sourcepub fn advance(&self, code: u8) -> f64
pub fn advance(&self, code: u8) -> f64
The advance of a code in em units, falling back to the built-in metric.
Sourcepub fn glyph_by_id(&self, id: u16) -> Option<Glyph>
pub fn glyph_by_id(&self, id: u16) -> Option<Glyph>
The outline for a glyph id, which is how composite (Type 0) fonts select
glyphs: a CID maps to an id through /CIDToGIDMap, not through a cmap.
The built-in bitmap alphabet has no glyph ids, so it has no answer here.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Font
impl Freeze for Font
impl Move 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more