Update SkiaSharp to 4.148.0 and HarfBuzzSharp to 14.2.0 - #544
Conversation
Bump to the latest stable SkiaSharp/HarfBuzzSharp. SkiaSharp 4 removes the SKPaint text surface on net6.0+ targets, so migrate the renderer from "SKPaint as font carrier" to SKFont (measurement, shaping, glyph paths, metrics, draw sites). Align the MAUI Controls workload to 10.0.20 and the Avalonia SkiaSharp override onto the shared version. Restore the requested font style for implicit/generic family names: Skia 4 drops slant/weight/width when resolving a null/empty/generic family, so re-query the resolved concrete family name and keep the better style match. Widen two W3C text-fonts thresholds for the Skia 4 native raster shift. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CJK text can resolve to multiple typeface runs under platform font fallback (Linux CI lacks a single font covering both glyphs), so assert the ideographic baseline on every run instead of requiring exactly one. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f16cf999ab
ℹ️ 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".
|
@mattleibow There are some changes that require checking perf impact, I will run benchmarks to check if there is not perf regression. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c9c385d64
ℹ️ 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".

Summary
Updates SkiaSharp and HarfBuzzSharp to the latest stable releases:
3.119.2→4.148.08.3.1.3→14.2.010.0.0→10.0.20(aligns with the SkiaSharp 4 MAUI views and the current MAUI workload)This is the stable counterpart to the SkiaSharp 4 preview exploration in #528.
Why this needs a renderer change
SkiaSharp 4 removes the
SKPainttext surface (Typeface,TextSize,TextAlign,MeasureText,GetTextPath,GetFontMetrics,ToFont,FakeBoldText, …) onnet6.0+ target frameworks (the members remain only onnetstandard2.0/net4x). The renderer therefore moves from "SKPaintas the font carrier" toSKFont:SkiaModel/SkiaModel.Caching— render paints no longer carry text properties; draw sites pass(textAlign, font, paint).SkiaModel.TextShaping— HarfBuzz shaping, measurement, advance caching and glyph-path extraction are keyed on and driven bySKFont.SkiaSvgAssetLoader— typeface discovery, metrics, measurement and text-path now useSKFont.SvgML.Mauihosted-control text measurement migrated toSKFont.The
SKFontdefaults used here (Edging=Antialias,Subpixel=false,BaselineSnap=true, …) match the previous compatSKPaint.ToFont()round-trip, so rendering output is preserved.Implicit/generic font-style fix
SkiaSharp 4 on some platforms (e.g. macOS) ignores the requested style when a font family is null/empty/generic —
FromFamilyName(null, …, Italic)returns an upright face, while the resolved concrete family (Helvetica) still has the italic variant. This made the family-resolution path and the character-resolution path disagree.ResolveSKTypefacenow re-queries the resolved concrete family name with the requested style and keeps the result only when it is a strictly better slant/weight/width match, restoring the SkiaSharp 3 behaviour cross-platform.Tests
Svg.Skia.slnxbuilds and tests green locally (all target frameworks, all test projects including the Avalonia control/editor suites).W3CTestSuiteTestsrows (text-fonts-01-t,text-fonts-02-t) get narrowly widened thresholds (0.026/0.033) for the SkiaSharp 4 native text-raster shift; geometry and layout are unchanged.SvgML.Maui,Svg.Controls.Skia.Mauiand theSvgML.Maui.Demoandroid target all build clean.Notes
build/SkiaSharp.Avalonia.propsintentionally overrides those direct references onto the single shared SkiaSharp 4 version. The in-solution Avalonia test suites pass against SkiaSharp 4 in local runs.SkiaSharpVersion/HarfBuzzSharpVersionMSBuild properties for easy future bumps.