TTFLoader: Fix when TTF has different unicode assign to same glyph index #31386
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
Some font has more than one unicode assigned to same glyph index.
Issue
For example DotGothic16
There are
⼈very similar but actually are two different characters with different unicodes.But DotGothic16 is set to same characters and assigned same glyph index.
⼈, ID:12040, HEXD:2F08, glyph index :2531人, ID:20154, HEXD:4EBA, glyph index :2531Error occurred when I loaded
人, ID: 20154since the TTFLoader load by glyph index for now, the glyph object key has set⼈, ID: 12040only.As the image below, the characters
人, ID: 20154cannot be found and show?.Solution
To handle this issue, The TTFLoader has to set both of the
⼈with different unicodes and same glyph index. With the code i changed, characters can be loaded by TTFLoader as the image below.The issue with character
一also fixed.