Browse Source

Fix error caused by undefined self when using three on the node.js command line (e.g. in tests)

Arthur Silber 10 years ago
parent
commit
88fc758860
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/extras/FontUtils.js

+ 7 - 2
src/extras/FontUtils.js

@@ -464,5 +464,10 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
 } )( THREE.FontUtils );
 
 // To use the typeface.js face files, hook up the API
-self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
-THREE.typeface_js = self._typeface_js;
+var typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
+if ( typeof self != 'undefined' ){
+	self._typeface_js = typeface_js
+}
+THREE.typeface_js = typeface_js
+
+