Native stroke adjustment

The native Cairo renderer applies the Boolean ExtGState entry /SA to path and glyph strokes through the existing HPDFRenderHeadlessPagePNG and HPDFRenderHeadlessPagePNGFile APIs

Set /SA true in the PDF graphics state to request device-space stroke adjustment; /SA false retains the ordinary stroke route, and q and Q save and restore the selection

/Resources << /ExtGState << /Adjusted << /SA true >> >> >>
q /Adjusted gs 0.6 w 12.25 20.25 m 72.25 20.25 l S Q

Geometry and device policy

Adjustment uses the current transformation at stroke time, including page rotation, crop, UserUnit, render scale and content transforms, so paths constructed under an earlier transformation retain their geometry

The adjusted pen rounds principal device widths of at least half a pixel to the nearest integer, choosing the larger integer at a tie, and supplies a minimum one-pixel body width for thinner strokes and hairlines

Horizontal and vertical segments align their shared vertices to the device pixel lattice; group surface offsets retain the absolute page lattice, and arbitrary curve vertices are not individually snapped

Rotations, reflections, shear and nonuniform scales retain stroke direction and affine endpoint planes for ordinary butt caps; thin strokes use the device hairline policy when the transformed pen cannot provide a stable ordinary endpoint construction

Curve decomposition uses a device tolerance of 1/128 pixel and retains actual path corners for join selection; curve approximation, dash boundaries and cap or join tessellation contribute to the existing operation budget

Curves, dashes, caps and joins

Cubic paths, open and closed contours, butt, round and projecting square caps, and miter, round and bevel joins share one adjusted outline planner

Dash lengths and phase are evaluated in stroke-time user space before applying the device transform; odd arrays repeat, negative phase is normalized, each subpath restarts the pattern, and painted runs crossing a closed contour's seam remain connected

Zero painted intervals produce the selected round or square dots; zero off intervals and repeated zero intervals use bounded transitions, while a zero-length butt stroke has no painted area

The renderer fills the union of body, cap and join contours once so overlaps do not repeatedly apply transparency; miter joins retain the selected miter limit and use bevel geometry beyond that threshold

Painting, clipping and nested consumers

Combined B, B*, b and b* operations fill the original path and stroke the adjusted outline; pending W or W* clipping and text clipping retain the original contours

Forms, annotation appearances, colored and uncolored patterns, Type3 glyph procedures and outline font text use the same saved graphics-state route; text rendering modes that stroke glyphs apply adjustment without replacing the original glyph clipping outline

Pattern coordinates remain anchored to their original graphics state when the adjusted outline is painted in device coordinates

Soft masks, object alpha, blend modes, isolated and nonisolated groups, knockout and complementary CMYK or shape passes retain their existing compositing contracts; color and knockout painting reuse the same adjusted plan for a stroked path

Resource and output contracts

MaxWorkingBytes admits retained managed plan arrays and a conservative path snapshot charge before their use; checked sizes and point limits bound the decoded path and generated outline

MaxOperations charges path decoding, curve subdivision, dash transitions, pen construction and outline emission, with cooperative cancellation polling during that work

These limits cover logical managed buffers and CPU image surfaces; they do not impose a per-allocation limit on Cairo path copies, native tessellation, Fontconfig or FreeType caches, or total process RSS

Rendering failure and cancellation release owned plans and temporary paths; file rendering retains its staging and atomic replacement contract, preserving an existing destination until successful publication

See Native Linux Cairo renderer for fonts, native deployment and the complete output ownership contract