Automatic XFA list scrolling

Unit: HPDFXFAHeadless

HPDFXFAWriteHeadlessPDF generates an initial native list appearance that contains the first selected option, even when the selection sits near the end of a long option list

Visible option window

The creator measures the supplied TrueType font's ascent and descent at the effective field font size and works out the available rows from the native appearance builder's padding and line spacing

The first selected option starts the window; preceding whole options fill the unused space near the end when they fit, and the exact native integer /TI records the first visible option index

An unselected list starts at option zero; an empty list keeps an empty option array and appearance

Only visible display-label lines enter the appearance text and its glyph map, and selected visible lines are given highlight rectangles relative to the window

Multiple selections retain every selected export and option index even when distant selections cannot all fit within the same window

Multiline labels and persistence

CR, LF and CRLF label breaks use the same line semantics as the native appearance builder; a label that exceeds the available height contributes only its visible prefix to the appearance

The complete /Opt export/display pairs, /V values and /I selection indices stay in the PDF field graph, including labels and values outside the appearance window

Saved runtime XDP is consumed directly, so a changed selection or font size on a repeated instance produces that instance's own window whilst preserving other instances

Budgets and cancellation

Visible appearance text contributes to aggregate glyph use; the existing choice option-count and object-byte limits carry on bounding the complete option graph

Option traversal, multiline scanning, window construction and selected-line processing all include cancellation checks

A preparation failure keeps caller bytes, length and position; destination I/O failure follows the boundary documented by Automatic XFA creation

Scope

This behaviour applies to the initial saved list appearance and top index; later interactive scroll changes and dynamic choice-item editing require their own native editing integration

Combo appearances retain their scalar display behaviour, and choice creation documents values, option pairs and field flags