LibGfx+LibWeb: Use per-code-point font fallback for SVG text - #11228
LibGfx+LibWeb: Use per-code-point font fallback for SVG text#11228sideshowbarker wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (10)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughLibGfx replaces UTF-8 and UTF-16 text placement APIs with glyph-run placement APIs. The Skia backend transforms glyph outlines along paths using glyph positions, widths, and path tangents. SVG layout now shapes text with the complete font list for fallback support, uses glyph runs for measurement and rendering, and places them along paths. Layout expectations and SVG font-fallback tests were updated. Sequence Diagram(s)sequenceDiagram
participant SVGLayout
participant GfxShapeText
participant PathSkia
SVGLayout->>GfxShapeText: Shape text with the font list
GfxShapeText-->>SVGLayout: Return glyph runs
SVGLayout->>PathSkia: Place glyph runs along the path
PathSkia-->>SVGLayout: Return transformed glyph outlines
Suggested reviewers: Merge Risk: ⚪ Minimal · up to SVG text now selects fallback fonts per code point, preventing missing-glyph boxes for unsupported characters while preserving the existing rendering path. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Full details: Description checkExplanation The pull request description directly explains the SVG font-fallback defect, its cause, the glyph-run shaping fix, and the removal of unused path text APIs. These changes match the summarized changeset. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem: Characters a generic font doesn’t cover drew as missing-glyph boxes inside SVG text; e.g. U+1D11E with font-family:serif — while the same character renders correctly in ordinary HTML text, and naming a font that does cover it renders it correctly inside SVG as well. Cause: The SVG text path builder resolved one font for a whole run with first_available_font() — the first font in the list that covers the space character — and then handed the entire string to Skia to map through that font alone. So any code point outside it became glyph 0. Fix: Shape each run with Gfx::shape_text() against the box’s full font list — the same way HTML text and canvas text already did. Fixes LadybirdBrowser#11031
After SVG text path-building was reworked to build from shaped glyph runs, Path::text() and place_text_along() no longer have any callers.
2067bf1 to
e96c05e
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Problem: Characters a generic font doesn’t cover drew as missing-glyph boxes inside SVG text; e.g. U+1D11E with
font-family:serif— while the same character renders correctly in ordinary HTML text, and naming a font that does cover it renders it correctly inside SVG as well.Cause: The SVG text path builder resolved one font for a whole run with
first_available_font()— the first font in the list that covers the space character — and then handed the entire string to Skia to map through that font alone. So any code point outside it became glyph 0.Fix: Shape each run with
Gfx::shape_text()against the box’s full font list — the same way HTML text and canvas text already did. Fixes #11031.Note
This PR branch contains two commits: The first commit has the change described above, while the second commit is entirely just deletions of the
Path::text()andplace_text_along()code — which no longer has any callers, after the change to usingGfx::shape_text()against the box’s full font list.So, it might be easier to first review the first commit in isolation, and then review the deletions.