feat: add support for Ideographic Variation Sequences (IVS) in TrueTy…#1481
Closed
wang0331 wants to merge 1 commit intoLibrePDF:1.3-java8from
Closed
feat: add support for Ideographic Variation Sequences (IVS) in TrueTy…#1481wang0331 wants to merge 1 commit intoLibrePDF:1.3-java8from
wang0331 wants to merge 1 commit intoLibrePDF:1.3-java8from
Conversation
Contributor
Author
|
Collaborator
|
The target branch needs to be master. |
Contributor
Author
|
@andreasrosdal you mean merge my 1.3-java8 to target master? |
Collaborator
|
The target branch of your pull request needs to be master. |
Contributor
Author
I'm not quite clear about this: If I want to submit code for Java 8 and Java 21 separately, how should I do it? Shouldn't I submit pull requests (PRs) to the corresponding Java version branches respectively? |
Collaborator
Contributor
Author
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.





Description
This PR implements support for Ideographic Variation Sequences (IVS) in TrueType font rendering. IVS allows proper display of variant glyphs for CJK (Chinese, Japanese, Korean) characters, which is essential for correct typography in East Asian languages.
Key Changes
Added IVS lookup tables parsing in TrueType font processor
Implemented Unicode Variation Selector matching logic
Enhanced glyph substitution mechanism to handle IVS variants
Added fallback mechanisms for fonts without IVS support
Updated font metrics calculation for variant glyphs
Technical Details
Supports Unicode Variation Selectors
Implements gsub table lookup for uvs and non-default UVS features
Maintains backward compatibility with existing font rendering
Testing
✅ use template text and font export for IVS sequence detection
✅ Tested with known IVS-enabled fonts (e.g., Source Hei_MSCS)
✅ Verified rendering of CJK variant characters
✅ Confirmed backward compatibility with standard TrueType fonts
Impact
Enables correct display of CJK typographic variants
Improves PDF generation quality for East Asian documents
No breaking changes to existing API
Minimal performance impact (only activates when IVS sequences are present)
Related Issues
Closes #[issue-number-here]
Compatibility
✅ Fully backward compatible
✅ No changes to public API signatures
✅ Works with existing TrueType/OpenType fonts
Additional Notes
This implementation follows the Unicode Standard Annex #44 and OpenType specification for IVS handling. The feature only activates when both the font supports IVS and the text contains variation selector characters, ensuring minimal overhead for regular documents.
Your Name: oBo
Testing Instructions:
Use a font with IVS support (e.g., Source Han Sans)
Create PDF with CJK text containing variation selectors
Verify variant glyphs render correctly
Test with fonts without IVS support to confirm fallback behavior