pub trait Font:
Send
+ Sync
+ Debug {
// Required methods
fn codes(&self, bytes: &[u8]) -> Vec<(u32, usize)>;
fn width(&self, code: u32) -> f64;
fn unicode(&self, code: u32) -> Option<String>;
fn name(&self) -> &str;
// Provided methods
fn is_vertical(&self) -> bool { ... }
fn vertical_advance(&self, _code: u32) -> f64 { ... }
}Expand description
A loaded font, as the interpreter needs it: how a string splits into
character codes, how far each code advances, and (for extraction) what
text it stands for. Implemented by otf-pdf-font.
Required Methods§
Sourcefn codes(&self, bytes: &[u8]) -> Vec<(u32, usize)>
fn codes(&self, bytes: &[u8]) -> Vec<(u32, usize)>
Splits a shown string into (code, byte length) pairs.
Provided Methods§
Sourcefn is_vertical(&self) -> bool
fn is_vertical(&self) -> bool
Whether the font is written vertically (an -V CMap).
Sourcefn vertical_advance(&self, _code: u32) -> f64
fn vertical_advance(&self, _code: u32) -> f64
Vertical advance of code in vertical writing (negative is down).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".