瀏覽代碼

Throw a decent error on missing font.

It throws an error when the font is missing.
Ex: "The font helvetiker with normal weight and normal style is missing.

Fixes #4923.
gero3 11 年之前
父節點
當前提交
40102adda0
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      src/extras/FontUtils.js

+ 9 - 1
src/extras/FontUtils.js

@@ -33,7 +33,15 @@ THREE.FontUtils = {
 
 	getFace: function () {
 
-		return this.faces[ this.face ][ this.weight ][ this.style ];
+		try {
+
+			return this.faces[ this.face ][ this.weight ][ this.style ];
+
+		} catch (e) {
+
+			throw "The font " + this.face + " with " + this.weight + " weight and " + this.style + " style is missing."
+
+		};
 
 	},