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 #451

When applying lookups during chained contextual substitution we were looping through all sub-tables for a given feature when we should have been returning after the first.

I've also added extra debugging issue that was missing from the positioning collection which tracked what features have been applied.

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 PR fixes issue #451 by ensuring that only the first applicable sub-table is processed during chained contextual substitutions and by enhancing debug tracking for applied features.

  • Updated GPos lookup sub-tables and related utility methods to pass the new "feature" parameter.
  • Modified ApplyLookupList methods in AdvancedTypographicUtils to always return true and removed the "hasChanged" flag.
  • Added tests for issue #451 and adjusted the test fonts to include VeryBerryProRegular.

Reviewed Changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/SixLabors.Fonts.Tests/TestFonts.cs Added a new test font path for VeryBerryProRegular.
tests/SixLabors.Fonts.Tests/Issues/Issues_451.cs Added tests to validate the fix for issue #451.
src/SixLabors.Fonts/Tables/AdvancedTypographic/GPos/LookupType{1,2,4,5,6}SubTable.cs Updated calls to utility methods to include the "feature" parameter.
src/SixLabors.Fonts/Tables/AdvancedTypographic/AdvancedTypographicUtils.cs Revised lookup list handling and position/anchor applications to incorporate the feature parameter.
src/SixLabors.Fonts/GlyphShapingData.cs Changed AppliedFeatures from List to HashSet and updated the copying logic accordingly.
Files not reviewed (3)
  • tests/Images/ReferenceOutput/Issue_451_A-.png: Language not supported
  • tests/Images/ReferenceOutput/Issue_451_B-.png: Language not supported
  • tests/Images/ReferenceOutput/Issue_451_C-.png: Language not supported
Comments suppressed due to low confidence (3)

src/SixLabors.Fonts/Tables/AdvancedTypographic/AdvancedTypographicUtils.cs:74

  • Changing the return value from 'hasChanged' to always returning true in ApplyLookupList might conceal cases where no position changes occurred. Please verify that this change in behavior is intended.
return true;

src/SixLabors.Fonts/Tables/AdvancedTypographic/AdvancedTypographicUtils.cs:98

  • In the second overload of ApplyLookupList, the removal of the 'hasChanged' flag and always returning true may hide cases without updates. Confirm that this behavior is acceptable for all usage scenarios.
return true;

src/SixLabors.Fonts/GlyphShapingData.cs:130

  • [nitpick] Switching from a List to a HashSet for AppliedFeatures may affect the order in which features are applied. Please confirm that feature order is not significant for downstream processing.
public HashSet<Tag> AppliedFeatures { get; set; } = new();

@JimBobSquarePants JimBobSquarePants merged commit eadc8db into main Apr 23, 2025
15 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/fix-451 branch April 23, 2025 12:26
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.

font generate word error

3 participants