Skip to content

feat: FeatureConfiguration.Font.FallbackService - #23164

Merged
ramezgerges merged 7 commits into
unoplatform:masterfrom
ramezgerges:font_fallback_override
May 1, 2026
Merged

ramezgerges merged 7 commits into
unoplatform:masterfrom
ramezgerges:font_fallback_override

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: closes https://github.com/unoplatform/kahua-private/issues/431

PR Type:

What changed? 🚀

PR Checklist ✅

Copilot AI review requested due to automatic review settings April 30, 2026 13:33
@github-actions github-actions Bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia labels Apr 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a configurable Skia font-fallback service so apps can override how fallback font families/typefaces are resolved (via FeatureConfiguration.Font.FallbackService), and updates the Skia font-fallback plumbing accordingly.

Changes:

  • Adds FeatureConfiguration.Font.FallbackService as an override hook for Skia font fallback resolution.
  • Promotes and updates IFontFallbackService API (rename methods to *FontFamily*) and updates call sites/implementations.
  • Refactors the built-in Noto fallback service and restricts generated fallback maps visibility.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Uno.UI/UI/Xaml/Documents/TextFormatting/FontDetailsCache.skia.cs Uses FeatureConfiguration.Font.FallbackService (if set) before falling back to ApiExtensibility service; updates method calls to the renamed interface.
src/Uno.UI/UI/Xaml/Documents/IFontFallbackService.skia.cs Makes the interface public, renames methods to “FontFamily”, and adds XML documentation.
src/Uno.UI/UI/Xaml/Documents/FontFallbackService.skia.cs Refactors Noto fallback service to delegate to a coverage-table-based service (new types referenced).
src/Uno.UI/UI/Xaml/Documents/FontFallbackMaps.skia.cs Changes generated fallback maps type from public to internal.
src/Uno.UI/FeatureConfiguration.cs Adds FeatureConfiguration.Font.FallbackService property for overriding Skia fallback.
src/Uno.UI.Runtime.Skia.Android/UI/Xaml/Controls/TextBox/AndroidSkiaFontFallbackService.cs Updates Android Skia fallback implementation to the renamed interface methods.
src/FontFallbackPreprocessor/Program.cs Updates generator output to emit internal static class FallbackFontMaps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Uno.UI/FeatureConfiguration.cs Resolved
@ramezgerges
ramezgerges force-pushed the font_fallback_override branch from 34b3779 to ae1d24a Compare April 30, 2026 16:22
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 210082 did not find any UI Test snapshots differences.

@ramezgerges
ramezgerges marked this pull request as ready for review April 30, 2026 19:54
Copilot AI review requested due to automatic review settings April 30, 2026 19:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/Uno.UI/UI/Xaml/Documents/TextFormatting/FontDetailsCache.skia.cs:112

  • Unlike GetFontForCodepoint, this call into the fallback service isn’t wrapped in a try/catch. If a custom IFontFallbackService throws while providing a stream, it can fault the font-loading task and potentially break text rendering. Consider catching exceptions around GetFontStreamForFontFamily (log + fall back to SKTypeface.FromFamilyName).
			if (_fontFallbackService is { } fallbackService
				&& await fallbackService.GetFontStreamForFontFamily(name, weight, stretch, style) is { } fallbackStream
				&& SKTypeface.FromStream(fallbackStream) is { } typeface)
			{
				return typeface;
			}
			// FromFontFamilyName may return null: https://github.com/mono/SkiaSharp/issues/1058
			return SKTypeface.FromFamilyName(name, skWeight, skWidth, skSlant);
		}
	}


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 210132 has failed on Uno.UI - docs.

Comment thread doc/articles/features/custom-fonts.md Resolved
@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 210131 has failed on Uno.UI - CI.

@ramezgerges
ramezgerges enabled auto-merge May 1, 2026 14:02
Copilot AI review requested due to automatic review settings May 1, 2026 14:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread doc/articles/features/custom-fonts.md Resolved
Comment thread src/Uno.UI/FeatureConfiguration.cs Resolved
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 210297 did not find any UI Test snapshots differences.

@ramezgerges
ramezgerges merged commit 3dc0b3f into unoplatform:master May 1, 2026
48 checks passed
@ramezgerges
ramezgerges deleted the font_fallback_override branch May 2, 2026 18:46
@agneszitte

Copy link
Copy Markdown
Member

@mergify backport release/stable/6.6

@mergify

mergify Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.6

✅ Backports have been created

Details

agneszitte added a commit that referenced this pull request Jun 2, 2026
…6.6/pr-23164

feat: FeatureConfiguration.Font.FallbackService (backport #23164)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants