Improve SVG text layout and enable Chrome-backed baselines#484
Improve SVG text layout and enable Chrome-backed baselines#484wieslawsoltes merged 7 commits intomasterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b58feb0b9a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89af0a7cff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a12fbe6c6a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PR Summary: SVG text support and Chrome-backed text baselines
Branch
codex/svg-text-supportCommit stack
d3cdffa6dImprove SVG text layout and font fallbacke38af65baAdd text rendering regression coveragec85f91df3Enable W3C text fixtures with Chrome baselinesb58feb0b9Enable resvg text fixtures with Chrome baselinesHigh-level summary
This branch focuses on text rendering parity, especially fonts, fallback, bidi, whitespace handling,
tspan,tref,textPath,textLength, rotation, and Chrome-backed text test coverage.The implementation keeps Chrome as the source of truth for newly enabled W3C and resvg text rows. Where browser/runtime behavior is still not implemented, rows stay skipped with explicit reasons instead of being forced through with fake baselines.
What changed
1. Core text layout and font handling
SvgSceneTextCompilerto support substantially more browser-like text layout behavior across:tspanandtrefsequencingtextPathplacement and handoff behaviortextLength/lengthAdjusthandling in more casesmissing-glyphdoes not suppress usable platform/system fallback.Svg.Customfor text-related compatibility cases needed by the new coverage.Primary files:
src/Svg.SceneGraph/SvgSceneTextCompiler.cssrc/Svg.SceneGraph/SvgFontTextRenderer.cssrc/Svg.Skia/SkiaModel.TextShaping.cssrc/Svg.Skia/SkiaSvgAssetLoader.cssrc/Svg.Model/ISvgAssetLoader.cssrc/Svg.Model/Services/PaintingService.cssrc/Svg.Custom/Compatibility/SvgDocumentCompatibilityLoader.cs2. Regression coverage
missing-glyphtspanrotation alignmenttspanspace preservationtextPatharc and percentage offset behaviorPrimary files:
tests/Svg.Skia.UnitTests/SvgRetainedSceneGraphTests.cstests/Svg.Skia.UnitTests/Issue405Tests.cstests/Svg.Skia.UnitTests/SKSvgSettingsTests.cs3. W3C text coverage
tests/Svg.Skia.UnitTests/ChromeReference/W3C/.Examples of enabled/validated areas:
trefandtspanPrimary files:
tests/Svg.Skia.UnitTests/W3CTestSuiteTests.cstests/Svg.Skia.UnitTests/ChromeReference/W3C/*4. resvg text coverage
tests/Svg.Skia.UnitTests/ChromeReference/resvg/.scripts/capture_resvg_chrome_overrides.mjsfor repeatable Chrome capture of resvg text fixtures.plan/skipped-tests-implementation-roadmap.mddocumenting the remaining skipped buckets and the implementation order for deeper work that is still open.Examples of enabled/validated areas:
letter-spacingword-spacingtext-decorationtextLengthtexttextPathtreftspanPrimary files:
tests/Svg.Skia.UnitTests/resvgTests.cstests/Svg.Skia.UnitTests/ChromeReference/resvg/*scripts/capture_resvg_chrome_overrides.mjsplan/skipped-tests-implementation-roadmap.mdValidation run
Executed successfully:
dotnet format Svg.Skia.slnx --no-restoredotnet build Svg.Skia.slnx -c Release --no-restoredotnet test Svg.Skia.slnx -c Release --no-restoreSelected results from the full test pass:
Svg.Skia.UnitTests: Passed1537, Skipped616, Total2153ShimSkiaSharp.UnitTests: Passed128Svg.Model.UnitTests: Passed64Svg.Editor.Svg.UnitTests: Passed4Svg.Editor.Skia.UnitTests: Passed10Svg.Controls.Skia.Uno.UnitTests: Passed17Svg.Controls.Skia.Avalonia.UnitTests: Passed21Svg.Controls.Avalonia.UnitTests: Passed10Svg.Editor.Skia.Avalonia.UnitTests: Passed18Known warnings / non-blocking notes
NU1903forsamples/UnoTestApponTmds.DBus.Protocolexternals/SVGwas already dirty before this work and was intentionally left untouched.Remaining intentionally skipped areas
The biggest remaining skipped buckets are documented in
plan/skipped-tests-implementation-roadmap.md. The main unresolved categories are:Review guidance
Suggested review order:
SvgSceneTextCompiler,SvgFontTextRenderer, and Skia loader/shaping codeSvgRetainedSceneGraphTests,Issue405Tests, andSKSvgSettingsTests