-
-
Notifications
You must be signed in to change notification settings - Fork 72
Fix various shaping issues. #491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes various font shaping issues, particularly for Indic-style scripts (Sinhala, Bengali, Tibetan, Myanmar). The changes introduce comprehensive support for mark filtering sets, refactor glyph sequence matching with explicit directional control, add Myanmar-specific shaping infrastructure, and improve text measurement to account for ink bounds and stacked glyphs that extend beyond typographic metrics.
Key Changes:
- Add mark filtering set support throughout the shaping pipeline with new
IsInMarkFilteringSetAPI - Introduce Myanmar shaping engine with state machine and category definitions
- Refactor text measurement to combine logical advance and ink bounds for accurate sizing
- Enhance text layout to handle tall glyph stacks (Tibetan, etc.) that exceed typographic ascenders
Reviewed changes
Copilot reviewed 99 out of 104 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
TextLayoutTests.cs |
Remove extra blank line |
TextLayoutTestUtilities.cs |
Update to collection expression syntax |
TestFonts.cs |
Add font paths for new Indic script test fonts |
GSubTableTests.Indic.cs |
Increase font size and add commented test layout call |
Issues_488.cs |
New test file with tests for Sinhala, Bengali, Tibetan, Myanmar shaping |
Issues_451.cs, Issues_337.cs |
Remove unnecessary origin parameters and update assertions |
| Reference output images | New and updated baseline images for shaping fixes |
UniversalShapingTrie.Generated.cs |
Updated generated trie data with new HVM category |
UniversalShapingData.Generated.cs |
Add HVM category and update state machine tables |
MyanmarShapingData.Generated.cs |
New generated file with Myanmar state machine |
IndicShapingData.cs |
Major refactor: convert to non-flags enum, add Myanmar categories, add flag helper methods |
VerticalAlignment.cs |
Add new Baseline alignment option |
TextMeasurer.cs |
Refactor to compute both logical advance and ink bounds |
TextLayout.cs |
Add logic to handle tall glyph stacks above baseline |
SkippingGlyphIterator.cs |
Add mark filtering set support and Prev() method |
UniversalShaper.cs |
Add broken cluster handling with dotted circle insertion |
NotImplementedSubTable.cs |
Add missing markFilteringSet parameter |
| Generator files | Add Myanmar shaping data generation and HVM category |
No critical issues found. The changes appear well-structured and comprehensive for addressing the shaping issues described in the PR.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Prerequisites
Description
Fixes #488
This pull request introduces significant improvements and refactoring to the font shaping and advanced typographic utilities in the SixLabors.Fonts library. The main focus is on enhancing the handling of mark filtering sets, improving the flexibility of glyph sequence matching, and making the shaping data structures more robust. The changes also include new utility methods, API improvements, and some code cleanups.
Mark Filtering Set Support and Lookup Enhancements:
IsInMarkFilteringSetmethod inFontMetricsand its implementations, and wiring this through shaping and lookup utilities. [1] [2] [3]markFilteringSetinformation, ensuring correct application of lookup flags during glyph positioning and substitution. [1] [2] [3]Glyph Sequence Matching and Contextual Rule Improvements:
MatchDirectionenum and enhanced the matching functions to handle both forward and backward matching, with improved handling of index boundaries. [1] [2] [3]markFilteringSetparameter, ensuring correct filtering during lookup operations. [1] [2]Glyph Shaping Data and Collection Utilities:
GlyphShapingDataand related engine info classes by making more properties settable and simplifying enum usage, aiding in shaping engine extensibility. [1] [2]GlyphSubstitutionCollectionfor reversing a range of glyphs and inserting glyph data at a specific index, providing more granular control during shaping. [1] [2]Code Quality and Maintenance:
These changes collectively improve the correctness, maintainability, and feature set of the font shaping and advanced typographic processing in the library.