TextGlyph

data class TextGlyph(val byteOffset: Int, val byteCount: Int, val gid: Int, val text: String, val advanceWidth: Double, val outline: KitePath?, val isWordSpace: Boolean, val xOffset: Double = 0.0, val yOffset: Double = 0.0)

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

The presence of TextGlyph lets the renderer walk a code-unit-aware sequence rather than iterating bytes one at a time. Type 0 composite fonts need this, because each glyph consumes 2 bytes (Identity-H) or other variable-length CMap encodings.

Simple fonts produce one TextGlyph per byte; CIDFonts produce one per (1- or 2-byte) code unit consumed from the input.

Constructors

Link copied to clipboard
constructor(byteOffset: Int, byteCount: Int, gid: Int, text: String, advanceWidth: Double, outline: KitePath?, isWordSpace: Boolean, xOffset: Double = 0.0, yOffset: Double = 0.0)

Properties

Link copied to clipboard

Glyph advance width in font design units (1/1000 em for most fonts).

Link copied to clipboard

How many bytes this code unit consumed (1 for simple, 2 for Identity-H).

Link copied to clipboard

Byte offset in the input where this code unit started.

Link copied to clipboard
val gid: Int

Glyph index in the embedded font (TrueType / CFF / Type 1), or -1 if unresolved.

Link copied to clipboard

True iff this code unit corresponds to ASCII space (0x20). Needed for Tw word spacing.

Link copied to clipboard

Outline ready to draw (TTF/CFF/Type 1 already resolved), or null if no embedded font.

Link copied to clipboard

Decoded unicode text for this glyph. Empty if no mapping is known.

Link copied to clipboard

Positioning offset in font design units (GPOS mark attachment), applied to this glyph's origin without affecting the pen advance. Scaled by the same fontSize/unitsPerEm as the outline. Zero for normal glyphs.

Link copied to clipboard