ContentStreamBuilder
Builds a page content stream (ISO 32000-1 §8–§9) from typed drawing operations, emitting the raw operator bytes. Each PDF operator takes its operands first, then the operator keyword: r g b rg, x y m, (str) Tj.
Coordinates are in the default user space (origin bottom-left, points). Numbers are formatted without scientific notation (via PdfObjectWriter); names and strings are escaped the same way the serializer escapes them.
Fonts and images are referenced through fontResolver / imageResolver, which map a StandardFont / PdfImage to the resource name the owning PdfBuilder will register in /Resources.
Functions
Intersect the clipping path with the current path using the nonzero winding rule (W). Per the spec, a path-painting operator must follow. Call endPath to clip without also painting the path, e.g. rectangle(...); clip(); endPath().
Like clip, but with the even-odd rule (W*).
Escape hatch: append literal content-stream source, followed by a newline. A Tf, q or Q in it is outside what the builder tracks, so showText keeps encoding for the font it set.
Q, back to the font that the matching save saw; with no matching save, the font stays.
Select an embedded custom font at size. Subsequent showText calls encode their text as Identity-H 2-byte glyph codes for this font, one glyph per character through the font's cmap, in the order of the string. The builder does not shape text: no GSUB substitution, no mark positioning and no bidi reordering, so Arabic letters do not join, marks of Devanagari or Thai do not move into place, and right-to-left text runs left to right. Scripts without those needs, CJK among them, render as written (#750). The font is registered with the owning PdfBuilder on first use.
Tj in the current font: WinAnsi bytes for a standard font, one glyph a character for an embedded one, unshaped (see setFont).