ratex_pdf/lib.rs
1//! PDF export for RaTeX [`DisplayList`](ratex_types::display_item::DisplayList).
2//!
3//! Built directly on [pdf-writer](https://docs.rs/pdf-writer) with manual font subsetting
4//! via [subsetter](https://docs.rs/subsetter). Produces compact PDFs with embedded CIDFontType2
5//! fonts and `Identity-H` encoding. No high-level abstraction layer.
6//!
7//! # Font sources
8//!
9//! - **Without** the `embed-fonts` feature: set [`PdfOptions::font_dir`] to a directory that
10//! contains the KaTeX `.ttf` files (same layout as the repo `fonts/` tree). The default
11//! [`PdfOptions::default`] uses an empty `font_dir` and will fail at render time until you set it.
12//! - **With** `embed-fonts`: glyph bytes are loaded from the `ratex-katex-fonts` crate; `font_dir` is
13//! ignored. The `render-pdf` binary (`cli` feature) always enables `embed-fonts`, so its
14//! `--font-dir` flag does not affect which fonts are embedded.
15
16mod fonts;
17mod renderer;
18
19pub use renderer::{render_to_pdf, PdfError, PdfOptions};