Skip to main content

FontRefExt

Trait FontRefExt 

Source
pub trait FontRefExt {
    // Required methods
    fn get_bytes(&self) -> &[u8] ;
    fn get_full_font_metrics(&self) -> FontMetrics;
}
Expand description

Extension trait for FontRef to provide access to font bytes and metrics

This trait provides methods that require access to the inner ParsedFont data.

Required Methods§

Source

fn get_bytes(&self) -> &[u8]

Get the original font bytes. Returns an empty slice when the underlying ParsedFont was created without retaining its source bytes (the default since the lazy-font-loading refactor). Callers that need the bytes for PDF embedding must construct the ParsedFont via ParsedFont::with_source_bytes.

Source

fn get_full_font_metrics(&self) -> FontMetrics

Get the full font metrics (PDF-style metrics from HEAD, HHEA, OS/2 tables)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FontRefExt for FontRef

Implementors§