Browse Source

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 năm trước cách đây
mục cha
commit
40102adda0
1 tập tin đã thay đổi với 9 bổ sung1 xóa
  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."
+
+		};
 
 	},