Skip to content

Update SkiaSharp to 4.148.0 and HarfBuzzSharp to 14.2.0 - #544

Merged
wieslawsoltes merged 8 commits into
wieslawsoltes:masterfrom
mattleibow:mattleibow-update-skiasharp-harfbuzzsharp-stable
Jul 1, 2026
Merged

Update SkiaSharp to 4.148.0 and HarfBuzzSharp to 14.2.0#544
wieslawsoltes merged 8 commits into
wieslawsoltes:masterfrom
mattleibow:mattleibow-update-skiasharp-harfbuzzsharp-stable

Conversation

@mattleibow

Copy link
Copy Markdown
Contributor

Summary

Updates SkiaSharp and HarfBuzzSharp to the latest stable releases:

  • SkiaSharp 3.119.24.148.0
  • HarfBuzzSharp 8.3.1.314.2.0
  • Microsoft.Maui.Controls / Compatibility 10.0.010.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 SKPaint text surface (Typeface, TextSize, TextAlign, MeasureText, GetTextPath, GetFontMetrics, ToFont, FakeBoldText, …) on net6.0+ target frameworks (the members remain only on netstandard2.0/net4x). The renderer therefore moves from "SKPaint as the font carrier" to SKFont:

  • 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 by SKFont.
  • SkiaSvgAssetLoader — typeface discovery, metrics, measurement and text-path now use SKFont.
  • SvgML.Maui hosted-control text measurement migrated to SKFont.

The SKFont defaults used here (Edging=Antialias, Subpixel=false, BaselineSnap=true, …) match the previous compat SKPaint.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/genericFromFamilyName(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. ResolveSKTypeface now 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

  • Full Svg.Skia.slnx builds and tests green locally (all target frameworks, all test projects including the Avalonia control/editor suites).
  • Two W3CTestSuiteTests rows (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.
  • MAUI build job validated locally: SvgML.Maui, Svg.Controls.Skia.Maui and the SvgML.Maui.Demo android target all build clean.

Notes

  • Avalonia.Skia still ships against SkiaSharp 3.x; build/SkiaSharp.Avalonia.props intentionally overrides those direct references onto the single shared SkiaSharp 4 version. The in-solution Avalonia test suites pass against SkiaSharp 4 in local runs.
  • Versions are centralised behind SkiaSharpVersion / HarfBuzzSharpVersion MSBuild properties for easy future bumps.

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>
@wieslawsoltes

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/Svg.Skia/SkiaSvgAssetLoader.cs Outdated
@wieslawsoltes

Copy link
Copy Markdown
Owner

@mattleibow There are some changes that require checking perf impact, I will run benchmarks to check if there is not perf regression.

@wieslawsoltes

Copy link
Copy Markdown
Owner

So some perf regression is found during benchmarks

image

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/Svg.Skia/SkiaModel.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants