mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 05:51:05 +01:00
The six public draw / paint funcs getters across raster, vector, and gpu used to be singletons: hb_raster_draw_get_funcs (void) hb_raster_paint_get_funcs (void) hb_vector_draw_get_funcs (void) hb_vector_paint_get_funcs (void) hb_gpu_draw_get_funcs (void) hb_gpu_paint_get_funcs (void) That works fine for raster and gpu, where there's a single backend per type, but breaks for the vector backend where SVG and PDF have separate funcs sets — callers using the public getter always got SVG funcs and silently produced SVG markup inside PDF output streams when invoking the new arbitrary-path clip API on a PDF context. Make all six take a const-pointer to the relevant context instance. vector_paint dispatches on paint->format; the other five just use the instance for symmetry today (room for future format-style dispatch later). Also expose hb_vector_draw_get_format / hb_vector_paint_ get_format public getters so callers (or third parties) can ask a vector context for its format without poking at internals. Also: hb_vector_paint_push_clip_path_end now wraps the emitted SVG clipPath's path in transform="scale(1,-1)" so free-form arbitrary clips at base body level land in the same coord system the per-glyph <use scale(_,-sy)> wrappers establish. Without this, free-form clip-path arbitrary outlines emitted between paint_glyph calls came out mirrored across the X axis. Updates internal callers (hb_vector_paint_glyph, hb_pdf_emit_glyph_path, hb_raster_paint_push_clip_path_ start, hb_gpu_paint_push_clip_path_start, the GPU pen adapter), util sites (raster-output.hh, vector-output.hh, gpu/demo-font.cc), API tests (test-raster.cc, test-gpu.cc), and the docs section index. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>