Repository navigation
Description
Current behavior 🐛
Since the drawing backend abstraction (#24153, merged 2026-09-23 as de4824d) landed on master, text on the Skia renderer looks visibly different in SamplesApp. Measured against WinUI (DirectWrite) and Chrome, the new rendering is:
- Heavier. Its stroke weight is actually closer to WinUI/Chrome. The old path was too light.
- Blurrier at small sizes. At 100% scale and 11–12px, horizontal stems smear across pixel rows, where WinUI snaps them.
- 6–40× slower to draw. See the numbers below.
What changed
Before #24153, ParsedText.DrawText built an SKTextBlob and drew it with sk_canvas_draw_text_blob. That goes through Skia's text pipeline: glyph masks from the platform scaler, cached in the glyph atlas.
After #24153, glyphs are drawn as filled vector paths:
GlyphRunRenderer.Draw(src/Uno.UI/UI/Xaml/Documents/GlyphRunRenderer.cs) callsIFont.BuildGlyphRunand thenIDrawingSession.DrawPaths.SkiaFont.GetGlyphOutline(src/Uno.UI.Composition.Skia/Composition/Uno/Drawing/SkiaFont.cs) callsSKFont.GetGlyphPathand caches the outline asIGeometry.SkiaDrawingSession.DrawPathsmerges the run's outlines into a newSKPath(SKPathBuilder.AddPathper glyph) on every draw and fills it withSKCanvas.DrawPath.
These path fills never go through Skia's text pipeline. As a result:
- There's no glyph atlas: every glyph is rasterized as a path on every frame.
- The platform scaler's grid-fitting (hinting) is skipped, which causes the small-size blur.
SkiaFontProviderstill setsEdging = SubpixelAntialias/Subpixel = trueon the font, but those flags are now ignored.
Performance
Setup: SkiaSharp 4.151.1, Windows 11, RTX 4090. The benchmark replicates the exact call sequences from before and after the change. The page is 60 lines × 67 glyphs of Segoe UI. Text is recorded into an SKPicture and then played back, as the compositor does. Numbers are median ms per frame.
| Case | Record: before → after | GPU (GL) playback: before → after | CPU raster playback: before → after |
|---|---|---|---|
| 14px @1x | 0.033 → 0.523 (16×) | 0.106 → 1.022 (9.6×) | 0.49 → 12.2 (25×) |
| 14px @1.5x | 0.037 → 0.361 (9.8×) | 0.209 → 1.586 (7.6×) | 0.70 → 18.0 (26×) |
| 12px @1x | 0.025 → 0.381 (15×) | 0.277 → 1.638 (5.9×) | 0.37 → 15.1 (41×) |
| 24px @1x | 0.024 → 0.342 (14×) | 0.128 → 1.698 (13×) | 0.35 → 10.7 (30×) |
On the CPU raster backend (software fallback, some Linux/framebuffer setups), one text-heavy page now costs 10–18 ms of rasterization. That alone uses most of a 60 Hz frame budget. The desktop default is Vulkan; the GL numbers stand in for it, since both use the same Skia GPU backend (Ganesh) for these operations.
Fidelity vs WinUI and Chrome
The same shaped run in Segoe UI was rendered four ways:
- Skia text blob (pre-feat!: pluggable drawing backend abstraction (WebGPU renderer + managed engines) #24153)
- Skia outline fill (post-feat!: pluggable drawing backend abstraction (WebGPU renderer + managed engines) #24153)
- Direct2D/DirectWrite with grayscale AA (WinUI's text stack)
- Chrome 153
Coverage stats per size, where ink = total coverage and solid = share of inked pixels above 90% coverage:
| Size / scale | WinUI ink / solid | Chrome ink / solid | Before ink / solid | After ink / solid |
|---|---|---|---|---|
| 11px @1x | 585 / 20% | – | 479 / 11% | 545 / 2% |
| 12px @1x | 693 / 24% | – | 563 / 12% | 659 / 7% |
| 14px @1x | 880 / 27% | – | 723 / 12% | 897 / 16% |
| 20px @1x | 1572 / 34% | – | 1262 / 8% | 1575 / 30% |
| 12px @1.5x | 1394 / 36% | 1365 / 20% | 1143 / 12% | 1467 / 27% |
| 14px @1.5x | 2017 / 35% | 1975 / 26% | 1676 / 13% | 2000 / 31% |
| 20px @1.5x | 3480 / 50% | 3380 / 42% | 3095 / 32% | 3571 / 48% |
What the table shows:
- Weight. The old text-blob output had 15–20% less ink than both WinUI and Chrome, so text looked washed out. The new outline fill matches the reference weight to within about 5%. The "heavier" look is the new output being closer to correct.
- Small-size crispness. At 100% and 11–12px, WinUI grid-fits stems, so they land as solid pixels (20–24% solid). The outline fill has no grid-fitting and smears them (2–7% solid), which reads as fuzzy or jagged. The old path was also soft here (11–12%), but less so.
- At 1.5× and above, the outline fill is visually almost indistinguishable from DirectWrite.
(images: skia-before / skia-after / WinUI DirectWrite / Chrome, zoomed)
Note on fonts: every renderer above uses Segoe UI, so the comparison isolates the rasterizer. In real apps WinUI defaults to Segoe UI and Uno targets to Open Sans. The same edging comparison repeated with Open Sans in both renderers gives the same ranking. Comparing Uno with Open Sans to WinUI with Segoe UI differs 8–10× more than any rasterizer variant, so a side-by-side of the two apps mostly shows the font difference.
Chrome also draws with Skia's text pipeline, yet its weight matches WinUI. So the old path's washed-out look likely came from Uno's text gamma/contrast configuration, not from text-blob drawing itself. That's a hypothesis; I haven't verified it.
Expected behavior 🎯
Text on Skia should be:
- As fast as before: glyphs cached in the atlas, not re-rasterized as paths every frame.
- Matching WinUI's weight, which the new path does and the old path didn't.
- Crisp at small sizes at 100% scale, like WinUI.
Suggested direction:
- Add a glyph-run primitive to
IDrawingSession, for exampleDrawGlyphRun(IFont, ReadOnlySpan<ushort>, ReadOnlySpan<Vector2>, Color). The Skia backend implements it withSKTextBlob+DrawText. WebGPU and the managed backend keep the outline path. - Separately, tune the Skia text gamma/contrast so the blob path matches the DirectWrite and Chrome weight instead of returning to the old washed-out look.
How to reproduce it (as minimally and precisely as possible) 🔬
- Run SamplesApp (Skia Desktop) from
de4824d5fdf^1and from currentmaster. - Compare body text at the same window size and display scale. It's most visible at 100% scale and 11–14px.
- For performance, profile a text-heavy page. On the CPU raster backend the difference is dramatic.
Standalone repro (SkiaSharp console app)
using var font = new SKFont(SKTypeface.FromFamilyName("Segoe UI"), 12) { Edging = SKFontEdging.SubpixelAntialias, Subpixel = true };
var glyphs = font.GetGlyphs(text); /* positions from GetGlyphWidths */
// Before #24153 (ParsedText.DrawText)
using var b = new SKTextBlobBuilder();
b.AddPositionedRun(glyphs, font, positions);
canvas.DrawText(b.Build(), 0, y, paint);
// After #24153 (SkiaFont.GetGlyphOutline + SkiaDrawingSession.DrawPaths); glyph paths cached, merge per draw
using var pb = new SKPathBuilder();
for (var i = 0; i < glyphs.Length; i++)
{
pb.AddPath(cachedGlyphPath[glyphs[i]], SKMatrix.CreateTranslation(positions[i].X, y), SKPathAddMode.Append);
}
using var merged = pb.Detach();
canvas.DrawPath(merged, paint);Workaround 🛠️
None.
Renderer 🎨
- Skia
- Native
Affected platforms 📱💻🖥️
All Skia targets share this code path (GlyphRunRenderer → SkiaDrawingSession.DrawPaths): Desktop (Windows, macOS, Linux), WebAssembly (Skia), Android (Skia), iOS (Skia). The measurements above were taken on Windows.
Uno.Sdk version (and other relevant versions) 📦
master after #24153 (de4824d), SkiaSharp 4.151.1.
IDE version 🧑💻
N/A
Anything else we need to know? 💬
Introduced by #24153. The pre-change rendering is ParsedText.DrawText at de4824d5fdf^1, which uses sk_textblob_builder_make + sk_canvas_draw_text_blob.
Activity
[-]Text rendering is different[/-][+][Skia] Text renders heavier/less crisp since #24153 (glyphs filled as paths)[/+][-][Skia] Text renders heavier/less crisp since #24153 (glyphs filled as paths)[/-][+][Skia] Text drawn as glyph paths since #24153: 6-40x slower, blurrier at small sizes[/+]fix(skia): Draw text through Skia's text pipeline again
fix(skia): Draw text through Skia's text pipeline again
test(skia): Make glyph run tests fail loudly
test(richeditbox): Shrink the loaded range-edit story to 128K
test(richeditbox): Shrink the loaded range-edit story to 128K
test(richeditbox): Shrink the loaded range-edit story to 128K
test(richeditbox): Shrink the loaded range-edit story to 128K
test(richeditbox): Shrink the loaded range-edit story to 128K