Преглед изворни кода

TTFLoader: fixed family name

troy351 пре 6 година
родитељ
комит
51661e78b7
2 измењених фајлова са 4 додато и 2 уклоњено
  1. 2 1
      examples/js/loaders/TTFLoader.js
  2. 2 1
      examples/jsm/loaders/TTFLoader.js

+ 2 - 1
examples/js/loaders/TTFLoader.js

@@ -1,6 +1,7 @@
 /**
 /**
  * @author gero3 / https://github.com/gero3
  * @author gero3 / https://github.com/gero3
  * @author tentone / https://github.com/tentone
  * @author tentone / https://github.com/tentone
+ * @author troy351 / https://github.com/troy351
  *
  *
  * Requires opentype.js to be included in the project.
  * Requires opentype.js to be included in the project.
  * Loads TTF files and converts them into typeface JSON that can be used directly
  * Loads TTF files and converts them into typeface JSON that can be used directly
@@ -110,7 +111,7 @@ THREE.TTFLoader.prototype = {
 
 
 			return {
 			return {
 				glyphs: glyphs,
 				glyphs: glyphs,
-				familyName: font.familyName,
+				familyName: font.getEnglishName( 'fullName' ),
 				ascender: round( font.ascender * scale ),
 				ascender: round( font.ascender * scale ),
 				descender: round( font.descender * scale ),
 				descender: round( font.descender * scale ),
 				underlinePosition: font.tables.post.underlinePosition,
 				underlinePosition: font.tables.post.underlinePosition,

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

@@ -1,6 +1,7 @@
 /**
 /**
  * @author gero3 / https://github.com/gero3
  * @author gero3 / https://github.com/gero3
  * @author tentone / https://github.com/tentone
  * @author tentone / https://github.com/tentone
+ * @author troy351 / https://github.com/troy351
  *
  *
  * Requires opentype.js to be included in the project.
  * Requires opentype.js to be included in the project.
  * Loads TTF files and converts them into typeface JSON that can be used directly
  * Loads TTF files and converts them into typeface JSON that can be used directly
@@ -115,7 +116,7 @@ TTFLoader.prototype = {
 
 
 			return {
 			return {
 				glyphs: glyphs,
 				glyphs: glyphs,
-				familyName: font.familyName,
+				familyName: font.getEnglishName( 'fullName' ),
 				ascender: round( font.ascender * scale ),
 				ascender: round( font.ascender * scale ),
 				descender: round( font.descender * scale ),
 				descender: round( font.descender * scale ),
 				underlinePosition: font.tables.post.underlinePosition,
 				underlinePosition: font.tables.post.underlinePosition,