Native FreeText default appearances

Native FreeText fallback applies the bounded default-appearance state to generated text, layout, automatic fitting and decorations

A supplied normal appearance takes precedence over generation from the FreeText default appearance and rich text

Default-appearance operators

OperatorsFallback behavior
TfSelects the original font resource and text size; size zero requests bounded automatic fitting
g rg kInitializes text fill color in gray, RGB or CMYK
Tc Tw TzApplies character spacing, word spacing and horizontal text scale to painting and layout measurements
Ts TLApplies text rise and explicit baseline separation, including zero or negative leading
TmAccepts at most one matrix; its linear part transforms generated text, while annotation layout determines placement
TrSelects glyph paint and text clipping modes from zero through seven
G RG K w J j M dInitializes stroke color, width, cap, join, miter and dash state for text and generated decorations

The matrix translation operands are validated but do not replace FreeText placement within its annotation rectangle

Horizontal scale may be zero or negative; rise, spacing and the linear matrix participate in transformed glyph, advance and decoration geometry

This is a bounded default-appearance profile, not a general PDF content-stream interpreter; unsupported operators, invalid operand counts, malformed values and repeated text matrices produce a rendering error

Stroke color components must be in the range zero through one, cap and join values must be integers from zero through two, width must be nonnegative and the miter limit must be at least one

A dash array may contain at most 256 nonnegative finite values and a nonempty array must contain a positive value; an empty array selects solid strokes, an odd array repeats and phase must be nonnegative

Layout, wrapping and placement

FreeText alignment uses visible advances for left, center or right placement; encoded trailing spaces and their source mappings remain present when the generated stream retains those fragments

Word-boundary wrapping and hard paragraph breaks have separate handling; a nonbreaking space does not become an ordinary ASCII soft separator

The original raw-font path retains its bounded space and hyphen wrapping rules; this acceptance set does not establish every Unicode line-breaking, bidirectional or complex-shaping case

The physical annotation rectangle, root Form bounds and inner clip remain fixed; temporary child Form bounds account for the complete ancestor and placement chain

Glyph painting and text clipping

TrGlyph paintClip contribution
0FillNone
1StrokeNone
2Fill and strokeNone
3No glyph paintNone
4FillGlyph outlines
5StrokeGlyph outlines
6Fill and strokeGlyph outlines
7No glyph paintGlyph outlines

Modes four through seven accumulate glyph outlines across generated runs in one text object; the accumulated text clip applies after that text object to subsequent generated underline and strikeout decorations

The clip uses glyph outlines rather than the expanded stroke silhouette; painting state remains specific to each run and the enclosing graphics-state scope limits the clip lifetime

Initial DA stroke state is applied in the root decoration scope as well as text scopes; per-run overrides and graphics-state save and restore retain their meaning

The four positive clipping cases are a separate acceptance gate with handwritten two-run appearances, positive clipped decorations and white samples outside the glyph union

That gate also uses an explicit-appearance rectangle-fill witness to test backend text clipping; the witness does not claim that missing-appearance generation emits the rectangle fill

Independent positive Tr4 through Tr7 reader validation passed the four finite two-run cases with official MuPDF 1.28.5 and Poppler, including both glyph interiors, clipped decorations and white samples outside the glyph union

The separate clip-only test revision uses Scale4 to select complete pixel cells from unchanged page-space witness points; it retains the original color thresholds and leaves normal45 rendering at Scale1

MuPDF 1.28.2 has a clipping-bounds compatibility issue when a color change flushes one run before a later run in the same text object; the earlier run can be excluded from the accumulated clip bounds

The official MuPDF 1.28.5 CLI and the independently pinned Poppler accepted these unchanged appearances; reader versions and finite positive controls remain distinct from a guarantee for every rendering pipeline

Automatic fitting

A zero DA font size starts a bounded shrinking and refinement search from the initial generated layout, using transformed glyph paths, advances and decorations rather than only an untransformed line height

Stroke expansion includes the conservative transformed support of dashed square-cap corners and miter joins

The search retains the established Cairo and FreeType path quantization; it does not promise the mathematically largest ideal-font size or identical hinting across readers

If no trial fits before the bounded search reaches its minimum trial, the physical clip still bounds publication; very long content is not guaranteed to remain fully visible

Original fonts and resource limits

Original embedded Type1C, CIDFontType0C and bare Type1 fallback is already supported; complete OpenType CFF and CFF2 default-instance appearance paths retain their documented mapping and embedding rules

Standalone raw CFF2 streams and selection of nondefault variation coordinates remain outside the released CFF2 path

Token, object, working-memory, operation, decoded-data and output limits apply to parsing, temporary resources, fitting and publication; cancellation is polled during bounded work

Failure preserves the source graph and allows same-document recovery; reaching a limit does not turn a partially generated appearance into a successful result

Reproducible acceptance and remaining boundaries

The public suite is Tests/Linux/AnnotationDefaultAppearance/RunAnnotationDefaultAppearance.py, distributed with its assets and a complete archive manifest

Its normal mode runs 45 candidate/handwritten-AP pairs at maximum channel difference two, seven original limit groups and independent original-AP continuous geometry at epsilon 1e-6

Positive original-AP reader renders and known vertical pixel-cell observations are recorded separately from continuous geometry; neither pair equality nor those finite observations prove arbitrary generated-candidate geometry or arbitrary transformed raster envelopes

The finite-AP mode checks six retained explicit-appearance affine and dash controls; it does not replace normal acceptance, generated-candidate checks or limit tests

The retained 45 generated appearances passed independent continuous geometry at epsilon 1e-6; their 90 pinned MuPDF and Poppler reader images also passed an independent full-image model across all 3,168,000 pixel cells with maximum channel difference zero, no skipped images and no excluded cells

That finite model derives expected glyphs, transforms, clipping, strokes and composition from the original handwritten appearances and font outlines, using each reader's pinned FreeType kernel; it does not learn expected pixels from the observed images

The original maximum channel difference remains two and the ink threshold remains 245; these passes cover the retained corpus and pinned pipelines, not arbitrary fonts, all renderer builds or a proof of the mathematically largest fitted size

Linux and Windows FPC targets require FPC 3.3.1 or later; Windows FPC uses a separately verified private NoGUI dependency build and no desktop-reader launch

Related topics: annotation fallback, annotation decorations, rich-text run spacing, original raw-font appearances and OpenType CFF2 default-instance appearances