Safe SVG Color Glyph Rendering
DrawRegisteredColorGlyph translates a restricted OpenType SVG glyph document into a bounded reusable PDF Form XObject without starting a browser, script engine, or external SVG runtime
Native profile
The profile accepts svg and g containers plus path, rect, circle, ellipse, line, polyline, and polygon geometry
Path data supports absolute and relative move, line, horizontal, vertical, cubic, smooth cubic, quadratic, smooth quadratic, elliptical arc, and close commands, with quadratic and arc segments converted to bounded cubic PDF curves
Solid colors and bounded vector gradients can be inherited through groups together with fill rules, solid or gradient stroke styles, opacity, clip paths, Alpha or Luminosity soft masks, visibility, transforms, and local #id reuse
PNG and JPEG image nodes are accepted only as bounded Base64 data payloads and are registered as Image XObjects, with PNG alpha retained in a soft mask
Plain UTF-8 and gzip-compressed SVG table documents use the same bounded path
Safety and fallback
The parser caps compressed input at 8 MiB, expanded input at 32 MiB, generated PDF operators at 16 MiB, elements at 4,096, nesting at 64, and path values at 100,000
Document types, scripts, event attributes, external resources, unsupported data media types, @import, external url() references, external use targets, and unsupported elements fail closed before registration
Gradient expansion, local reuse, masking, nesting, and generated operators remain subject to the same parser budgets; masks use bounded transparency groups, reject recursive references, and allow at most eight active mask references
Images are limited to 128 nodes, 16,384 pixels per dimension, and 16,777,216 pixels in total; see the SVG Form XObject Import profile for the complete resource and text boundaries
When native validation returns no safe result, OnColorGlyphRasterize receives the original SVG asset and remains responsible for any broader SVG feature set required by the application
Placement
The SVG viewport is mapped with a uniform aspect-preserving scale into the requested font-size square, converts SVG downward Y coordinates to PDF upward Y coordinates, and anchors the Form XObject at the glyph baseline