Fix TrueTypeInterpreter pool state pollution#541
Merged
Conversation
Align TrueType prep execution with FreeType behavior to improve deterministic hinting. This removes the saved post-fpgm storage baseline, clears storage before each prep run, and ensures prep still runs when no CVT table is present. CVT scaling now rounds to 26.6 fixed-point precision to avoid size-dependent rounding drift (notably in Arial at 13 ppem). The Arial hinting robustness reference image was updated to match the corrected output.
4 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #541 +/- ##
=====================================
Coverage 84% 84%
=====================================
Files 332 332
Lines 24668 24684 +16
Branches 3611 3612 +1
=====================================
+ Hits 20771 20785 +14
- Misses 3010 3011 +1
- Partials 887 888 +1
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
Replaces #540
@christianrondeau I couldn't push to your fork (I think because you are an org) so I replicated your commit here to ensure you have co-ownership.
This pull request improves the determinism and correctness of the TrueType hinting engine by ensuring that the interpreter's state is fully reset between renders, preventing non-deterministic output when reusing interpreters from a pool. It also improves CVT scaling precision and adds a regression test to guarantee consistent results. The most important changes are:
TrueType Interpreter State Management:
SetControlValueTableinTrueTypeInterpreter.csto always run the prep program even if the CVT table is missing, and to fully reset interpreter state (twilight zone, storage, rounding, zone pointers, etc.) before each prep execution, matching FreeType's behavior and preventing history-dependent, non-deterministic hinting results. [1] [2]Hinting Precision:
Testing and Robustness:
Hinting_OutputIsIndependentOfPreviouslyRenderedSizesinHintingTests.csto ensure that rendering output is independent of previously rendered sizes and interpreter reuse. [1] [2]