EmbeddedFont
class EmbeddedFont
A TrueType font loaded for embedding into a PDF the writer produces.
This is the from-scratch writer's path to non-Latin / custom text. The whole font program is embedded as a Type0 / CIDFontType2 composite font with Identity-H encoding plus a /ToUnicode map, so the output renders and extracts arbitrary Unicode (including CJK). Embedding the full program, without subsetting, matches MuPDF's default pdf_add_cid_font behaviour.
Load once and reuse the handle across pages and documents:
val font = EmbeddedFont.load(myTtfBytes)
val pdf = PdfBuilder()
.page { text(font, 24.0, 72.0, 700.0, "日本語: Hello") }
.build()Content copied to clipboard
Scope: only TrueType (glyf outline) fonts are supported. OpenType/CFF (.otf, sfnt tag "OTTO") and glyph subsetting are later milestones; load rejects CFF fonts with a clear error rather than embedding something broken.