mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 05:51:05 +01:00
Wire the paint-callback pipeline for COLRv0 color glyphs. Adds: * push_clip_glyph / pop_clip / color / custom_palette_color callbacks. Each COLRv0 layer's push_clip_glyph is captured, then the following color callback rasterizes the clip-glyph outline through a scratch hb_gpu_draw_t, appends the resulting Slug sub-blob, and emits a LAYER_SOLID op carrying the palette_index (preserved via custom_palette_color) plus the is_foreground flag. pop_clip clears the pending state. * hb_gpu_paint_get_funcs(): cached singleton hb_paint_funcs_t via the standard hb_paint_funcs_lazy_loader_t. * hb_gpu_paint_glyph(): stashes the font scale and invokes hb_font_paint_glyph_or_fail() with our funcs and a sentinel foreground (the encoder never stores foreground -- the shader resolves it per quad from a caller-supplied attribute). * hb_gpu_paint_encode(): concatenates the 3-texel header, the op stream, and the collected sub-blobs into one RGBA16I blob, patching each op's sub_blob-index into an absolute texel offset. Returns NULL when no layers accumulated or an unsupported (v1) feature was seen. * hb_gpu_paint_clear(): discards ops, sub-blobs, and pending state while preserving the font scale. The gradient / group / transform callbacks are not wired yet, so COLRv1 paint graphs silently fall through -- callers should precheck with hb_ot_color_glyph_has_paint() and route v1 glyphs elsewhere (or fall back to draw). Enables HB_NO_COLOR and HB_NO_PAINT in the web demo config override so the wasm link resolves the new paint pipeline symbols. Measured on a local Emscripten build: raw wasm: 412722 -> 437752 (+25030 B, +6.1%) gzip wasm: 170342 -> 179165 ( +8823 B, +5.2%) Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>