Skip to content

Commit b9ce407

Browse files
RikaheiMugen87
andauthored
TTFLoader: Fix when TTF has different unicode assign to same glyph index (#31386)
* TTFLoader - Fix when TTF has different unicode assign to same glyph index * Update TTFLoader.js Clean up. * Change to isArray --------- Co-authored-by: Michael Herzog <[email protected]>
1 parent 965b51c commit b9ce407

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

examples/jsm/loaders/TTFLoader.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,19 @@ class TTFLoader extends Loader {
152152

153153
} );
154154

155-
glyphs[ String.fromCodePoint( glyph.unicode ) ] = token;
155+
if ( Array.isArray( glyph.unicodes ) && glyph.unicodes.length > 0 ) {
156+
157+
glyph.unicodes.forEach( function ( unicode ) {
158+
159+
glyphs[ String.fromCodePoint( unicode ) ] = token;
160+
161+
} );
162+
163+
} else {
164+
165+
glyphs[ String.fromCodePoint( glyph.unicode ) ] = token;
166+
167+
}
156168

157169
}
158170

0 commit comments

Comments
 (0)