Native Rich Text Fields

SetRichTextFieldValueWithAppearance writes synchronised plain text V, canonical XHTML RV, the RichText field flag and actual appearances for every existing widget

Each run supplies Unicode text, a font style, a positive point size, RGB colour, optional underline or strikeout, paragraph breaks and left, centre or right alignment; the four style fonts are caller-supplied Unicode TrueType programs with the existing editing and embedding checks

Runs use a 12pt regular black style by default; paragraph alignment comes from its first run and defaults to left

The appearance uses real embedded style fonts, glyph mappings and measured word fragments with shared line baselines; repeated fragments share each style font program within a widget

Explicit CR, LF, CRLF, NEL, LINE SEPARATOR and PARAGRAPH SEPARATOR breaks and paragraph transitions require a multiline field; measured wrapping, widget rotations and clipping use the actual widget rectangle

The typed update can enable rich text on a plain text field, whilst password, file-select and comb combinations are rejected before mutation

Read-only, MaxLen, authenticated signed-document policies, encrypted form-fill permissions, cancellation and object, font, glyph and output budgets still apply

All rich updates prepare V, RV, Ff and AP overrides before changing the document; saved strings and streams retain the original AES-256 R5 or R6 policy

Style arrays, layout lines and painted fragments each have a 4096-item ceiling in addition to the configured document limits; style font bytes are charged as an aggregate

Ordinary SetTextFieldValueWithAppearance calls on an existing rich field replace its content with the supplied plain style and synchronise RV; value-only SetTextFieldValue calls also synchronise RV and retain NeedAppearances=true

GetRichTextFieldValue reads the actual stored XHTML text string or UTF-8 text stream, including inherited values

The first run of each paragraph selects its alignment even when that run has empty text; inline style changes and explicit line breaks retain that paragraph alignment

Overwide words in wrapped multiline fields are split at Unicode 17 extended grapheme boundaries, preserving combining sequences, supplementary scalars, emoji sequences and original V/RV text; an indivisible cluster wider than the field remains intact and clipped

Rectangle and circle borders are painted before the content clip, and selected multiline rows receive actual blue backgrounds using the measured ascent, descent and spacing of each rich line

Native JSON ABI

{"schemaVersion":1,"type":"forms.fill","fields":[
  {"name":"Input","fontFamily":"DejaVu Sans Mono","richTextRuns":[
    {"text":"Regular Unicode text "},
    {"text":"Bold red text","fontStyle":"bold","fontSize":20,"color":[1,0,0]},
    {"text":"Next paragraph","fontStyle":"italic","paragraphBreakBefore":true,
     "alignment":"center","underline":true}
  ]}
]}

richTextRuns is an array of objects with required text and optional fontStyle, fontSize, color, underline, strikeOut, paragraphBreakBefore and alignment; fontStyle accepts regular, bold, italic or boldItalic

Optional fontFamilies arrays select actual named programs per run through fontFamily, with an edit-level array overriding the operation-level array and omitted run labels selecting the first family

Omitted run fontSize uses the field operation fontSize when positive, otherwise 12; an optional value must exactly match the plain text derived from the runs, using a carriage return between explicit paragraphs

Styled runs require appearance=true; forms.read returns the actual stored XHTML in richText for a rich field

The ABI retains its existing operation layout and prepares complete binary and result output before committing the new loaded context; failed writes or cancellation preserve the prior field

Acceptance and remaining work

Tests/Linux/Run-HeadlessRichTextAcceptance.sh and Tests/Linux/HotPDFHeadlessRichTextTests.pas exercise actual saved PDFs; Verify-HeadlessRichText.py independently checks XHTML, values, four real font programs, glyph maps, decoration paths and visible widget pixels

This API accepts typed runs and consumes default Unicode 17 opportunities over complete paragraphs, preserving word, nonbreaking-space, punctuation and numeric groups across style changes; groups that fit a fresh line move together using their actual styled font advances

Style group wrapping also retains shared baselines for mixed point sizes and coalesces CRLF across style seams in both actual layout and canonical XHTML

Grapheme fitting across styles assigns complete overwide logical clusters to one physical line, retaining actual font, colour and size fragments and the existing clipping behaviour for an indivisible cluster wider than the rectangle

Contextual joining uses the surrounding Unicode text and each actual physical line retains paragraph direction whilst ordering mixed bidi and script items across typed styles

Marks across styles use genuine GPOS attachments for actual base, ligature and preceding mark glyphs, preserving each style font, point size and colour and visible glyph overhangs

Rich FDF and XFDF exchange decodes the supported bounded XHTML style profile into actual embedded fonts and saved appearances

Explicit directional embeddings, overrides, isolates and paired-bracket context survive automatic wrapping across typed styles; one shared logical paragraph order supplies independent physical-line reordering and native contextual glyph shaping

Clusters containing only Unicode directional controls preserve the original logical value and selection text without consuming character spacing; visible clusters and ordinary spaces retain their configured advances

Paragraph-derived line order and cached line reordering preserve complete UTF-16 scalar boundaries and reset physical-line trailing whitespace without mutating the shared paragraph record

Named font families provide explicit typed-run and bounded XHTML selection with real family fonts, independent advances and family-aware form import

Supplied-family fallback selects complete graphemes across authored style seams, and Linux JSON and versioned callbacks bind the same behaviour to actual configured font programs

Internal style sheets apply the shared bounded selector cascade to native rich values and FDF/XFDF imports; broader XHTML/CSS, external style sheets and general layout remain active work

Native rich-text field behaviour · Document API