mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 22:11:04 +01:00
Add a raster-style configuration surface to hb_gpu_paint_t: hb_gpu_paint_set_foreground / hb_gpu_paint_get_foreground hb_gpu_paint_set_palette / hb_gpu_paint_get_palette hb_gpu_paint_clear_custom_palette_colors hb_gpu_paint_set_custom_palette_color hb_gpu_paint_glyph now passes paint->palette and paint->foreground through to hb_font_paint_glyph, and the custom-palette-color callback consults the user's overrides map (same pattern as hb_raster_paint_t) before letting harfbuzz fall back to the font's own palette. With that in place, the color() callback can bake the already- resolved RGBA into the encoded op directly, quantized as signed Q15 in the existing second texel, instead of recording a palette index and trusting the shader to look it up. The is_foreground flag stays in the op so a runtime foreground-color change (e.g. dark-mode toggle) still works without re-encoding. Shader side: drop the hb_gpu_palette uniform/storage binding and its HB_GPU_PALETTE_SIZE knob from all four paint-fragment shaders (GLSL / MSL / WGSL / HLSL); read the per-layer color straight out of the blob texel. This removes a per-backend binding slot and the 256-entry uniform-array size ceiling that blocked fonts like Noto-COLRv1 (~6200 entries). Trade-off: changing the palette selection or overrides invalidates previously encoded blobs and requires re-encoding. In practice palette switches are rare, and the rendering hot path gets simpler. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>