Windows original typed rich form filling

Windows file jobs and hpdf_document_execute_json_v1 accept forms.fill requests containing richTextRuns alongside ordinary text, choice and button updates; all fields share one authenticated candidate PDF

The original typed runs reach the native appearance composer directly; AP generation does not round-trip through the serialised RV colour representation; plain V, standard rich RV and actual AP are prepared together

Request

{
  "schemaVersion": 1,
  "type": "forms.fill",
  "fontFamilies": ["DejaVu Sans", "DejaVu Serif Condensed"],
  "fields": [
    {"name": "Input", "richTextRuns": [
      {"text": "Original typed precision", "fontFamily": "DejaVu Sans",
       "fontStyle": "regular", "fontSize": 12.123456,
       "color": [0.123456, 0.234567, 0.345678]},
      {"text": "Another paragraph", "fontFamily": "DejaVu Serif Condensed",
       "fontStyle": "boldItalic", "fontSize": 14.125,
       "paragraphBreakBefore": true, "alignment": "center",
       "underline": true, "strikeOut": false}
    ]},
    {"name": "Plain", "value": "Changed scalar"},
    {"name": "Choice", "values": ["B", "C"]},
    {"name": "Check", "value": "Yes"}
  ]
}

Each field supplies richTextRuns or a scalar value or values; an optional value beside richTextRuns must exactly match the native derived plain text, including carriage returns between typed paragraphs; serialized richText is not a typed-run input

Each run requires text and accepts fontStyle, fontSize, color, underline, strikeOut, paragraphBreakBefore and alignment; fontStyle is regular, bold, italic or boldItalic; alignment is left, centre or right; RGB components are finite numbers from zero through one

Run sizes must be positive and at most 4096 points; a missing size uses the field fontSize or 12 points; native PDF numeric formatting still applies, whilst standard RV CSS serialises colours to eight-bit components

Field appearance options include fontSize, padding, characterSpacing, wordSpacing and paintWhiteBackground; genuine AP generation is required, so appearance=false is invalid

Actual font programs

A field fontFamilies array overrides the operation array; configured arrays contain one through sixteen nonempty valid family labels; matching folds ASCII case and compares other Unicode exactly; an explicit run fontFamily must match a configured label, and a missing run label selects the first family

Without fontFamilies, the original single-family path remains available; the font callback label comes from field fontFamily, operation fontFamily or DejaVu Sans; original single-family runs omit run fontFamily

File jobs add input, output and fonts; fonts maps each configured family label to regular, bold, italic and boldItalic file paths; only used styles and the regular face needed by scalar appearances are loaded; file paths must not alias the output

Versioned C ABI callers use the existing hpdf_form_data_operation_v1 extension and return readable hpdf_io_v1 tables from its font callback; family labels are UTF-8 and style values are 0 through 3; all actual programs are copied into bounded owned bytes before composing appearances

The original V1 symbols, base structure sizes and optional extension offsets remain unchanged; family/style assets are cached within one request and shared across fields without charging the same owned allocation repeatedly

Opt-in fallbackFontFamilies=true applies whole-grapheme fallback among actual supplied families; typed runs can retain an ordered fontFamilyCandidates array, with declared candidates considered before configured order; see Windows supplied-family rich font fallback for request inheritance and four-style callback loading

Current graph and publication

With no InputIO, the C ABI uses its owned loaded revision and actual pending graph; an optional InputIO supplies a replacement PDF, copied and authenticated privately before any font callback; neither borrowed input mutation nor a failed replacement may alter the committed context

OutputIO and ResultIO are required; the actual candidate PDF and result JSON must both finish successfully, followed by the final cancellation checkpoint, before the C ABI exchanges the document and source

A failed callback may already have received candidate bytes; callers must discard those bytes when the returned status is nonzero; the previously committed library context remains unchanged

File jobs stage the complete candidate and bounded reply before atomic replacement of the requested output; a missing font, policy failure, cancellation or capacity failure preserves the existing target

Policies and result

Existing signature integrity, DocMDP P1/P2/P3, FieldMDP locks, read-only flags and AES form-fill permissions are enforced through the native authenticated engine; signaturePolicy accepts the same explicit trust, timestamp and revocation settings as Windows form imports

A read-only same-input update succeeds only when actual AP operators, fonts, resources and field values are equivalent; compressed AP streams and noncanonical equivalent RV are supported; a true style change is still a change even if its RV colour quantizes to the same CSS value

A genuine unchanged request publishes exact bytes of the prepared current revision after policy authentication; pending graph edits are materialised in that current revision before the comparison

Successful replies include typedRichText=true, typedRichProfile=original-typed-runs-v1, updated, fieldCount, fontBytes and fields from the actual prepared candidate; formDataExchange.typedRichFill describes these implemented entry points

Each fields item retains the ordinary name, scalar value and fieldType summary; a choice backed by an array has an empty scalar value in this summary, whilst its full selection remains in the saved PDF and subsequent FDF/XFDF export

The direct ExecuteLoadedOperation job facade and legacy HPDFDocRunJob handle/font callback extension remain separate work; this binding does not add annotation, embedded-file, action or incremental-FDF interchange

Related topics

FillTypedData, Windows transaction, Native mixed typed updates, Windows FDF/XFDF exchange