浏览代码

Moved TextGeometry back to core. Removed typeface_js hack.

Mr.doob 9 年之前
父节点
当前提交
38dd0a5994

+ 1 - 6
examples/js/utils/FontUtils.js → src/extras/FontUtils.js

@@ -35,7 +35,7 @@ THREE.FontUtils = {
 
 		} catch ( e ) {
 
-			throw "The font " + this.face + " with " + this.weight + " weight and " + this.style + " style is missing."
+			throw "The font " + this.face + " with " + this.weight + " weight and " + this.style + " style is missing.";
 
 		}
 
@@ -269,8 +269,3 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
 	return shapes;
 
 };
-
-// To use the typeface.js face files, hook up the API
-
-THREE.typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
-if ( typeof self !== 'undefined' ) self._typeface_js = THREE.typeface_js;

+ 0 - 0
examples/js/geometries/TextGeometry.js → src/extras/geometries/TextGeometry.js


+ 40 - 0
src/loaders/FontLoader.js

@@ -0,0 +1,40 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.FontLoader = function ( manager ) {
+
+	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+
+};
+
+THREE.FontLoader.prototype = {
+
+	constructor: THREE.TextureLoader,
+
+	load: function ( url, onLoad, onProgress, onError ) {
+
+		var scope = this;
+
+		var loader = new THREE.XHRLoader( scope.manager );
+		loader.load( url, function ( text ) {
+
+			onLoad( THREE.FontUtils.loadFace( JSON.parse( text ) ) );
+
+		}, onProgress, onError );
+
+	},
+
+	setCrossOrigin: function ( value ) {
+
+		this.crossOrigin = value;
+
+	},
+
+	setPath: function ( value ) {
+
+		this.path = value;
+
+	}
+
+};

+ 1 - 0
utils/build/includes/common.json

@@ -72,6 +72,7 @@
 	"src/loaders/Cache.js",
 	"src/loaders/Loader.js",
 	"src/loaders/XHRLoader.js",
+	"src/loaders/FontLoader.js",
 	"src/loaders/ImageLoader.js",
 	"src/loaders/JSONLoader.js",
 	"src/loaders/LoadingManager.js",

+ 2 - 0
utils/build/includes/extras.json

@@ -1,5 +1,6 @@
 [
 	"src/extras/CurveUtils.js",
+	"src/extras/FontUtils.js",
 	"src/extras/SceneUtils.js",
 	"src/extras/ShapeUtils.js",
 	"src/extras/core/Curve.js",
@@ -31,6 +32,7 @@
 	"src/extras/geometries/RingGeometry.js",
 	"src/extras/geometries/SphereGeometry.js",
 	"src/extras/geometries/SphereBufferGeometry.js",
+	"src/extras/geometries/TextGeometry.js",
 	"src/extras/geometries/TorusGeometry.js",
 	"src/extras/geometries/TorusKnotGeometry.js",
 	"src/extras/geometries/TubeGeometry.js",