Expand description
Appearance-stream generation: turning an annotation’s dictionary into the content stream a viewer draws.
§The overlay
Generating an appearance is conventionally a mutation of the
document. A sticky note’s /Rect is replaced with a 20×20 box; an ink
annotation’s is inflated; every annotation touched gains an /AP /N
pointing at a new stream and a marker key saying so. Everything that reads
the file afterwards sees the mutated state, which is why a dump reports
20×20 rectangles for sticky notes whose files say otherwise.
Parsed objects here are values and the parser’s store is immutable, so
generate_appearances returns an AnnotOverlay instead: one entry per
/Annots index recording the stream it produced and the dictionary edits
it implies. Readers consult the overlay before the dictionary.
§Which annotations get one
Thirteen subtypes have a generator, and a widget annotation with no /AP
dictionary gets its chrome from widget besides — plus, when the caller
has fonts to set text with, the field body field_body lays out.
Generation is refused
outright when the
annotation is hidden, or when /AP /N already reads as a dictionary —
and a stream answers as its own dictionary, so the ordinary “it
already has an appearance” case is covered by the same test. Only a
missing /AP, a missing /N, or a scalar /N leaves the door open.
Modules§
- field_
body - The text a form field’s appearance shows: a text field’s value, a combo box’s current label, a list box’s option rows.
- font_
map - The second face a field reaches for when its own cannot write a character.
- freetext
- The free-text annotation generator: the one per-subtype generator that sets actual text.
- widget
- Widget appearances: the chrome a form control gets when its dictionary carries none.
Structs§
- Annot
Overlay - Per-annotation generated appearances, keyed by
/Annotsindex. - Focus
- Which annotation on the page holds the keyboard focus, and what its focus rectangle is.
- Form
Fonts - The faces a form’s default resources name, loaded once for a page.
- Generated
Ap - One generated appearance and the dictionary edits it implies.
- Substitute
- One second face: the resource name it is filed under, the dictionary the
appearance’s
/Resources /Fontcarries, and the loaded face itself. - Text
Font - The font a text-bearing generator sets its text with.
Enums§
- Appearance
- What an overlay says about one annotation.
- Border
Style - How a border is drawn.
- Focus
Box - The shape a focused widget’s focus rectangle takes.
Functions§
- generate_
appearances - Generates appearances for every annotation on a page that wants one.
- generate_
appearances_ with_ text - The same walk, with the text-bearing generators enabled.
- stream_
dict - The stream dictionary a generated appearance is stored under.