polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
2 lines • 2.32 kB
JavaScript
(window.webpackJsonpPOLY=window.webpackJsonpPOLY||[]).push([[3],{208:function(e,n){},219:function(e,n,t){"use strict";t.r(n),t.d(n,"TTFLoader",(function(){return i}));var o=t(42),a=t(19),r=t(209),i=function(e){a.a.call(this,e),this.reversed=!1};i.prototype=Object.assign(Object.create(a.a.prototype),{constructor:i,load:function(e,n,t,a){var r=this,i=new o.a(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(function(t){try{n(r.parse(t))}catch(n){a?a(n):console.error(n),r.manager.itemError(e)}}),t,a)},parse:function(e){function n(e){var n,t=[];e.forEach((function(e){"m"===e.type.toLowerCase()?(n=[e],t.push(n)):"z"!==e.type.toLowerCase()&&n.push(e)}));var o=[];return t.forEach((function(e){var n={type:"m",x:e[e.length-1].x,y:e[e.length-1].y};o.push(n);for(var t=e.length-1;t>0;t--){var a=e[t];n={type:a.type};void 0!==a.x2&&void 0!==a.y2?(n.x1=a.x2,n.y1=a.y2,n.x2=a.x1,n.y2=a.y1):void 0!==a.x1&&void 0!==a.y1&&(n.x1=a.x1,n.y1=a.y1),n.x=e[t-1].x,n.y=e[t-1].y,o.push(n)}})),o}return void 0===r.a?(console.warn("THREE.TTFLoader: The loader requires opentype.js. Make sure it's included before using the loader."),null):function(e,t){for(var o=Math.round,a={},r=1e5/(72*(e.unitsPerEm||2048)),i=e.encoding.cmap.glyphIndexMap,s=Object.keys(i),d=0;d<s.length;d++){var c=s[d],h=e.glyphs.glyphs[i[c]];if(void 0!==c){var y={ha:o(h.advanceWidth*r),x_min:o(h.xMin*r),x_max:o(h.xMax*r),o:""};t&&(h.path.commands=n(h.path.commands)),h.path.commands.forEach((function(e){"c"===e.type.toLowerCase()&&(e.type="b"),y.o+=e.type.toLowerCase()+" ",void 0!==e.x&&void 0!==e.y&&(y.o+=o(e.x*r)+" "+o(e.y*r)+" "),void 0!==e.x1&&void 0!==e.y1&&(y.o+=o(e.x1*r)+" "+o(e.y1*r)+" "),void 0!==e.x2&&void 0!==e.y2&&(y.o+=o(e.x2*r)+" "+o(e.y2*r)+" ")})),a[String.fromCodePoint(h.unicode)]=y}}return{glyphs:a,familyName:e.getEnglishName("fullName"),ascender:o(e.ascender*r),descender:o(e.descender*r),underlinePosition:e.tables.post.underlinePosition,underlineThickness:e.tables.post.underlineThickness,boundingBox:{xMin:e.tables.head.xMin,xMax:e.tables.head.xMax,yMin:e.tables.head.yMin,yMax:e.tables.head.yMax},resolution:1e3,original_font_information:e.tables.name}}(r.a.parse(e),this.reversed)}})}}]);
//# sourceMappingURL=3.js.map