Skip to main content

TextStateFont

Trait TextStateFont 

Source
pub trait TextStateFont: Debug {
    // Required methods
    fn id(&self) -> &str;
    fn decode_show_operand(
        &self,
        operand: &Object,
    ) -> Result<Vec<DecodedGlyph>, PdfEditError>;
    fn advance(&self, cid: u32, font_size: f64) -> f64;
}
Expand description

Per-page active font handle used while walking a content stream (§5.2’s visit_text_show). Implemented by whatever page-font resolver pdf_inspect.rs (lane B1) builds from a page’s /Resources/Font — distinct from PdfFontResolver (§7.2), which resolves catalog fonts for composition/embedding, not content-stream decoding.

Required Methods§

Source

fn id(&self) -> &str

Stable identifier for this font within its page’s resource dictionary, threaded onto every PositionedGlyph this font produces (font_id).

Source

fn decode_show_operand( &self, operand: &Object, ) -> Result<Vec<DecodedGlyph>, PdfEditError>

Decode one Tj/TJ string operand into glyphs via this font’s encoding/ToUnicode map.

Source

fn advance(&self, cid: u32, font_size: f64) -> f64

Glyph advance width, in text-space units already scaled by font_size (i.e. w0/1000 * font_size), for cid.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§