Repository navigation
Draw a signature field's box - #114
Merged
Merged
Conversation
A signature field's widget, and a widget in no field, now have a drawing: their background and border, as a text field draws them. Attaching a widget to a signature field bakes it, and EPDFAnnot_GenerateFormFieldAP redraws it. EPDFAnnot_GenerateFormFieldAP refuses an annotation that is not a widget.
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.
A signature field's widget had no drawing until a signature was drawn into it.
EPDFAnnot_GenerateFormFieldAPreturned false for/FT /Sigand for a widget in no field, and attaching a widget to a signature field baked nothing. The field's/MKcolours and/BSwere written but never drawn, so a viewer offered a background and a border that never showed. Acrobat's signature field properties have the same four settings (border colour, fill colour, line thickness, line style), and Acrobat draws the empty field with them.Now:
CPDF_AppearanceGenerator::GenerateBoxFormAPdraws a widget that shows only its box: its background (/MK /BG) and border (/MK /BC,/BS), as a text field draws them, as a new normal appearance stream. It makes a new stream, as a check box's generator does, because the old/Nmay be another widget's too, or a drawing someone placed in this one.WriteFieldBox, which both use. The text field's output is unchanged.EPDFAnnot_GenerateFormFieldAPdraws the box for a/Sigwidget and for a widget in no field. It replaces whatever the widget shows, a signature's mark included. Keeping a mark is the caller's decision: the engine never calls it on a widget with a mark in it.EPDFForm_AttachWidgetbakes the box for a signature field (family 7), as it bakes every other family.EPDFAnnot_GenerateFormFieldAPrefuses an annotation that isn't a widget. A non-widget has no/FT, so with the no-field branch it would otherwise get a box.RegenerateFieldAppearancesand the repair bake still skip signature fields.The engine side is embedpdf/embed-pdf-viewer#982: it decides when to draw, and locks a field's style once a mark is in it. Pin this there after release.
Tests
New embedder tests, recorded as layer-mode writers:
AttachToSignatureFieldDrawsItsBox(7 objects): the box in the field's/MKcolours.SignatureFieldBoxRedrawsInItsNewStyle(8): an empty box, then the new background after a restyle.WidgetInNoFieldDrawsItsBox(3).GenerateFormFieldAPRefusesAnotherSubtype(2): a square gets no appearance.In layer mode the four pass, with no unknown writers.
On macOS:
eeac787c0: progressive render, text render,RenderHelloWorldWithFlagsandCaptionAppearanceGolden.RenderFormsWithPauseis off by the same 19 pixels in both.Linux CI hasn't run yet.