Skip to content

TTFLoader: Fix when TTF has different unicode assign to same glyph index#31386

Merged
Mugen87 merged 3 commits into
mrdoob:devfrom
Rikahei:TTFLoader_fix_similar_font
Jul 10, 2025
Merged

TTFLoader: Fix when TTF has different unicode assign to same glyph index#31386
Mugen87 merged 3 commits into
mrdoob:devfrom
Rikahei:TTFLoader_fix_similar_font

Conversation

@Rikahei

@Rikahei Rikahei commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

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 : 2531

Error occurred when I loaded 人, ID: 20154 since the TTFLoader load by glyph index for now, the glyph object key has set ⼈, ID: 12040 only.

As the image below, the characters 人, ID: 20154 cannot be found and show ?.

Screenshot 2025-07-10 at 1 53 57

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.

Screenshot 2025-07-10 at 1 52 51

The issue with character also fixed.

Comment thread examples/jsm/loaders/TTFLoader.js Outdated
@Mugen87 Mugen87 added this to the r179 milestone Jul 9, 2025
@Mugen87 Mugen87 merged commit b9ce407 into mrdoob:dev Jul 10, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants