Skip to content

feat: fonts for PDF writing - #107

Merged
Chimi6 merged 1 commit into
mainfrom
pdf-fonts
Sep 28, 2026
Merged

Chimi6 merged 1 commit into
mainfrom
pdf-fonts

Conversation

@Chimi6

@Chimi6 Chimi6 commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Step 2 of documents to PDF.

  • src/io/font: TrueType/OpenType reader (table directories and collections, cmap 4 and 12, head, hhea, maxp, hmtx, OS/2, post, name) and a subsetter for TrueType outlines (composites followed, glyph ids kept, hinting tables kept).
  • src/io/font/system.rs (not in wasm): installed fonts on Linux, macOS, and Windows, ranked (broad sans serifs, one per script, symbols, CJK fallbacks, the rest) and probed by character map only.
  • PDF writer: Type0 Identity-H fonts over CIDFontType2 subsets with /W widths and ToUnicode, written at the end with every used glyph.
  • Composer: each character set from its face (standard font, embedded font, or ? when nothing has it). --font file.ttf / ConvertOptions::font sets the body text in a given font. Tabs in running text are spaces.
  • Tests: Droid Sans fixture (Apache-2.0) for the reader and subset checksums; a given font subset and embedded, text reading back. Every Pages and Word fixture converts without losses and renders in poppler. Greek, Cyrillic, Hebrew, Arabic, CJK, Hindi, Thai, and symbols extract as written via pdftotext.
  • Known deviations documented (no bidi or shaping for complex scripts; CFF fonts not embedded). Held until the Mac Pages <-> Word work lands: using a document's own font names.
  • Binary 2,667,480 (budget 2,700,000); wasm 1,340,426 (budget 1,400,000).

@Chimi6
Chimi6 merged commit 814de4e into main Sep 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant