Optionaloptions: { space: number }Optionalrule: "nonzero" | "evenodd"OptionalfillColor: stringOptionalstrokeColor: stringOptionalsize: numberOptionaloptions: ContextImageOptionsOptionaloptions: ContextFontRegistrationOptionsOptionaloriginX: numberOptionaloriginY: numberEmit pre-shaped glyphs directly to the PDF stream using their fontkit glyph IDs. This bypasses PDFKit's text()/encode() path, which would re-run shaping and lose the contextual glyph substitutions (init/medi/fina/liga) computed at layout time. Required for correct rendering of Arabic and other RTL/CTL scripts.
Optionaloptions: ContextTextOptions
A lightweight PDF rendering context backed by jsPDF.
Architecture notes
• jsPDF does not stream output — the complete PDF is generated at end(). pipe() stores the VmprintOutputStream reference; end() writes the full ArrayBuffer to it in one shot.
• jsPDF always opens the first page automatically. The renderer calls addPage() for every page including the first, so the first call is a no-op here.
• Standard-font handling mirrors the PDFKit context exactly: when registerFont() receives a standardFontPostScriptName, the font id is mapped to the corresponding jsPDF built-in name and no binary data is registered. Custom fonts are base64-encoded and registered via addFileToVFS / addFont.
• Transforms (translate, rotate) and graphics state (save, restore, opacity) are delegated to jsPDF's setCurrentTransformationMatrix / saveGraphicsState / restoreGraphicsState / setGState. jsPDF sets up an initial page CTM that flips the y-axis so that all subsequent cm operators (and these helpers) operate in the same y-down user space that the PDFKit context exposes.
• Path building (moveTo / lineTo / bezierCurveTo / rect / roundedRect) uses jsPDF's public path API. fill() / stroke() / fillAndStroke() close the path and paint it. The rounded-rect approximation uses cubic Bézier curves at k ≈ 0.5523 (the standard quarter-circle approximation).