Skip to content

Conversation

@JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

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:

  • Added support for checking if a glyph is in a mark filtering set by introducing the IsInMarkFilteringSet method in FontMetrics and its implementations, and wiring this through shaping and lookup utilities. [1] [2] [3]
  • Updated lookup list and subtable loading logic to propagate markFilteringSet information, ensuring correct application of lookup flags during glyph positioning and substitution. [1] [2] [3]

Glyph Sequence Matching and Contextual Rule Improvements:

  • Refactored glyph sequence matching logic to use explicit start/end indices and direction, improving correctness and flexibility for both backtrack and lookahead contexts in chained contextual rules. [1] [2] [3]
  • Introduced the MatchDirection enum and enhanced the matching functions to handle both forward and backward matching, with improved handling of index boundaries. [1] [2] [3]
  • Updated the application of lookup lists to pass the markFilteringSet parameter, ensuring correct filtering during lookup operations. [1] [2]

Glyph Shaping Data and Collection Utilities:

  • Improved the GlyphShapingData and related engine info classes by making more properties settable and simplifying enum usage, aiding in shaping engine extensibility. [1] [2]
  • Added new methods to GlyphSubstitutionCollection for 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:

  • Updated comments and code references for clarity, and performed minor cleanups such as using static imports and improving variable naming. [1] [2] [3]

These changes collectively improve the correctness, maintainability, and feature set of the font shaping and advanced typographic processing in the library.

Copy link

Copilot AI left a 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 IsInMarkFilteringSet API
  • 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.

@JimBobSquarePants JimBobSquarePants merged commit fd8f253 into main Dec 18, 2025
9 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/fix-488 branch December 18, 2025 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Few fonts rendering error

2 participants