Skip to content

Separate glyph/paint transforms; SVG caching & tests#524

Merged
JimBobSquarePants merged 5 commits intomainfrom
colrv1-fixes
Apr 9, 2026
Merged

Separate glyph/paint transforms; SVG caching & tests#524
JimBobSquarePants merged 5 commits intomainfrom
colrv1-fixes

Conversation

@JimBobSquarePants
Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

This pull request refactors how affine transforms are handled when flattening COLR v1 paint graphs, introducing a distinction between transforms applied to glyph geometry and those applied to paint nodes. It also updates the ResolvedGlyphLayer structure to store both transform types, and makes related adjustments in the rendering pipeline. Additionally, it improves caching and default paint handling in the SVG glyph source.

COLR v1 Paint Graph Flattening and Transform Handling

  • Refactored the FlattenPaintToLayers method to maintain two separate affine transforms: glyphTransform (applied to glyph geometry) and paintTransform (applied to the leaf paint node), instead of a single accumulated transform. The method now takes both transforms as parameters and updates them appropriately depending on the paint node type. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Updated the ResolvedGlyphLayer structure to store both GlyphTransform and PaintTransform, and adjusted its constructor and documentation accordingly. [1] [2] [3]
  • Modified the rendering pipeline to use GlyphTransform for geometry transformation when constructing PaintedLayer instances, ensuring that solid paints are transformed correctly.

SVG Glyph Source Improvements

  • Changed the SVG glyph document cache to use a key based on document span ((int Start, int Length)) for improved cache accuracy and concurrency, and replaced the dictionary type with ConcurrentDictionary. [1] [2]
  • Introduced a default black fill paint (DefaultBlackFillPaint) to be used as the inherited paint when walking SVG elements, ensuring consistent fallback rendering. [1] [2]

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 43.84236% with 114 lines in your changes missing coverage. Please review.
✅ Project coverage is 82%. Comparing base (4ca2629) to head (9d5e995).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...xLabors.Fonts/Tables/General/Svg/SvgGlyphSource.cs 39% 56 Missing and 17 partials ⚠️
...c/SixLabors.Fonts/Tables/General/Colr/ColrTable.cs 34% 39 Missing and 1 partial ⚠️
src/SixLabors.Fonts/StreamFontMetrics.Cff.cs 0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #524   +/-   ##
=====================================
- Coverage     82%     82%   -1%     
=====================================
  Files        305     305           
  Lines      21540   21618   +78     
  Branches    3167    3196   +29     
=====================================
+ Hits       17822   17875   +53     
- Misses      2903    2932   +29     
+ Partials     815     811    -4     
Flag Coverage Δ
unittests 82% <43%> (-1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JimBobSquarePants JimBobSquarePants merged commit 6df7590 into main Apr 9, 2026
8 of 9 checks passed
@JimBobSquarePants JimBobSquarePants deleted the colrv1-fixes branch April 9, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant