PdfFont

sealed interface PdfFont

A resolvable font. Three flavours are supported:

  • Default — the platform's default sans-serif font. Always available, no registration needed. Used when no font is specified anywhere.

  • System — a font installed on the device by name (e.g. "Helvetica", "Times New Roman"). If the name doesn't resolve, the renderer falls back to Default.

  • Custom — a font supplied as raw bytes (TTF/OTF). Registered with the platform font manager once per document; can be used by name thereafter.

Two PdfFont instances compare equal iff they refer to the same source — see each subtype's equals for details.

Inheritors

Types

Link copied to clipboard
object Companion

Pre-set PdfFont.System references for the writing systems whose native shaping needs differ from Latin (CJK ideographs, Arabic cursive joining, Persian variants). Pass any of these to com.conamobile.pdfkmp.style.TextStyle.font when authoring text in the matching script.

Link copied to clipboard
class Custom(val name: String, val bytes: ByteArray) : PdfFont

A font supplied as TTF/OTF bytes. The name is used to register the font with the platform on first use and to look it up on subsequent draws — pick a unique name per font face.

Link copied to clipboard
data object Default : PdfFont

Platform-default font. Never registered explicitly; the renderer maps this to whatever the OS uses for sans-serif (Roboto on Android, Helvetica on iOS).

Link copied to clipboard
data class System(val name: String) : PdfFont

A font referenced by name. The name is looked up against the platform font registry at render time. Falls back to Default when missing.

Properties

Link copied to clipboard
abstract val key: String

Stable identifier used for caching the resolved platform font.