THPDFHeadlessTextAppearanceOptions
Options in HPDFHeadlessAppearance for Unicode Form XObjects with measured layout and optional complex shaping
| Field | Default and contract |
|---|---|
Width, Height | 200 by 30 PDF units; document filling derives these values from each widget rectangle |
FontSize | 12 PDF units; zero requests auto-fit with a maximum of 12 |
Padding | 2 units on each edge, leaving a positive inner clip rectangle |
TextColor[0..2] | Black RGB components, each from zero through one |
PaintWhiteBackground | True, painting the complete widget background white |
Alignment | htaLeft; supports center and right, with inherited field Q taking precedence during document filling |
Multiline, WrapText | False and True; CR/LF paragraph breaks and measured logical-line wrapping, with document filling deriving multiline mode from the field flags |
CombCells | Zero; a positive value creates equal-width Unicode scalar cells for single-line text, derived from MaxLen for comb fields; supplementary characters use one cell, and a shaped cluster covering k scalars occupies k cells |
Rotation | Zero; positive angles rotate counterclockwise in PDF user space, with multiples of 90 degrees normalized modulo 360, so -90 becomes 270 and 450 becomes 90; 90 and 270 degrees exchange the logical text viewport width and height while retaining the physical Width and Height; document filling derives the angle from widget MK.R without rewriting that stored value |
LineSpacing | 1.2 times font size, bounded from 1 through 10 |
CharacterSpacing, WordSpacing | Zero PDF points; finite positive or negative spacing bounded by an absolute value of 1000000; outside comb layout, word spacing applies to U+0020 and character spacing applies once after each direct scalar or shaped cluster, including the last cluster; neither option changes comb positioning |
ShapeComplexText | True; loads matching HarfBuzz and FriBidi runtimes only when complex text requires shaping |
FallbackFontFamilies | False; True enables complete-grapheme font fallback across explicitly supplied rich-text families, with original values and authored styles retained; the single-font text builder does not search other families |
HighlightLines | Empty dynamic integer array; each nonnegative visible line index paints a blue background, with row count bounded by MaxGlyphs and offscreen rows clipped |
HighlightLine | -1; a nonnegative visible line index paints a blue selection background for list box appearances |
Border | habNone; habRectangle or habCircle paints a bounded button outline |
MaxFontBytes | 8 MiB across selected programs and candidate programs inspected during supplied-family fallback |
MaxObjectBytes | 16 MiB per dictionary or stream including its payload |
MaxGlyphs | 65535 input scalars and generated glyphs, bounded by the 16-bit CID space |
CancellationToken | Nil or a caller-owned token that stays alive throughout the operation |
Dimensions, padding, and font size must be finite; dimensions and a nonzero font size are bounded from 0.000001 through 1000000 units, and the inner clip rectangle must remain at least 0.000001 units on each axis
With Multiline enabled and FontSize zero, auto-fit checks both the maximum line advance and the complete metric block height against the padded logical viewport, using the existing direct or shaped line layout
The existing bounded sequence of size reductions must produce a final layout that fits both axes; otherwise the builder reports haInvalidOptions instead of returning an appearance that remains too wide or too tall
For multiline auto-fit, CharacterSpacing and WordSpacing remain point-valued additions while font size decreases, so fixed spacing can prevent the bounded sequence from finding a fit; this check measures logical advances and metric height rather than arbitrary glyph ink bounds, and does not promise the globally largest fitting font size
Auto-fit that would serialize a zero font size is rejected, while fixed-size text is clipped to the inner widget rectangle
Outside comb layout, text spacing participates in measured widths, alignment, wrapping, and auto-fit; generated CID text uses absolute glyph positioning because PDF Tw does not apply to a two-byte Identity-H space code
Shaped comb layout preserves relative glyph geometry within each cluster and centers its combined advance and ink extent in the assigned scalar cells; supplied-family fallback shares one complete-text bidi grid, effective font size and baseline
In multiline appearances, TAB uses eight times the supplied font's bare space advance at the effective size and receives neither CharacterSpacing nor WordSpacing; complex text with tabs retains paragraph bidi context and recalculates tab stops after wrapping and each automatic size reduction
Document filling further caps object and glyph budgets by document options, caps font size in bytes by the decoded-stream budget, and admits the aggregate new objects against the remaining file budget