Type3 Exact Editing

Fonts, Unicode, content editing

Description

SearchAndReplaceTextInContent and its Ex form rewrite Type3 text when Unicode text can be tied to exact encoded source bytes, using verified ToUnicode or Differences mappings, checked FontMatrix, Widths and CharProcs metrics, and horizontal-only advance compensation. Read it when a Type3 replacement is rejected, or when rotated and sheared glyph matrices must still leave following text anchored.

Verified source correspondence

SearchAndReplaceTextInContent and SearchAndReplaceTextInContentEx support Type3 fonts when Unicode text can be tied to exact encoded source bytes and the used glyph advances can be verified

Unicode mappings come from a verified ToUnicode CMap or a complete Differences encoding containing known glyph names. Known ligature and supplementary glyph names retain their complete Unicode sequences; private glyph names need explicit Unicode mappings

A complete glyph cluster can be replaced or deleted. Replacing only part of a ligature rejects the request, and font-encoded FE FF bytes remain character codes rather than Unicode text-string markers

Width and glyph checks

Glyph procedures are parsed for these checks without executing their drawing operators. Glyph painting and conformance follow the renderer and validation coverage for the operators used in each procedure

Text-space advance

ISO 32000-2 section 9.6.4, Table 110 requires only the horizontal component of a transformed Type3 width to contribute to character displacement, including when FontMatrix rotates the glyph

dx = (wx * FontMatrix[0] * FontSize + Tc + TwIfCode32) * Tz / 100
dy = 0

Rotation, shear, nonuniform scale, negative scale, translation, and a zero horizontal matrix component can therefore retain exact horizontal text positions. Text rise and the FontMatrix translation affect the glyph origin without adding character advance

A replacement font is temporary for replacement runs, and the original font is restored for untouched suffixes. Following text retains its original anchor through TJ compensation

Ownership and limits

Selected page streams and Form invocation chains are copied. The shared Type3 font and its character procedures keep their original content

Used glyph programs retain extraction-independent source snapshots. Font geometry, encoding, glyph references, and complete used program bytes are rechecked after staging and before any selected page is committed

Glyph programs are limited to 64 MiB per stream and share the 512 MiB transaction source-planning budget with page and Form sources. A shared procedure is captured once per verified font, and the Differences reader accepts up to 4096 entries

These limits cover retained planning data; ordinary document loading, font analysis, rendering, and parsed instruction structures have their own allocations

Rendering behavior

Native Type3 rendering hides glyphs in text modes 3 and 7, uses the glyph descriptions in the other modes, and adds no Type3 outlines to the text clipping path

Recursive glyph rendering has a 64-level limit. Native stream output retains the renderer error and returns failure before bitmap encoding when that limit is reached

Diagnostics

Unknown mappings, missing glyph procedures, inconsistent widths, nonzero wy, invalid metric operators, excessive source data, or changed source snapshots reject the transaction with a concrete message from GetLastUnicodeReplacementDiagnostics

Rejected Type3 planning reports LastErrorCode 537 and leaves selected page content uncommitted. Invalid queries and earlier search-capture limits retain their existing error handling