Parcourir la source

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 <michael.herzog@human-interactive.org>
Aless Li il y a 6 mois
Parent
commit
b9ce407722
1 fichiers modifiés avec 13 ajouts et 1 suppressions
  1. 13 1
      examples/jsm/loaders/TTFLoader.js

+ 13 - 1
examples/jsm/loaders/TTFLoader.js

@@ -152,7 +152,19 @@ class TTFLoader extends Loader {
 
 
 					} );
 					} );
 
 
-					glyphs[ String.fromCodePoint( glyph.unicode ) ] = token;
+					if ( Array.isArray( glyph.unicodes ) && glyph.unicodes.length > 0 ) {
+						
+						glyph.unicodes.forEach( function ( unicode ) {
+							
+							glyphs[ String.fromCodePoint( unicode ) ] = token;
+							
+						} );
+						
+					} else {
+
+						glyphs[ String.fromCodePoint( glyph.unicode ) ] = token;
+
+					}
 
 
 				}
 				}
 
 

粤ICP备19079148号