[paint] Push COLRv1 root clip under font transform

Make the native COLRv1 paint paths report the root clip in font
units under the font transform. This matches the order used by
fontations and removes the need to pre-scale the HB-OT clip extents.

For the FreeType path, add a helper to convert FT_ClipBox values
back to font units before pushing them under the font transform, and
share that conversion with nested COLR glyph clip boxes.

Update paint and vector expectations for the new transform/clip stack.

Testing:
CCACHE_DISABLE=1 meson test -C build --print-errorlogs

Assisted-by: OpenAI Codex
This commit is contained in:
Behdad Esfahbod committed 2026-05-27 10:48:19 +02:00
1 parent 202202b349
commit 56ac9c925f
15 files changed
+94 -88

No files matched your search

@@ -1,6 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-16 -966 1307 1232" width="1307" height="1232">
<defs>
<clipPath id="c0"><rect x="64" y="-224" width="1152" height="1152"/></clipPath>
<clipPath id="c0"><rect x="1" y="-3.5" width="18" height="18"/></clipPath>
<path id="p0" d="M1200,270C1200,299 1177,322 1148,323C1125,324 1067,309 1034,325C954,363 621,538 621,538C592,554 520,577 484,568L218,462C192,456 171,440 158,420C148,409 138,332 123,262C108,192 90,146 90,146C76,93 118,57 156,51C193,44 242,67 256,121L287,268C292,292 312,311 337,314L430,311L397,143C397,143 564,-71 799,-121C885,-140 966,-86 1028,-82C1056,-80 1116,-86 1142,-94C1171,-102 1200,-81 1200,-52L1200,270Z"/>
<clipPath id="clip-p0"><use href="#p0"/></clipPath>
<radialGradient id="gr0" gradientUnits="userSpaceOnUse" cx="4.5" cy="7.72" r="5.59" fx="4.5" fy="7.72" fr="2.58" spreadMethod="pad">
@@ -34,8 +34,8 @@
</defs>
<rect x="-16" y="-966" width="1307" height="1232" fill="rgb(255,255,255)"/>
<g transform="scale(1,-1)">
<g clip-path="url(#c0)">
<g transform="matrix(64,0,0,64,0,0)">
<g clip-path="url(#c0)">
<g transform="matrix(0.015625,0,0,0.015625,0,0)">
<g clip-path="url(#clip-p0)">
<g transform="matrix(64,0,0,64,0,0)">

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

@@ -1,6 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-16 -966 1307 1232" width="1307" height="1232">
<defs>
<clipPath id="c0"><rect x="64" y="-224" width="1152" height="1152"/></clipPath>
<clipPath id="c0"><rect x="1" y="-3.5" width="18" height="18"/></clipPath>
<path id="p0" d="M1200,270L1200,270L1200,-52Q1200,-74 1182,-87Q1164,-100 1142,-94Q1129,-90 1107.5,-87Q1086,-84 1064,-82.5Q1042,-81 1028,-82Q997,-84 960.5,-97.5Q924,-111 883,-120.5Q842,-130 799,-121Q728,-106 667,-75Q606,-44 556,-7Q506,30 470.5,64.5Q435,99 416,121Q397,143 397,143L430,311L337,314Q318,311 304.5,298.5Q291,286 287,268L256,121Q245,81 214.5,63.5Q184,46 156,51Q137,54 119,66.5Q101,79 92,99Q83,119 90,146Q90,146 101,178Q112,210 123,262Q130,297 136.5,331Q143,365 148,389.5Q153,414 158,420Q180,453 218,462L484,568Q502,573 528.5,568Q555,563 580.5,554.5Q606,546 621,538Q621,538 645.5,525Q670,512 710,491Q750,470 797.5,445.5Q845,421 891.5,397Q938,373 976,353.5Q1014,334 1034,325Q1051,317 1073,317.5Q1095,318 1116,321Q1137,324 1148,323Q1170,322 1185,307Q1200,292 1200,270Z"/>
<clipPath id="clip-p0"><use href="#p0"/></clipPath>
<radialGradient id="gr0" gradientUnits="userSpaceOnUse" cx="4.5" cy="7.72" r="5.59" fx="4.5" fy="7.72" fr="2.58" spreadMethod="pad">
@@ -34,8 +34,8 @@
</defs>
<rect x="-16" y="-966" width="1307" height="1232" fill="rgb(255,255,255)"/>
<g transform="scale(1,-1)">
<g clip-path="url(#c0)">
<g transform="matrix(64,0,0,64,0,0)">
<g clip-path="url(#c0)">
<g transform="matrix(0.015625,0,0,0.015625,0,0)">
<g clip-path="url(#clip-p0)">
<g transform="matrix(64,0,0,64,0,0)">

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB