Package-level declarations

Types

Link copied to clipboard
class CffFont

CFF (Compact Font Format, Adobe Tech Note 5176) parser.

Link copied to clipboard
class CMap

CMap parser for PDF /ToUnicode streams (ISO 32000-1 §9.10.3, Adobe Tech Note 5014).

Link copied to clipboard
data class Contour(val points: List<GlyphPoint>)

One contour = sequence of points around a closed loop.

Link copied to clipboard
object Encodings

Character encoding tables ported from MuPDF (source/fitz/encodings.h, AGPL-3.0). Each table maps a 1-byte code (0..255) to either a unicode codepoint (Int, 0 for undefined) or a PostScript glyph name (String?, null for undefined).

Link copied to clipboard
data class GlyphBbox(val xMin: Int, val yMin: Int, val xMax: Int, val yMax: Int)
Link copied to clipboard
object GlyphList

Adobe Glyph List → Unicode mapping, ported from MuPDF (scripts/glyphlist.txt). Maps PostScript glyph names (e.g. "Adieresis", "fi") to unicode codepoints.

Link copied to clipboard
data class GlyphOutline(val contours: List<Contour>, val bbox: GlyphBbox)

Parsed glyph outline. TrueType outlines are sequences of contours, where each contour is points with on/off-curve flags. Off-curve points are quadratic Bézier control points; consecutive off-curve points imply an implied on-curve point at their midpoint.

Link copied to clipboard
data class GlyphPoint(val x: Int, val y: Int, val onCurve: Boolean)

A single glyph point in font design units.

Link copied to clipboard
data class Head(val flags: Int, val unitsPerEm: Int, val xMin: Int, val yMin: Int, val xMax: Int, val yMax: Int, val indexToLocFormat: Int)
Link copied to clipboard
data class Hhea(val ascent: Int, val descent: Int, val lineGap: Int, val numberOfHMetrics: Int)
Link copied to clipboard
class Hmtx(widths: IntArray)
Link copied to clipboard
data class Maxp(val numGlyphs: Int)
Link copied to clipboard
class PdfFont

A resolved PDF font.

Link copied to clipboard

Standard 14 base font widths, ported from the URW++ AFM files MuPDF ships. Metric-compatible with Adobe Helvetica / Times / Courier / Symbol / ZapfDingbats.

Link copied to clipboard
data class Table(val tag: String, val offset: Int, val length: Int)

SFNT table location in the byte buffer. Public so TtfCMap can take one as a parameter.

Link copied to clipboard
data class TextGlyph(val byteOffset: Int, val byteCount: Int, val gid: Int, val text: String, val advanceWidth: Double, val outline: PdfPath?, val isWordSpace: Boolean)

One glyph laid out from a Tj / TJ show-text byte string.

Link copied to clipboard

Pure-Kotlin TrueType / OpenType font parser.

Link copied to clipboard
class TtfCMap

TrueType / OpenType cmap table — character-code → glyph-index lookup.

Link copied to clipboard
class TtfFormatException(message: String)
Link copied to clipboard
class TtfReader(val bytes: ByteArray)

Big-endian binary reader for SFNT / TrueType / OpenType tables.