Skip to main content

Crate rustyfi_pdf

Crate rustyfi_pdf 

Source
Expand description

PDF output backend (handlePdf.ml, on top of pdf-writer): base-14 Type1 fonts, uncompressed content streams, ttf-parser-backed metrics with CID-keyed TrueType embedding, raster Image XObjects.

Re-exports§

pub use base14::Base14Metrics;
pub use cid::render_pdf_ttf;
pub use cid::render_pdf_ttf_with;
pub use fonts::FontConfigError;
pub use fonts::FontFlags;
pub use fonts::FontRegistry;
pub use fonts::FontSource;
pub use ttf::FontError;
pub use ttf::TtfFontStore;

Modules§

base14
Base-14 Helvetica metrics (advance widths transcribed from the freely redistributable Adobe Core-14 AFM files), covering ASCII 32–126. No font files are parsed — advances come from this fixed table.
cid
CID-keyed (Type0/CIDFontType2 for glyf, Type0/CIDFontType0 for CFF) font embedding, with a required ToUnicode CMap so pdftotext-style extraction keeps working. The sibling of render_pdf (base-14 Type1): it shares the page geometry / line-layout plumbing but writes Identity-H glyph-index content streams against real embedded font files.
fonts
Font configuration discovery and resolution: reads a small, plain-JSON font configuration and turns it into a TtfFontStore via TtfFontStore::load.
ttf
A FontMetrics provider backed by real TrueType/OpenType font files. Loads up to three faces — regular, bold, oblique — mapped onto the existing FontKey(0/1/2) convention from base14, and measures through ttf-parser’s cmap/hmtx/hhea/OS/2 tables instead of hardcoded AFM widths.

Enums§

PdfError

Functions§

render_pdf
Serialize typeset pages into a complete PDF document. images is the document-wide image table (DocumentValue::images); pass &[] for a text-only document.
render_pdf_with
Same as render_pdf, but also emits the extras (/Annots, /Dests, /Outlines, per-page deco-graphics underlays) accumulated while evaluating the document (DocumentValue::extras).