Add font fallback resolver and update submodules - #555
Merged
Conversation
Introduce `IFontFallbackResolver` and expose `SystemFonts.FallbackResolver` so text shaping can ask a resolver for a fallback family after the primary and explicit fallback fonts fail. The shaping pipeline now retries unresolved code points with resolver-supplied families, carries the option through cloned layout settings, and adds focused tests covering resolver use, precedence, caching behavior, and missing-glyph fallback.
Bumps the `shared-infrastructure` and `tests/harfbuzz` submodules to newer commits so the repository picks up the latest shared infrastructure and HarfBuzz test data changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #555 +/- ##
======================================
Coverage 81% 81%
======================================
Files 405 406 +1
Lines 35612 35672 +60
Branches 5548 5561 +13
======================================
+ Hits 28931 29145 +214
+ Misses 5485 5358 -127
+ Partials 1196 1169 -27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
This pull request introduces a new extensible fallback mechanism for font shaping, allowing users to provide a custom
IFontFallbackResolverto resolve glyphs for code points that cannot be shaped by the primary or fallback font families. The system includes a built-in resolver that leverages the operating system's installed fonts, and the shaping pipeline is updated to consult the resolver as a last resort. Comprehensive tests are added to validate the new fallback behavior.Font Fallback Extensibility and Pipeline Updates:
IFontFallbackResolverinterface, which allows custom logic for resolving font families for code points not covered by configured fonts (src/SixLabors.Fonts/IFontFallbackResolver.cs).FontFallbackResolverproperty toTextOptions, enabling users to specify a resolver for unresolved code points, and ensured it is copied in constructors and utilities (src/SixLabors.Fonts/TextOptions.cs,tests/SixLabors.Fonts.Tests/TextLayoutTestUtilities.cs). [1] [2] [3]src/SixLabors.Fonts/TextShaper.Pipeline.cs). [1] [2] [3] [4] [5] [6]Built-in System Resolver:
SystemFontFallbackResolver, a built-in resolver that uses the OS's font matching to resolve families, with caching for performance, and exposed it asSystemFonts.FallbackResolver(src/SixLabors.Fonts/SystemFontFallbackResolver.cs,src/SixLabors.Fonts/SystemFonts.cs). [1] [2]Testing and Dependency Updates:
tests/SixLabors.Fonts.Tests/FontFallbackResolverTests.cs).tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj). [1] [2]Submodule Updates:
shared-infrastructureandharfbuzzsubmodules to new commits. [1] [2]