Repository navigation
Make an inline form font an object of its own before an appearance names it - #134
Merged
Merged
Conversation
…mes it When a form's font is written inline in /AcroForm /DR (a dictionary inside /DR, not an object of its own), the appearance a fill writes got an inline copy of it, and Acrobat showed none of the editable fields filled that way: nothing drawn, no highlight, no click. Acrobat minds the font /DR holds inline; the appearance's own copy alone does not matter. The first appearance written into the file that names such a font now makes it an object of its own, which /DR and the appearance both name.
A field without /Kids was taken to be its own widget even when it is not a widget annotation. The engine creates a field, sets its flags, then attaches its widgets, so making a new field read-only drew an appearance with an empty box onto the field dictionary itself. Such a field is its own widget only with /Subtype /Widget, as CPDF_InteractiveForm reads it.
This was referenced Nov 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
Filled fields blank in Acrobat. When a form's font is written inline in
/AcroForm /DR(a dictionary inside/DR, not an object of its own),CPDF_AnnotFontMap::PrepareFontResourcesgives the appearance a fill writes an inline copy of it (font_dict->Clone()). Acrobat 26 then shows none of the editable text fields filled that way: nothing is drawn, the field has no highlight, and it can't be clicked. Read-only fields still show.Acrobat was checked one change at a time, starting from the engine's filled file:
/DRstill inline: still blank;/DRfont made an object of its own, the appearances keeping their inline copies: every field shows, live;So Acrobat minds the font that
/DRholds inline. Real forms keep their/DRfonts as objects of their own (none of 131 real-world forms in a local scan writes them inline); hand-written and generated files often don't.A stray appearance on a created field.
CollectRawTxnControlstakes a field without/Kidsto be its own widget even when it is not a widget annotation. The engine creates a field, sets its flags, then attaches its widgets, so making a new field read-only (EPDFForm_SetFieldFlags, thenRegenerateFieldAppearances) drew an appearance with/BBox [0 0 0 0]onto the field dictionary itself, beside its widget's real one. A value written and redrawn before the widget is attached did the same.Change
CPDF_AnnotFontMap::PrepareFontResourcesstages a copy of an inline default form font. Once preparation succeeds,PublishFontResourcesgives that copy an object number and installs it in the appearance and in/AcroForm /DR /Font. Form fields, free text and redaction overlays use this path for stored appearances. Existing indirect fonts keep their object numbers./Kidsis its own widget only with/Subtype /Widget, asCPDF_InteractiveForm::AddTerminalFieldreads it. A field with no widget yet has no controls: its value is written, and nothing is drawn.own-appearance-generatorrule records when the font is published and which tests cover it.Tests
EPDFFormEmbedderTest.AFillMakesAnInlineFormFontAnObject: two fills of a form whose/DRfont is inline./DRand both appearances name one new object, in memory and in the saved file.AnInlineFormFontBecomesAnObjectInATransaction: the same in a layer transaction, as the engine writes.AFormFontThatIsAnObjectIsNamedAsItIs:text_form.pdf's font is named as it is, and/DRis not written (nothing of it is promoted on a layer).AFieldWithoutWidgetsGetsNoDrawing: create a field, make it read-only, fill it, then attach a widget. The field dictionary never gets an/AP; the widget does.EPDFAnnotEmbedderTest.FailedFreeTextAppearanceKeepsFormFontInlinerejects a zero-width FreeText box and checks the form resources, last object number and absence of an appearance. A retry with a valid box checks that the appearance and form share the published font.Checked
On
37e7c9903f, the FreeText regression passed on macOS in ordinary and layer mode. It failed onc3c02b694b, where the rejected call allocated object 5 and changed the inline font to a reference. All 1,412 unit tests passed. The ordinary annotation and form suites had 244 passes and one optional skip. The layer-mode runner reported only its documented redaction crash, and every writer count matched. The strict fork-tag and C API checks passed.The following checks were run on the preceding revision,
c3c02b694b.check-fork-tags.py --strict,check-c-api.py(604 functions),check-globals.pyon the macOS library./DRfont was inline, then filled (so this change makes the font an object after the signature): with an approval signature Acrobat says the signed revision is unaltered and lists "Form Fields Filled In"; with a certification at P=2 it says the changes are permitted by the certifying party, with the same list. The engine's signature analysis says permitted for both.Left
check-globals.pyon the Linux library: not run.CPDF_BAFontMap) copies an inline font into the appearances it writes the same way. The engine does not write through it.