mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 14:01:10 +01:00
New public API for namespacing SVG output: callers that embed
multiple hb-vector-produced SVGs into the same document can
set a distinct id prefix per context, so hb-vector's short
internal IDs (p<N>, c<N>, clip-g<N>, gr<N>, cg<N>) don't
collide across snippets.
Example collision the new API prevents: page embeds two
hb-vector SVGs produced by different contexts. Both use
id="clip-g10"; the browser's url(#clip-g10) resolves to
whichever element appears first, so paint layers in the
second SVG get clipped against the first SVG's glyph outline
-- visible as giant unclipped color rects bleeding across
the wrong glyph shape.
With the new API the second caller passes e.g. "b-" as its
prefix; the clash disappears. Empty/NULL prefix preserves
the existing output byte-for-byte.
Affects every id / url(#...) / href="#..." emission in SVG
output:
- hb-vector-draw: <path id="p..."> + <use href="#p...">
- hb-vector-paint: <path>, <clipPath>, <linearGradient>,
<radialGradient>, <g id="cg..."> color-glyph cache, and
every corresponding url(#...) / href="#..." ref.
PDF output is unaffected (no ids).
Docs/harfbuzz-sections.txt updated; check-symbols passes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>