troika-3d-text
Advanced tools
Comparing version 0.15.5 to 0.15.6
@@ -1,7 +0,7 @@ | ||
'use strict';(function(C,z){"object"===typeof exports&&"undefined"!==typeof module?z(exports,require("three"),require("troika-worker-utils"),require("troika-three-utils")):"function"===typeof define&&define.amd?define(["exports","three","troika-worker-utils","troika-three-utils"],z):(C=C||self,z(C.troika_3d_text={},C.THREE,C.troika_worker_utils,C.troika_three_utils))})(this,function(C,z,F,R){function S(r,g){r=J({},r);K.href=r.font||H.defaultFontURL;r.font=K.href;r.text=""+r.text;var b=H.sdfGlyphSize, | ||
a=L[r.font];a||(a=L[r.font]={sdfTexture:new z.DataTexture(new Uint8Array(b*b*64),b,64*b,z.LuminanceFormat,void 0,void 0,void 0,void 0,z.LinearFilter,z.LinearFilter)},a.sdfTexture.font=r.font);T(r).then(function(c){c.newGlyphSDFs&&(c.newGlyphSDFs.forEach(function(c){var d=c.textureData,f=a.sdfTexture.image;for(c=c.atlasIndex*b*b;c>f.data.length-1;){var g=new Uint8Array(2*f.data.length);g.set(f.data);f.data=g;f.height*=2}f.data.set(d,c)}),a.sdfTexture.needsUpdate=!0);g({sdfTexture:a.sdfTexture,sdfMinDistancePercent:.125, | ||
glyphBounds:c.glyphBounds,glyphIndices:c.glyphIndices,totalBounds:c.totalBounds,totalBlockSize:c.totalBlockSize})})}function J(r,g){for(var b in g)g.hasOwnProperty(b)&&(r[b]=g[b]);return r}function M(r,g){r.array.length===g.length?r.array.set(g):r.setArray(g);r.needsUpdate=!0}function U(r){r=R.createDerivedMaterial(r,{extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFMinDistancePct:{value:0},uTroikaGlyphVSize:{value:0},uTroikaTotalBounds:{value:new z.Vector4},uTroikaClipRect:{value:new z.Vector4}, | ||
uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaTotalBounds;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n",vertexTransform:"\nvTroikaGlyphUV = vec2(\n position.x,\n uTroikaGlyphVSize * (aTroikaGlyphIndex + position.y)\n);\n\nposition = vec3(\n mix(aTroikaGlyphBounds.x, aTroikaGlyphBounds.z, position.x),\n mix(aTroikaGlyphBounds.y, aTroikaGlyphBounds.w, position.y),\n position.z\n);\nvTroikaLocalPos = vec3(position);\n\nuv = vec2(\n (position.x - uTroikaTotalBounds.x) / (uTroikaTotalBounds.z - uTroikaTotalBounds.x),\n (position.y - uTroikaTotalBounds.y) / (uTroikaTotalBounds.w - uTroikaTotalBounds.y)\n);\n", | ||
fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform float uTroikaSDFMinDistancePct;\nuniform bool uTroikaSDFDebug;\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n\nvoid troikaApplyClipping() {\n vec4 rect = uTroikaClipRect;\n vec3 pos = vTroikaLocalPos;\n if (rect != vec4(.0,.0,.0,.0) && (\n pos.x < min(rect.x, rect.z) || \n pos.y < min(rect.y, rect.w) ||\n pos.x > max(rect.x, rect.z) ||\n pos.y > max(rect.y, rect.w)\n )) {\n discard;\n }\n}\n", | ||
fragmentColorTransform:"\ntroikaApplyClipping();\n\nfloat troikaSDFValue = texture2D(uTroikaSDFTexture, vTroikaGlyphUV).r;\n\n#if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\nif (troikaSDFValue < 0.5) discard;\n#else\n\n\n#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float troikaAntiAliasDist = min(\n 0.5,\n 0.5 * min(\n fwidth(vTroikaGlyphUV.x), \n fwidth(vTroikaGlyphUV.y / uTroikaGlyphVSize)\n )\n ) / uTroikaSDFMinDistancePct;\n#else\n float troikaAntiAliasDist = 0.01;\n#endif\n\nfloat textAlphaMult = uTroikaSDFDebug ? troikaSDFValue : smoothstep(\n 0.5 - troikaAntiAliasDist,\n 0.5 + troikaAntiAliasDist,\n troikaSDFValue\n);\nif (textAlphaMult == 0.0) {\n if (uTroikaSDFDebug) {\n gl_FragColor *= 0.5;\n } else {\n discard;\n }\n} else {\n gl_FragColor.a *= textAlphaMult;\n}\n\n#endif\n"}); | ||
'use strict';(function(C,z){"object"===typeof exports&&"undefined"!==typeof module?z(exports,require("three"),require("troika-worker-utils"),require("troika-three-utils")):"function"===typeof define&&define.amd?define(["exports","three","troika-worker-utils","troika-three-utils"],z):(C=C||self,z(C.troika_3d_text={},C.THREE,C.troika_worker_utils,C.troika_three_utils))})(this,function(C,z,F,Q){function R(r,g){r=J({},r);K.href=r.font||I.defaultFontURL;r.font=K.href;r.text=""+r.text;var b=I.sdfGlyphSize, | ||
a=L[r.font];a||(a=L[r.font]={sdfTexture:new z.DataTexture(new Uint8Array(b*b*64),b,64*b,z.LuminanceFormat,void 0,void 0,void 0,void 0,z.LinearFilter,z.LinearFilter)},a.sdfTexture.font=r.font);S(r).then(function(c){c.newGlyphSDFs&&(c.newGlyphSDFs.forEach(function(c){var d=c.textureData,f=a.sdfTexture.image;for(c=c.atlasIndex*b*b;c>f.data.length-1;){var g=new Uint8Array(2*f.data.length);g.set(f.data);f.data=g;f.height*=2}f.data.set(d,c)}),a.sdfTexture.needsUpdate=!0);g({sdfTexture:a.sdfTexture,sdfMinDistancePercent:.125, | ||
glyphBounds:c.glyphBounds,glyphIndices:c.glyphIndices,totalBounds:c.totalBounds,totalBlockSize:c.totalBlockSize})})}function J(r,g){for(var b in g)g.hasOwnProperty(b)&&(r[b]=g[b]);return r}function M(r,g,b,a){var c=r.getAttribute(g);c&&c.array.length===b.length?(c.array.set(b),c.needsUpdate=!0):r.setAttribute(g,new z.InstancedBufferAttribute(b,a))}function T(r){r=Q.createDerivedMaterial(r,{extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFMinDistancePct:{value:0},uTroikaGlyphVSize:{value:0}, | ||
uTroikaTotalBounds:{value:new z.Vector4},uTroikaClipRect:{value:new z.Vector4},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaTotalBounds;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n",vertexTransform:"\nvTroikaGlyphUV = vec2(\n position.x,\n uTroikaGlyphVSize * (aTroikaGlyphIndex + position.y)\n);\n\nposition = vec3(\n mix(aTroikaGlyphBounds.x, aTroikaGlyphBounds.z, position.x),\n mix(aTroikaGlyphBounds.y, aTroikaGlyphBounds.w, position.y),\n position.z\n);\nvTroikaLocalPos = vec3(position);\n\nuv = vec2(\n (position.x - uTroikaTotalBounds.x) / (uTroikaTotalBounds.z - uTroikaTotalBounds.x),\n (position.y - uTroikaTotalBounds.y) / (uTroikaTotalBounds.w - uTroikaTotalBounds.y)\n);\n", | ||
fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform float uTroikaSDFMinDistancePct;\nuniform bool uTroikaSDFDebug;\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n\nfloat troikaGetClipAlpha() {\n vec4 clip = uTroikaClipRect;\n vec3 pos = vTroikaLocalPos;\n float dClip = min(\n min(pos.x - min(clip.x, clip.z), max(clip.x, clip.z) - pos.x),\n min(pos.y - min(clip.y, clip.w), max(clip.y, clip.w) - pos.y)\n );\n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aa = length(fwidth(pos)) * 0.5;\n return smoothstep(-aa, aa, dClip);\n #else\n return step(0.0, dClip);\n #endif\n}\n", | ||
fragmentColorTransform:"\nfloat troikaSDFValue = texture2D(uTroikaSDFTexture, vTroikaGlyphUV).r;\n\n#if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\nif (troikaSDFValue < 0.5) discard;\n#else\n\n\n#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float troikaAntiAliasDist = min(\n 0.5,\n 0.5 * min(\n fwidth(vTroikaGlyphUV.x), \n fwidth(vTroikaGlyphUV.y / uTroikaGlyphVSize)\n )\n ) / uTroikaSDFMinDistancePct;\n#else\n float troikaAntiAliasDist = 0.01;\n#endif\n\nfloat textAlphaMult = uTroikaSDFDebug ? troikaSDFValue : smoothstep(\n 0.5 - troikaAntiAliasDist,\n 0.5 + troikaAntiAliasDist,\n troikaSDFValue\n);\n\ntextAlphaMult = min(textAlphaMult, troikaGetClipAlpha());\n\nif (textAlphaMult == 0.0) {\n if (uTroikaSDFDebug) {\n gl_FragColor *= 0.5;\n } else {\n discard;\n }\n} else {\n gl_FragColor.a *= textAlphaMult;\n}\n\n#endif\n"}); | ||
r.transparent=!0;Object.defineProperty(r,"shadowSide",{get:function(){return this.side}});return r}var G=F.defineWorkerModule({dependencies:[function(){var r=self,g={parse:function(b){var a=g._bin;b=new Uint8Array(b);if("ttcf"==a.readASCII(b,0,4)){var c=4;a.readUshort(b,c);c+=2;a.readUshort(b,c);c+=2;var d=a.readUint(b,c);c+=4;for(var e=[],f=0;f<d;f++){var h=a.readUint(b,c);c+=4;e.push(g._readFont(b,h))}return e}return[g._readFont(b,0)]},_readFont:function(b,a){var c=g._bin,d=a;c.readFixed(b,a);a+= | ||
@@ -94,4 +94,4 @@ 4;var e=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;var f="cmap;head;hhea;maxp;hmtx;name;OS/2;post;loca;glyf;kern;CFF ;GPOS;GSUB;SVG ".split(";");d={_data:b,_offset:d};for(var h={},k=0;k<e;k++){var l=c.readASCII(b,a,4);a+=4;c.readUint(b,a);a+=4;var q=c.readUint(b,a);a+=4;var u=c.readUint(b,a);a+=4;h[l]={offset:q,length:u}}for(k=0;k<f.length;k++)a=f[k],h[a]&&(d[a.trim()]=g[a.trim()].parse(b,h[a].offset,h[a].length,d));return d},_tabOffset:function(b, | ||
p[b++];a.apply(null,d)}}}}u.call(null,g,k);g.advanceWidth&&(k+=g.advanceWidth*l);h&&(k+=h*e)}});return k}};return g}function a(a,b){var c=a.glyphToUnicodeMap;if(!c){c=a.glyphToUnicodeMap=Object.create(null);var d=a.cmap,e=-1;null!=d.p0e4?e=d.p0e4:null!=d.p3e1?e=d.p3e1:null!=d.p1e0?e=d.p1e0:null!=d.p0e3&&(e=d.p0e3);if(-1===e)throw"no familiar platform and encoding!";e=d.tables[e];if(0===e.format)for(a=0;a<e.map.length;a++)c[e.map[a]]=a;else if(4===e.format){d=e.startCount;e=e.endCount;for(var g=0;g< | ||
d.length;g++)for(var q=d[g];q<=e[g];q++)c[r.U.codeToGlyph(a,q)]=q}else if(12===e.format)e.groups.forEach(function(a){var b=a[1],d=a[2];for(a=a[0];a<=b;a++)c[d++]=a});else throw"unknown cmap table format "+e.format;}return c[b]||0}var c={M:2,L:2,Q:4,C:6,Z:0};return function(a){var c=new Uint8Array(a,0,4);c=r._bin.readASCII(c,0,4);if("wOFF"===c)a=g(a);else if("wOF2"===c)throw Error("woff2 fonts not supported");return b(r.parse(a))}}],init:function(r,g,b){r=r();g=g();return b(r,g)}}),H={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff", | ||
sdfGlyphSize:64},K=document.createElement("a"),L=Object.create(null);G=F.defineWorkerModule({dependencies:[H,.125,G,function(r){function g(a){return a*a}var b=r.sdfTextureSize,a=r.sdfDistancePercent,c=function(a){var b=a.xMin,c=a.yMin,d=a.xMax-b;a=a.yMax-c;this._root={0:null,1:null,2:null,3:null,data:null,cx:Math.round(b+d/2),cy:Math.round(c+a/2),r:Math.pow(2,Math.floor(Math.log(Math.max(d,a))*Math.LOG2E)),minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity}};c.prototype.addLineSegment=function(a, | ||
d.length;g++)for(var q=d[g];q<=e[g];q++)c[r.U.codeToGlyph(a,q)]=q}else if(12===e.format)e.groups.forEach(function(a){var b=a[1],d=a[2];for(a=a[0];a<=b;a++)c[d++]=a});else throw"unknown cmap table format "+e.format;}return c[b]||0}var c={M:2,L:2,Q:4,C:6,Z:0};return function(a){var c=new Uint8Array(a,0,4);c=r._bin.readASCII(c,0,4);if("wOFF"===c)a=g(a);else if("wOF2"===c)throw Error("woff2 fonts not supported");return b(r.parse(a))}}],init:function(r,g,b){r=r();g=g();return b(r,g)}}),I={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff", | ||
sdfGlyphSize:64},K=document.createElement("a"),L=Object.create(null);G=F.defineWorkerModule({dependencies:[I,.125,G,function(r){function g(a){return a*a}var b=r.sdfTextureSize,a=r.sdfDistancePercent,c=function(a){var b=a.xMin,c=a.yMin,d=a.xMax-b;a=a.yMax-c;this._root={0:null,1:null,2:null,3:null,data:null,cx:Math.round(b+d/2),cy:Math.round(c+a/2),r:Math.pow(2,Math.floor(Math.log(Math.max(d,a))*Math.LOG2E)),minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity}};c.prototype.addLineSegment=function(a, | ||
b,c,g){this._insertSegment({x0:a,y0:b,x1:c,y1:g,cx:(a+c)/2,cy:(b+g)/2,minX:Math.min(a,c),minY:Math.min(b,g),maxX:Math.max(a,c),maxY:Math.max(b,g),next:null},this._root)};c.prototype._insertSegment=function(a,b){var c=a.minX,d=a.minY,e=a.maxX,g=a.maxY,q=a.cx,u=a.cy;c<b.minX&&(b.minX=c);d<b.minY&&(b.minY=d);e>b.maxX&&(b.maxX=e);g>b.maxY&&(b.maxY=g);var m=b.data;if(m)if(m.cx===q&&m.cy===u){for(;m.next;)m=m.next;m.next=a}else b.data=null,this._insertSegment(m,b),this._insertSegment(a,b);else q=(u<b.cy? | ||
@@ -106,13 +106,14 @@ 0:2)+(q<b.cx?0:1),b[q]?this._insertSegment(a,b[q]):b[q]={0:null,1:null,2:null,3:null,data:a,cx:b.cx+b.r/2*(q%2?1:-1),cy:b.cy+b.r/2*(2>q?-1:1),r:b.r/2,minX:c,minY:d,maxX:e,maxY:g}};c.prototype.walkTree=function(a){this.walkBranch(this._root,a)};c.prototype.walkBranch=function(a,b){if(!1!==b(a)&&!a.data)for(var c=0;4>c;c++)null!==a[c]&&this.walkBranch(a[c],b)};c.prototype.findNearestSignedDistance=function(a,b,c){var d=c;this.walkTree(function(c){if(a-d>c.maxX||a+d<c.minX||b-d>c.maxY||b+d<c.minY)return!1; | ||
1].isWhitespace){var l=[];b=-d}else for(var m=c.length;m--;)if(0===m&&"break-word"===A){l=[];b=-d;break}else if(c[m].isWhitespace){l=c.splice(m+1);m=l[0].x;b-=m;for(var n=0;n<l.length;n++)l[n].x-=m;break}if(l){for(;c[c.length-1].isWhitespace;)c.pop();e.push(c=l);u=r}}c.push({glyphObj:a,x:d+b,y:0,width:h,char:g,isWhitespace:k,isEmpty:a.xMin===a.xMax||a.yMin===a.yMax,atlasInfo:null})});for(a=0;a<e.length&&u<r;a++){var g=e[a];g.length&&(g=g[g.length-1],u=Math.max(u,g.x+g.width))}t+=e.length;return e}); | ||
if(!c){var F=[],H=-(k+C);D.forEach(function(b){for(var c=0;c<b.length;c++){var d=b[c];if(d.length){var e=0,f=d[d.length-1];f=f.x+f.width;var k=0;if("center"===v)e=(u-f)/2;else if("right"===v)e=u-f;else if("justify"===v)for(var l=0,m=d.length;l<m;l++)d[l].isWhitespace&&k++;l=0;for(m=d.length;l<m;l++){var n=d[l];n.isWhitespace&&"justify"===v&&c!==b.length-1&&(e+=(u-f)/k);if(!n.isWhitespace&&!n.isEmpty){var p=n.glyphObj,r=a.glyphs[p.index];r||(r=g(p),r.atlasIndex=a.glyphCount++,h||(h=[]),h.push(r),r= | ||
a.glyphs[p.index]={atlasIndex:r.atlasIndex,glyphObj:p,renderingBounds:r.renderingBounds});n.atlasInfo=r;e&&(n.x+=e);n.y=H;F.push(n)}}}H-=q}});var G=0,I=0;z&&(z[0]&&(G=-u*z[0]),z[1]&&(I=t*q*z[1]));m=new Float32Array(4*F.length);n=new Float32Array(F.length);p=[Infinity,Infinity,-Infinity,-Infinity];F.forEach(function(a,b){var c=a.atlasInfo,d=c.renderingBounds;c=c.atlasIndex;var e=m[4*b]=a.x+d[0]*B+G,f=m[4*b+1]=a.y+d[1]*B+I,g=m[4*b+2]=a.x+d[2]*B+G;a=m[4*b+3]=a.y+d[3]*B+I;e<p[0]&&(p[0]=e);f<p[1]&&(p[1]= | ||
f);g>p[2]&&(p[2]=g);a>p[3]&&(p[3]=a);n[b]=c})}b({glyphBounds:m,glyphIndices:n,totalBounds:p,totalBlockSize:[u,t*q],newGlyphSDFs:h})})}var f=b.defaultFontUrl,h=Object.create(null);return{process:e,measure:function(a,b){e(a,function(a){b({width:a.totalBlockSize[0],height:a.totalBlockSize[1]})},!0)},loadFont:c}}],init:function(r,g,b,a,c){g=a({sdfTextureSize:r.sdfGlyphSize,sdfDistancePercent:g});return c(b,g,{defaultFontUrl:r.defaultFontURL})}});var T=F.defineWorkerModule({dependencies:[G,F.ThenableWorkerModule], | ||
init:function(r,g){return function(b){var a=new g;r.process(b,a.resolve);return a}},getTransferables:function(r){var g=[r.glyphBounds.buffer,r.glyphIndices.buffer];r.newGlyphSDFs&&r.newGlyphSDFs.forEach(function(b){g.push(b.textureData.buffer)});return g}}),V=(new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),W=new z.Vector3,N=function(r){function g(){r.call(this);this.copy(V);this.addAttribute("aTroikaGlyphBounds",new z.InstancedBufferAttribute(new Float32Array(0),4));this.addAttribute("aTroikaGlyphIndex", | ||
new z.InstancedBufferAttribute(new Float32Array(0),1));this.boundingSphere=new z.Sphere}r&&(g.__proto__=r);g.prototype=Object.create(r&&r.prototype);g.prototype.constructor=g;g.prototype.computeBoundingSphere=function(){};g.prototype.updateGlyphs=function(b,a,c){M(this.attributes.aTroikaGlyphBounds,b);M(this.attributes.aTroikaGlyphIndex,a);this.maxInstancedCount=a.length;b=this.boundingSphere;b.center.set((c[0]+c[2])/2,(c[1]+c[3])/2,0);b.radius=b.center.distanceTo(W.set(c[0],c[1],0))};return g}(z.InstancedBufferGeometry), | ||
O=new z.MeshBasicMaterial({color:16777215,side:z.DoubleSide,transparent:!0}),X=Object.freeze([0,0,0,0]),Y=new z.Matrix4,P=new z.Mesh((new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),O),Q=function(r){function g(a){a=new N;r.call(this,a,null);this.text="";this.font=this.anchor=null;this.fontSize=.1;this.letterSpacing=0;this.lineHeight="normal";this.maxWidth=Infinity;this.overflowWrap="normal";this.textAlign="left";this.whiteSpace="normal";this.color=this.material=null;this.depthOffset=0;this.clipRect= | ||
null;this.debugSDF=!1}r&&(g.__proto__=r);g.prototype=Object.create(r&&r.prototype);g.prototype.constructor=g;var b={material:{configurable:!0},customDepthMaterial:{configurable:!0},customDistanceMaterial:{configurable:!0}};g.prototype.sync=function(a){var b=this;this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(a):(this._isSyncing=!0,S({text:this.text,font:this.font,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight, | ||
if(!c){var F=[],I=-(k+C);D.forEach(function(b){for(var c=0;c<b.length;c++){var d=b[c];if(d.length){var e=0,f=d[d.length-1];f=f.x+f.width;var k=0;if("center"===v)e=(u-f)/2;else if("right"===v)e=u-f;else if("justify"===v)for(var l=0,m=d.length;l<m;l++)d[l].isWhitespace&&k++;l=0;for(m=d.length;l<m;l++){var n=d[l];n.isWhitespace&&"justify"===v&&c!==b.length-1&&(e+=(u-f)/k);if(!n.isWhitespace&&!n.isEmpty){var p=n.glyphObj,r=a.glyphs[p.index];r||(r=g(p),r.atlasIndex=a.glyphCount++,h||(h=[]),h.push(r),r= | ||
a.glyphs[p.index]={atlasIndex:r.atlasIndex,glyphObj:p,renderingBounds:r.renderingBounds});n.atlasInfo=r;e&&(n.x+=e);n.y=I;F.push(n)}}}I-=q}});var G=0,H=0;z&&(z[0]&&(G=-u*z[0]),z[1]&&(H=t*q*z[1]));m=new Float32Array(4*F.length);n=new Float32Array(F.length);p=[Infinity,Infinity,-Infinity,-Infinity];F.forEach(function(a,b){var c=a.atlasInfo,d=c.renderingBounds;c=c.atlasIndex;var e=m[4*b]=a.x+d[0]*B+G,f=m[4*b+1]=a.y+d[1]*B+H,g=m[4*b+2]=a.x+d[2]*B+G;a=m[4*b+3]=a.y+d[3]*B+H;e<p[0]&&(p[0]=e);f<p[1]&&(p[1]= | ||
f);g>p[2]&&(p[2]=g);a>p[3]&&(p[3]=a);n[b]=c})}b({glyphBounds:m,glyphIndices:n,totalBounds:p,totalBlockSize:[u,t*q],newGlyphSDFs:h})})}var f=b.defaultFontUrl,h=Object.create(null);return{process:e,measure:function(a,b){e(a,function(a){b({width:a.totalBlockSize[0],height:a.totalBlockSize[1]})},!0)},loadFont:c}}],init:function(r,g,b,a,c){g=a({sdfTextureSize:r.sdfGlyphSize,sdfDistancePercent:g});return c(b,g,{defaultFontUrl:r.defaultFontURL})}});var S=F.defineWorkerModule({dependencies:[G,F.ThenableWorkerModule], | ||
init:function(r,g){return function(b){var a=new g;r.process(b,a.resolve);return a}},getTransferables:function(r){var g=[r.glyphBounds.buffer,r.glyphIndices.buffer];r.newGlyphSDFs&&r.newGlyphSDFs.forEach(function(b){g.push(b.textureData.buffer)});return g}}),U=(new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),V=new z.Vector3,H=function(r){function g(){r.call(this);this.copy(U);this.boundingSphere=new z.Sphere}r&&(g.__proto__=r);g.prototype=Object.create(r&&r.prototype);g.prototype.constructor=g; | ||
g.prototype.computeBoundingSphere=function(){};g.prototype.updateGlyphs=function(b,a,c){M(this,"aTroikaGlyphBounds",b,4);M(this,"aTroikaGlyphIndex",a,1);this.maxInstancedCount=a.length;b=this.boundingSphere;b.center.set((c[0]+c[2])/2,(c[1]+c[3])/2,0);b.radius=b.center.distanceTo(V.set(c[0],c[1],0))};return g}(z.InstancedBufferGeometry);H.prototype.setAttribute||(H.prototype.setAttribute=function(r,g){this.attributes[r]=g;return this});var N=new z.MeshBasicMaterial({color:16777215,side:z.DoubleSide, | ||
transparent:!0});Object.freeze([-Infinity,-Infinity,Infinity,Infinity]);var W=new z.Matrix4;new z.Plane;new z.Vector3;var O=new z.Mesh((new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),N),P=function(r){function g(a){a=new H;r.call(this,a,null);this.text="";this.font=this.anchor=null;this.fontSize=.1;this.letterSpacing=0;this.lineHeight="normal";this.maxWidth=Infinity;this.overflowWrap="normal";this.textAlign="left";this.whiteSpace="normal";this.color=this.material=null;this.depthOffset=0;this.clipRect= | ||
null;this.debugSDF=!1}r&&(g.__proto__=r);g.prototype=Object.create(r&&r.prototype);g.prototype.constructor=g;var b={material:{configurable:!0},customDepthMaterial:{configurable:!0},customDistanceMaterial:{configurable:!0}};g.prototype.sync=function(a){var b=this;this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(a):(this._isSyncing=!0,R({text:this.text,font:this.font,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight, | ||
maxWidth:this.maxWidth,textAlign:this.textAlign,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchor:this.anchor},function(c){b._isSyncing=!1;b._textRenderInfo=c;b.geometry.updateGlyphs(c.glyphBounds,c.glyphIndices,c.totalBounds);var d=b._queuedSyncs;d&&(b._queuedSyncs=null,b._needsSync=!0,b.sync(function(){d.forEach(function(a){return a&&a()})}));a&&a()})))};g.prototype.onBeforeRender=function(){this.sync();this._prepareMaterial()};g.prototype.dispose=function(){this.geometry.dispose()}; | ||
b.material.get=function(){var a=this._derivedMaterial,b=this._baseMaterial||O;a&&a.baseMaterial===b||(a&&a.dispose(),a=this._derivedMaterial=U(b),b.addEventListener("dispose",function e(){b.removeEventListener("dispose",e);a.dispose()}));return a};b.material.set=function(a){this._baseMaterial=a};b.customDepthMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDepthMaterial())};b.customDistanceMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDistanceMaterial())}; | ||
g.prototype._prepareMaterial=function(){var a=this._derivedMaterial;this._updateLayoutUniforms(a);a.uniforms.uTroikaSDFDebug.value=!!this.debugSDF;a.polygonOffset=!!this.depthOffset;a.polygonOffsetFactor=a.polygonOffsetUnits=this.depthOffset||0;var b=this.color;null!=b&&a.color&&a.color.isColor&&b!==a._troikaColor&&a.color.set(a._troikaColor=b)};g.prototype._updateLayoutUniforms=function(a){var b=this._textRenderInfo,d=a.uniforms;if(b){var e=b.sdfTexture;d.uTroikaSDFTexture.value=e;d.uTroikaSDFMinDistancePct.value= | ||
b.sdfMinDistancePercent;d.uTroikaGlyphVSize.value=e.image.width/e.image.height;d.uTroikaTotalBounds.value.fromArray(b.totalBounds)}(b=this.clipRect)&&Array.isArray(b)&&4===b.length||(b=X);d.uTroikaClipRect.value.fromArray(b);return a};g.prototype.raycast=function(a,b){var c=this._textRenderInfo;c&&(c=c.totalBounds,P.matrixWorld.multiplyMatrices(this.matrixWorld,Y.set(c[2]-c[0],0,0,c[0],0,c[3]-c[1],0,c[1],0,0,1,0,0,0,0,1)),P.raycast(a,b))};Object.defineProperties(g.prototype,b);return g}(z.Mesh);"font fontSize letterSpacing lineHeight maxWidth overflowWrap text textAlign whiteSpace anchor".split(" ").forEach(function(r){var g= | ||
"_private_"+r;Object.defineProperty(Q.prototype,r,{get:function(){return this[g]},set:"anchor"===r?function(b){JSON.stringify(b)!==JSON.stringify(this[g])&&(this[g]=b,this._needsSync=!0)}:function(b){b!==this[g]&&(this[g]=b,this._needsSync=!0)}})});C.GlyphsGeometry=N;C.TextMesh=Q;C.configureTextBuilder=function(r){J(H,r)};C.fontProcessorWorkerModule=G;Object.defineProperty(C,"__esModule",{value:!0})}); | ||
b.material.get=function(){var a=this._derivedMaterial,b=this._baseMaterial||N;a&&a.baseMaterial===b||(a&&a.dispose(),a=this._derivedMaterial=T(b),b.addEventListener("dispose",function e(){b.removeEventListener("dispose",e);a.dispose()}));return a};b.material.set=function(a){this._baseMaterial=a};b.customDepthMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDepthMaterial())};b.customDistanceMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDistanceMaterial())}; | ||
g.prototype._prepareMaterial=function(){var a=this._derivedMaterial;this._updateLayoutUniforms(a);a.uniforms.uTroikaSDFDebug.value=!!this.debugSDF;a.polygonOffset=!!this.depthOffset;a.polygonOffsetFactor=a.polygonOffsetUnits=this.depthOffset||0;var b=this.color;null!=b&&a.color&&a.color.isColor&&b!==a._troikaColor&&a.color.set(a._troikaColor=b)};g.prototype._updateLayoutUniforms=function(a){var b=this._textRenderInfo,d=a.uniforms;if(b){var e=b.sdfTexture,f=b.totalBounds;d.uTroikaSDFTexture.value= | ||
e;d.uTroikaSDFMinDistancePct.value=b.sdfMinDistancePercent;d.uTroikaGlyphVSize.value=e.image.width/e.image.height;d.uTroikaTotalBounds.value.fromArray(f);(b=this.clipRect)&&Array.isArray(b)&&4===b.length?d.uTroikaClipRect.value.set(Math.max(f[0],b[0]),Math.max(f[1],b[1]),Math.min(f[2],b[2]),Math.min(f[3],b[3])):d.uTroikaClipRect.value.fromArray(f)}return a};g.prototype.raycast=function(a,b){var c=this._textRenderInfo;c&&(c=c.totalBounds,O.matrixWorld.multiplyMatrices(this.matrixWorld,W.set(c[2]-c[0], | ||
0,0,c[0],0,c[3]-c[1],0,c[1],0,0,1,0,0,0,0,1)),O.raycast(a,b))};Object.defineProperties(g.prototype,b);return g}(z.Mesh);"font fontSize letterSpacing lineHeight maxWidth overflowWrap text textAlign whiteSpace anchor".split(" ").forEach(function(r){var g="_private_"+r;Object.defineProperty(P.prototype,r,{get:function(){return this[g]},set:"anchor"===r?function(b){JSON.stringify(b)!==JSON.stringify(this[g])&&(this[g]=b,this._needsSync=!0)}:function(b){b!==this[g]&&(this[g]=b,this._needsSync=!0)}})}); | ||
C.GlyphsGeometry=H;C.TextMesh=P;C.configureTextBuilder=function(r){J(I,r)};C.fontProcessorWorkerModule=G;Object.defineProperty(C,"__esModule",{value:!0})}); |
@@ -1,118 +0,118 @@ | ||
'use strict';(function(C,y){"object"===typeof exports&&"undefined"!==typeof module?y(exports,require("three"),require("troika-worker-utils"),require("troika-three-utils"),require("troika-3d")):"function"===typeof define&&define.amd?define(["exports","three","troika-worker-utils","troika-three-utils","troika-3d"],y):(C=C||self,y(C.troika_3d_text={},C.THREE,C.troika_worker_utils,C.troika_three_utils,C.troika_3d))})(this,function(C,y,F,R,S){function T(l,f){l=K({},l);L.href=l.font||I.defaultFontURL;l.font= | ||
L.href;l.text=""+l.text;var b=I.sdfGlyphSize,a=M[l.font];a||(a=M[l.font]={sdfTexture:new y.DataTexture(new Uint8Array(b*b*64),b,64*b,y.LuminanceFormat,void 0,void 0,void 0,void 0,y.LinearFilter,y.LinearFilter)},a.sdfTexture.font=l.font);U(l).then(function(c){c.newGlyphSDFs&&(c.newGlyphSDFs.forEach(function(c){var d=c.textureData,g=a.sdfTexture.image;for(c=c.atlasIndex*b*b;c>g.data.length-1;){var f=new Uint8Array(2*g.data.length);f.set(g.data);g.data=f;g.height*=2}g.data.set(d,c)}),a.sdfTexture.needsUpdate= | ||
!0);f({sdfTexture:a.sdfTexture,sdfMinDistancePercent:.125,glyphBounds:c.glyphBounds,glyphIndices:c.glyphIndices,totalBounds:c.totalBounds,totalBlockSize:c.totalBlockSize})})}function K(l,f){for(var b in f)f.hasOwnProperty(b)&&(l[b]=f[b]);return l}function N(l,f){l.array.length===f.length?l.array.set(f):l.setArray(f);l.needsUpdate=!0}function V(l){l=R.createDerivedMaterial(l,{extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFMinDistancePct:{value:0},uTroikaGlyphVSize:{value:0}, | ||
uTroikaTotalBounds:{value:new y.Vector4},uTroikaClipRect:{value:new y.Vector4},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaTotalBounds;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n",vertexTransform:"\nvTroikaGlyphUV = vec2(\n position.x,\n uTroikaGlyphVSize * (aTroikaGlyphIndex + position.y)\n);\n\nposition = vec3(\n mix(aTroikaGlyphBounds.x, aTroikaGlyphBounds.z, position.x),\n mix(aTroikaGlyphBounds.y, aTroikaGlyphBounds.w, position.y),\n position.z\n);\nvTroikaLocalPos = vec3(position);\n\nuv = vec2(\n (position.x - uTroikaTotalBounds.x) / (uTroikaTotalBounds.z - uTroikaTotalBounds.x),\n (position.y - uTroikaTotalBounds.y) / (uTroikaTotalBounds.w - uTroikaTotalBounds.y)\n);\n", | ||
fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform float uTroikaSDFMinDistancePct;\nuniform bool uTroikaSDFDebug;\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n\nvoid troikaApplyClipping() {\n vec4 rect = uTroikaClipRect;\n vec3 pos = vTroikaLocalPos;\n if (rect != vec4(.0,.0,.0,.0) && (\n pos.x < min(rect.x, rect.z) || \n pos.y < min(rect.y, rect.w) ||\n pos.x > max(rect.x, rect.z) ||\n pos.y > max(rect.y, rect.w)\n )) {\n discard;\n }\n}\n", | ||
fragmentColorTransform:"\ntroikaApplyClipping();\n\nfloat troikaSDFValue = texture2D(uTroikaSDFTexture, vTroikaGlyphUV).r;\n\n#if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\nif (troikaSDFValue < 0.5) discard;\n#else\n\n\n#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float troikaAntiAliasDist = min(\n 0.5,\n 0.5 * min(\n fwidth(vTroikaGlyphUV.x), \n fwidth(vTroikaGlyphUV.y / uTroikaGlyphVSize)\n )\n ) / uTroikaSDFMinDistancePct;\n#else\n float troikaAntiAliasDist = 0.01;\n#endif\n\nfloat textAlphaMult = uTroikaSDFDebug ? troikaSDFValue : smoothstep(\n 0.5 - troikaAntiAliasDist,\n 0.5 + troikaAntiAliasDist,\n troikaSDFValue\n);\nif (textAlphaMult == 0.0) {\n if (uTroikaSDFDebug) {\n gl_FragColor *= 0.5;\n } else {\n discard;\n }\n} else {\n gl_FragColor.a *= textAlphaMult;\n}\n\n#endif\n"}); | ||
l.transparent=!0;Object.defineProperty(l,"shadowSide",{get:function(){return this.side}});return l}var H=F.defineWorkerModule({dependencies:[function(){var l=self,f={parse:function(b){var a=f._bin;b=new Uint8Array(b);if("ttcf"==a.readASCII(b,0,4)){var c=4;a.readUshort(b,c);c+=2;a.readUshort(b,c);c+=2;var d=a.readUint(b,c);c+=4;for(var e=[],g=0;g<d;g++){var h=a.readUint(b,c);c+=4;e.push(f._readFont(b,h))}return e}return[f._readFont(b,0)]},_readFont:function(b,a){var c=f._bin,d=a;c.readFixed(b,a);a+= | ||
4;var e=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;var g="cmap;head;hhea;maxp;hmtx;name;OS/2;post;loca;glyf;kern;CFF ;GPOS;GSUB;SVG ".split(";");d={_data:b,_offset:d};for(var h={},k=0;k<e;k++){var n=c.readASCII(b,a,4);a+=4;c.readUint(b,a);a+=4;var t=c.readUint(b,a);a+=4;var u=c.readUint(b,a);a+=4;h[n]={offset:t,length:u}}for(k=0;k<g.length;k++)a=g[k],h[a]&&(d[a.trim()]=f[a.trim()].parse(b,h[a].offset,h[a].length,d));return d},_tabOffset:function(b, | ||
a,c){var d=f._bin,e=d.readUshort(b,c+4);c+=12;for(var g=0;g<e;g++){var h=d.readASCII(b,c,4);c+=4;d.readUint(b,c);c+=4;var k=d.readUint(b,c);c+=4;d.readUint(b,c);c+=4;if(h==a)return k}return 0}};f._bin={readFixed:function(b,a){return(b[a]<<8|b[a+1])+(b[a+2]<<8|b[a+3])/65540},readF2dot14:function(b,a){return f._bin.readShort(b,a)/16384},readInt:function(b,a){var c=f._bin.t.uint8;c[0]=b[a+3];c[1]=b[a+2];c[2]=b[a+1];c[3]=b[a];return f._bin.t.int32[0]},readInt8:function(b,a){f._bin.t.uint8[0]=b[a];return f._bin.t.int8[0]}, | ||
readShort:function(b,a){var c=f._bin.t.uint8;c[1]=b[a];c[0]=b[a+1];return f._bin.t.int16[0]},readUshort:function(b,a){return b[a]<<8|b[a+1]},readUshorts:function(b,a,c){for(var d=[],e=0;e<c;e++)d.push(f._bin.readUshort(b,a+2*e));return d},readUint:function(b,a){var c=f._bin.t.uint8;c[3]=b[a];c[2]=b[a+1];c[1]=b[a+2];c[0]=b[a+3];return f._bin.t.uint32[0]},readUint64:function(b,a){return 4294967296*f._bin.readUint(b,a)+f._bin.readUint(b,a+4)},readASCII:function(b,a,c){for(var d="",e=0;e<c;e++)d+=String.fromCharCode(b[a+ | ||
e]);return d},readUnicode:function(b,a,c){for(var d="",e=0;e<c;e++){var g=b[a++]<<8|b[a++];d+=String.fromCharCode(g)}return d},_tdec:l.TextDecoder?new l.TextDecoder:null,readUTF8:function(b,a,c){var d=f._bin._tdec;return d&&0==a&&c==b.length?d.decode(b):f._bin.readASCII(b,a,c)},readBytes:function(b,a,c){for(var d=[],e=0;e<c;e++)d.push(b[a+e]);return d},readASCIIArray:function(b,a,c){for(var d=[],e=0;e<c;e++)d.push(String.fromCharCode(b[a+e]));return d}};f._bin.t={buff:new ArrayBuffer(8)};f._bin.t.int8= | ||
new Int8Array(f._bin.t.buff);f._bin.t.uint8=new Uint8Array(f._bin.t.buff);f._bin.t.int16=new Int16Array(f._bin.t.buff);f._bin.t.uint16=new Uint16Array(f._bin.t.buff);f._bin.t.int32=new Int32Array(f._bin.t.buff);f._bin.t.uint32=new Uint32Array(f._bin.t.buff);f._lctf={};f._lctf.parse=function(b,a,c,d,e){var g=f._bin;c={};d=a;g.readFixed(b,a);a+=4;var h=g.readUshort(b,a);a+=2;var k=g.readUshort(b,a);a=g.readUshort(b,a+2);c.scriptList=f._lctf.readScriptList(b,d+h);c.featureList=f._lctf.readFeatureList(b, | ||
d+k);c.lookupList=f._lctf.readLookupList(b,d+a,e);return c};f._lctf.readLookupList=function(b,a,c){var d=f._bin,e=a,g=[],h=d.readUshort(b,a);a+=2;for(var k=0;k<h;k++){var n=d.readUshort(b,a);a+=2;n=f._lctf.readLookupTable(b,e+n,c);g.push(n)}return g};f._lctf.readLookupTable=function(b,a,c){var d=f._bin,e=a,g={tabs:[]};g.ltype=d.readUshort(b,a);a+=2;g.flag=d.readUshort(b,a);a+=2;var h=d.readUshort(b,a);a+=2;for(var k=0;k<h;k++){var n=d.readUshort(b,a);a+=2;n=c(b,g.ltype,e+n);g.tabs.push(n)}return g}; | ||
f._lctf.numOfOnes=function(b){for(var a=0,c=0;32>c;c++)0!=(b>>>c&1)&&a++;return a};f._lctf.readClassDef=function(b,a){var c=f._bin,d=[],e=c.readUshort(b,a);a+=2;if(1==e){var g=c.readUshort(b,a);a+=2;var h=c.readUshort(b,a);a+=2;for(var k=0;k<h;k++)d.push(g+k),d.push(g+k),d.push(c.readUshort(b,a)),a+=2}if(2==e)for(e=c.readUshort(b,a),a+=2,k=0;k<e;k++)d.push(c.readUshort(b,a)),a+=2,d.push(c.readUshort(b,a)),a+=2,d.push(c.readUshort(b,a)),a+=2;return d};f._lctf.getInterval=function(b,a){for(var c=0;c< | ||
b.length;c+=3){var d=b[c+1];if(b[c]<=a&&a<=d)return c}return-1};f._lctf.readCoverage=function(b,a){var c=f._bin,d={};d.fmt=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;1==d.fmt&&(d.tab=c.readUshorts(b,a,e));2==d.fmt&&(d.tab=c.readUshorts(b,a,3*e));return d};f._lctf.coverageIndex=function(b,a){var c=b.tab;return 1==b.fmt?c.indexOf(a):2==b.fmt&&(b=f._lctf.getInterval(c,a),-1!=b)?c[b+2]+(a-c[b]):-1};f._lctf.readFeatureList=function(b,a){var c=f._bin,d=a,e=[],g=c.readUshort(b,a);a+=2;for(var h= | ||
0;h<g;h++){var k=c.readASCII(b,a,4);a+=4;var n=c.readUshort(b,a);a+=2;e.push({tag:k.trim(),tab:f._lctf.readFeatureTable(b,d+n)})}return e};f._lctf.readFeatureTable=function(b,a){var c=f._bin;c.readUshort(b,a);a+=2;var d=c.readUshort(b,a);a+=2;for(var e=[],g=0;g<d;g++)e.push(c.readUshort(b,a+2*g));return e};f._lctf.readScriptList=function(b,a){var c=f._bin,d=a,e={},g=c.readUshort(b,a);a+=2;for(var h=0;h<g;h++){var k=c.readASCII(b,a,4);a+=4;var n=c.readUshort(b,a);a+=2;e[k.trim()]=f._lctf.readScriptTable(b, | ||
d+n)}return e};f._lctf.readScriptTable=function(b,a){var c=f._bin,d=a,e={},g=c.readUshort(b,a);a+=2;e.default=f._lctf.readLangSysTable(b,d+g);g=c.readUshort(b,a);a+=2;for(var h=0;h<g;h++){var k=c.readASCII(b,a,4);a+=4;var n=c.readUshort(b,a);a+=2;e[k.trim()]=f._lctf.readLangSysTable(b,d+n)}return e};f._lctf.readLangSysTable=function(b,a){var c=f._bin,d={};c.readUshort(b,a);a+=2;d.reqFeature=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);d.features=c.readUshorts(b,a+2,e);return d};f.CFF={};f.CFF.parse= | ||
function(b,a,c){var d=f._bin;b=new Uint8Array(b.buffer,a,c);a=0;a++;a++;a++;a++;var e=[];a=f.CFF.readIndex(b,a,e);var g=[];for(c=0;c<e.length-1;c++)g.push(d.readASCII(b,a+e[c],e[c+1]-e[c]));a+=e[e.length-1];e=[];a=f.CFF.readIndex(b,a,e);g=[];for(c=0;c<e.length-1;c++)g.push(f.CFF.readDict(b,a+e[c],a+e[c+1]));a+=e[e.length-1];e=g[0];var h=[];a=f.CFF.readIndex(b,a,h);g=[];for(c=0;c<h.length-1;c++)g.push(d.readASCII(b,a+h[c],h[c+1]-h[c]));a+=h[h.length-1];f.CFF.readSubrs(b,a,e);if(e.CharStrings){a=e.CharStrings; | ||
h=[];a=f.CFF.readIndex(b,a,h);var k=[];for(c=0;c<h.length-1;c++)k.push(d.readBytes(b,a+h[c],h[c+1]-h[c]));e.CharStrings=k}if(e.ROS){a=e.FDArray;h=[];a=f.CFF.readIndex(b,a,h);e.FDArray=[];for(c=0;c<h.length-1;c++)k=f.CFF.readDict(b,a+h[c],a+h[c+1]),f.CFF._readFDict(b,k,g),e.FDArray.push(k);a=e.FDSelect;e.FDSelect=[];c=b[a];a++;if(3==c)for(h=d.readUshort(b,a),a+=2,c=0;c<h+1;c++)e.FDSelect.push(d.readUshort(b,a),b[a+2]),a+=3;else throw c;}e.Encoding&&(e.Encoding=f.CFF.readEncoding(b,e.Encoding,e.CharStrings.length)); | ||
e.charset&&(e.charset=f.CFF.readCharset(b,e.charset,e.CharStrings.length));f.CFF._readFDict(b,e,g);return e};f.CFF._readFDict=function(b,a,c){if(a.Private){var d=a.Private[1];a.Private=f.CFF.readDict(b,d,d+a.Private[0]);a.Private.Subrs&&f.CFF.readSubrs(b,d+a.Private.Subrs,a.Private)}for(var e in a)-1!="FamilyName FontName FullName Notice version Copyright".split(" ").indexOf(e)&&(a[e]=c[a[e]-426+35])};f.CFF.readSubrs=function(b,a,c){var d=f._bin,e=[];a=f.CFF.readIndex(b,a,e);var g=e.length;c.Bias= | ||
1240>g?107:33900>g?1131:32768;c.Subrs=[];for(g=0;g<e.length-1;g++)c.Subrs.push(d.readBytes(b,a+e[g],e[g+1]-e[g]))};f.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0];f.CFF.glyphByUnicode=function(b,a){for(var c=0;c<b.charset.length;c++)if(b.charset[c]==a)return c;return-1};f.CFF.glyphBySE=function(b,a){return 0>a||255<a?-1:f.CFF.glyphByUnicode(b, | ||
f.CFF.tableSE[a])};f.CFF.readEncoding=function(b,a,c){c=[".notdef"];var d=b[a];a++;if(0==d){d=b[a];a++;for(var e=0;e<d;e++)c.push(b[a+e])}else throw"error: unknown encoding format: "+d;return c};f.CFF.readCharset=function(b,a,c){var d=f._bin,e=[".notdef"],g=b[a];a++;if(0==g)for(var h=0;h<c;h++){var k=d.readUshort(b,a);a+=2;e.push(k)}else if(1==g||2==g)for(;e.length<c;){k=d.readUshort(b,a);a+=2;if(1==g){var n=b[a];a++}else n=d.readUshort(b,a),a+=2;for(h=0;h<=n;h++)e.push(k),k++}else throw"error: format: "+ | ||
g;return e};f.CFF.readIndex=function(b,a,c){var d=f._bin,e=d.readUshort(b,a)+1;a+=2;var g=b[a];a++;if(1==g)for(var h=0;h<e;h++)c.push(b[a+h]);else if(2==g)for(h=0;h<e;h++)c.push(d.readUshort(b,a+2*h));else if(3==g)for(h=0;h<e;h++)c.push(d.readUint(b,a+3*h-1)&16777215);else if(1!=e)throw"unsupported offset size: "+g+", count: "+e;return a+e*g-1};f.CFF.getCharString=function(b,a,c){var d=f._bin,e=b[a],g=b[a+1],h=1,k=null,n=null;20>=e&&(k=e,h=1);12==e&&(k=100*e+g,h=2);21<=e&&27>=e&&(k=e,h=1);28==e&& | ||
(n=d.readShort(b,a+1),h=3);29<=e&&31>=e&&(k=e,h=1);32<=e&&246>=e&&(n=e-139,h=1);247<=e&&250>=e&&(n=256*(e-247)+g+108,h=2);251<=e&&254>=e&&(n=256*-(e-251)-g-108,h=2);255==e&&(n=d.readInt(b,a+1)/65535,h=5);c.val=null!=n?n:"o"+k;c.size=h};f.CFF.readCharString=function(b,a,c){c=a+c;for(var d=f._bin,e=[];a<c;){var g=b[a],h=b[a+1],k=1,n=null,t=null;20>=g&&(n=g,k=1);12==g&&(n=100*g+h,k=2);if(19==g||20==g)n=g,k=2;21<=g&&27>=g&&(n=g,k=1);28==g&&(t=d.readShort(b,a+1),k=3);29<=g&&31>=g&&(n=g,k=1);32<=g&&246>= | ||
g&&(t=g-139,k=1);247<=g&&250>=g&&(t=256*(g-247)+h+108,k=2);251<=g&&254>=g&&(t=256*-(g-251)-h-108,k=2);255==g&&(t=d.readInt(b,a+1)/65535,k=5);e.push(null!=t?t:"o"+n);a+=k}return e};f.CFF.readDict=function(b,a,c){for(var d=f._bin,e={},g=[];a<c;){var h=b[a],k=b[a+1],n=1,t=null,u=null;28==h&&(u=d.readShort(b,a+1),n=3);29==h&&(u=d.readInt(b,a+1),n=5);32<=h&&246>=h&&(u=h-139,n=1);247<=h&&250>=h&&(u=256*(h-247)+k+108,n=2);251<=h&&254>=h&&(u=256*-(h-251)-k-108,n=2);if(255==h)throw d.readInt(b,a+1),"unknown number"; | ||
'use strict';(function(C,y){"object"===typeof exports&&"undefined"!==typeof module?y(exports,require("three"),require("troika-worker-utils"),require("troika-three-utils"),require("troika-3d")):"function"===typeof define&&define.amd?define(["exports","three","troika-worker-utils","troika-three-utils","troika-3d"],y):(C=C||self,y(C.troika_3d_text={},C.THREE,C.troika_worker_utils,C.troika_three_utils,C.troika_3d))})(this,function(C,y,F,R,S){function T(l,g){l=L({},l);M.href=l.font||J.defaultFontURL;l.font= | ||
M.href;l.text=""+l.text;var b=J.sdfGlyphSize,a=N[l.font];a||(a=N[l.font]={sdfTexture:new y.DataTexture(new Uint8Array(b*b*64),b,64*b,y.LuminanceFormat,void 0,void 0,void 0,void 0,y.LinearFilter,y.LinearFilter)},a.sdfTexture.font=l.font);U(l).then(function(c){c.newGlyphSDFs&&(c.newGlyphSDFs.forEach(function(c){var d=c.textureData,f=a.sdfTexture.image;for(c=c.atlasIndex*b*b;c>f.data.length-1;){var g=new Uint8Array(2*f.data.length);g.set(f.data);f.data=g;f.height*=2}f.data.set(d,c)}),a.sdfTexture.needsUpdate= | ||
!0);g({sdfTexture:a.sdfTexture,sdfMinDistancePercent:.125,glyphBounds:c.glyphBounds,glyphIndices:c.glyphIndices,totalBounds:c.totalBounds,totalBlockSize:c.totalBlockSize})})}function L(l,g){for(var b in g)g.hasOwnProperty(b)&&(l[b]=g[b]);return l}function O(l,g,b,a){var c=l.getAttribute(g);c&&c.array.length===b.length?(c.array.set(b),c.needsUpdate=!0):l.setAttribute(g,new y.InstancedBufferAttribute(b,a))}function V(l){l=R.createDerivedMaterial(l,{extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null}, | ||
uTroikaSDFMinDistancePct:{value:0},uTroikaGlyphVSize:{value:0},uTroikaTotalBounds:{value:new y.Vector4},uTroikaClipRect:{value:new y.Vector4},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaTotalBounds;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n",vertexTransform:"\nvTroikaGlyphUV = vec2(\n position.x,\n uTroikaGlyphVSize * (aTroikaGlyphIndex + position.y)\n);\n\nposition = vec3(\n mix(aTroikaGlyphBounds.x, aTroikaGlyphBounds.z, position.x),\n mix(aTroikaGlyphBounds.y, aTroikaGlyphBounds.w, position.y),\n position.z\n);\nvTroikaLocalPos = vec3(position);\n\nuv = vec2(\n (position.x - uTroikaTotalBounds.x) / (uTroikaTotalBounds.z - uTroikaTotalBounds.x),\n (position.y - uTroikaTotalBounds.y) / (uTroikaTotalBounds.w - uTroikaTotalBounds.y)\n);\n", | ||
fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform float uTroikaSDFMinDistancePct;\nuniform bool uTroikaSDFDebug;\nuniform float uTroikaGlyphVSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n\nfloat troikaGetClipAlpha() {\n vec4 clip = uTroikaClipRect;\n vec3 pos = vTroikaLocalPos;\n float dClip = min(\n min(pos.x - min(clip.x, clip.z), max(clip.x, clip.z) - pos.x),\n min(pos.y - min(clip.y, clip.w), max(clip.y, clip.w) - pos.y)\n );\n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aa = length(fwidth(pos)) * 0.5;\n return smoothstep(-aa, aa, dClip);\n #else\n return step(0.0, dClip);\n #endif\n}\n", | ||
fragmentColorTransform:"\nfloat troikaSDFValue = texture2D(uTroikaSDFTexture, vTroikaGlyphUV).r;\n\n#if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\nif (troikaSDFValue < 0.5) discard;\n#else\n\n\n#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float troikaAntiAliasDist = min(\n 0.5,\n 0.5 * min(\n fwidth(vTroikaGlyphUV.x), \n fwidth(vTroikaGlyphUV.y / uTroikaGlyphVSize)\n )\n ) / uTroikaSDFMinDistancePct;\n#else\n float troikaAntiAliasDist = 0.01;\n#endif\n\nfloat textAlphaMult = uTroikaSDFDebug ? troikaSDFValue : smoothstep(\n 0.5 - troikaAntiAliasDist,\n 0.5 + troikaAntiAliasDist,\n troikaSDFValue\n);\n\ntextAlphaMult = min(textAlphaMult, troikaGetClipAlpha());\n\nif (textAlphaMult == 0.0) {\n if (uTroikaSDFDebug) {\n gl_FragColor *= 0.5;\n } else {\n discard;\n }\n} else {\n gl_FragColor.a *= textAlphaMult;\n}\n\n#endif\n"}); | ||
l.transparent=!0;Object.defineProperty(l,"shadowSide",{get:function(){return this.side}});return l}var H=F.defineWorkerModule({dependencies:[function(){var l=self,g={parse:function(b){var a=g._bin;b=new Uint8Array(b);if("ttcf"==a.readASCII(b,0,4)){var c=4;a.readUshort(b,c);c+=2;a.readUshort(b,c);c+=2;var d=a.readUint(b,c);c+=4;for(var e=[],f=0;f<d;f++){var h=a.readUint(b,c);c+=4;e.push(g._readFont(b,h))}return e}return[g._readFont(b,0)]},_readFont:function(b,a){var c=g._bin,d=a;c.readFixed(b,a);a+= | ||
4;var e=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;var f="cmap;head;hhea;maxp;hmtx;name;OS/2;post;loca;glyf;kern;CFF ;GPOS;GSUB;SVG ".split(";");d={_data:b,_offset:d};for(var h={},k=0;k<e;k++){var n=c.readASCII(b,a,4);a+=4;c.readUint(b,a);a+=4;var t=c.readUint(b,a);a+=4;var u=c.readUint(b,a);a+=4;h[n]={offset:t,length:u}}for(k=0;k<f.length;k++)a=f[k],h[a]&&(d[a.trim()]=g[a.trim()].parse(b,h[a].offset,h[a].length,d));return d},_tabOffset:function(b, | ||
a,c){var d=g._bin,e=d.readUshort(b,c+4);c+=12;for(var f=0;f<e;f++){var h=d.readASCII(b,c,4);c+=4;d.readUint(b,c);c+=4;var k=d.readUint(b,c);c+=4;d.readUint(b,c);c+=4;if(h==a)return k}return 0}};g._bin={readFixed:function(b,a){return(b[a]<<8|b[a+1])+(b[a+2]<<8|b[a+3])/65540},readF2dot14:function(b,a){return g._bin.readShort(b,a)/16384},readInt:function(b,a){var c=g._bin.t.uint8;c[0]=b[a+3];c[1]=b[a+2];c[2]=b[a+1];c[3]=b[a];return g._bin.t.int32[0]},readInt8:function(b,a){g._bin.t.uint8[0]=b[a];return g._bin.t.int8[0]}, | ||
readShort:function(b,a){var c=g._bin.t.uint8;c[1]=b[a];c[0]=b[a+1];return g._bin.t.int16[0]},readUshort:function(b,a){return b[a]<<8|b[a+1]},readUshorts:function(b,a,c){for(var d=[],e=0;e<c;e++)d.push(g._bin.readUshort(b,a+2*e));return d},readUint:function(b,a){var c=g._bin.t.uint8;c[3]=b[a];c[2]=b[a+1];c[1]=b[a+2];c[0]=b[a+3];return g._bin.t.uint32[0]},readUint64:function(b,a){return 4294967296*g._bin.readUint(b,a)+g._bin.readUint(b,a+4)},readASCII:function(b,a,c){for(var d="",e=0;e<c;e++)d+=String.fromCharCode(b[a+ | ||
e]);return d},readUnicode:function(b,a,c){for(var d="",e=0;e<c;e++){var f=b[a++]<<8|b[a++];d+=String.fromCharCode(f)}return d},_tdec:l.TextDecoder?new l.TextDecoder:null,readUTF8:function(b,a,c){var d=g._bin._tdec;return d&&0==a&&c==b.length?d.decode(b):g._bin.readASCII(b,a,c)},readBytes:function(b,a,c){for(var d=[],e=0;e<c;e++)d.push(b[a+e]);return d},readASCIIArray:function(b,a,c){for(var d=[],e=0;e<c;e++)d.push(String.fromCharCode(b[a+e]));return d}};g._bin.t={buff:new ArrayBuffer(8)};g._bin.t.int8= | ||
new Int8Array(g._bin.t.buff);g._bin.t.uint8=new Uint8Array(g._bin.t.buff);g._bin.t.int16=new Int16Array(g._bin.t.buff);g._bin.t.uint16=new Uint16Array(g._bin.t.buff);g._bin.t.int32=new Int32Array(g._bin.t.buff);g._bin.t.uint32=new Uint32Array(g._bin.t.buff);g._lctf={};g._lctf.parse=function(b,a,c,d,e){var f=g._bin;c={};d=a;f.readFixed(b,a);a+=4;var h=f.readUshort(b,a);a+=2;var k=f.readUshort(b,a);a=f.readUshort(b,a+2);c.scriptList=g._lctf.readScriptList(b,d+h);c.featureList=g._lctf.readFeatureList(b, | ||
d+k);c.lookupList=g._lctf.readLookupList(b,d+a,e);return c};g._lctf.readLookupList=function(b,a,c){var d=g._bin,e=a,f=[],h=d.readUshort(b,a);a+=2;for(var k=0;k<h;k++){var n=d.readUshort(b,a);a+=2;n=g._lctf.readLookupTable(b,e+n,c);f.push(n)}return f};g._lctf.readLookupTable=function(b,a,c){var d=g._bin,e=a,f={tabs:[]};f.ltype=d.readUshort(b,a);a+=2;f.flag=d.readUshort(b,a);a+=2;var h=d.readUshort(b,a);a+=2;for(var k=0;k<h;k++){var n=d.readUshort(b,a);a+=2;n=c(b,f.ltype,e+n);f.tabs.push(n)}return f}; | ||
g._lctf.numOfOnes=function(b){for(var a=0,c=0;32>c;c++)0!=(b>>>c&1)&&a++;return a};g._lctf.readClassDef=function(b,a){var c=g._bin,d=[],e=c.readUshort(b,a);a+=2;if(1==e){var f=c.readUshort(b,a);a+=2;var h=c.readUshort(b,a);a+=2;for(var k=0;k<h;k++)d.push(f+k),d.push(f+k),d.push(c.readUshort(b,a)),a+=2}if(2==e)for(e=c.readUshort(b,a),a+=2,k=0;k<e;k++)d.push(c.readUshort(b,a)),a+=2,d.push(c.readUshort(b,a)),a+=2,d.push(c.readUshort(b,a)),a+=2;return d};g._lctf.getInterval=function(b,a){for(var c=0;c< | ||
b.length;c+=3){var d=b[c+1];if(b[c]<=a&&a<=d)return c}return-1};g._lctf.readCoverage=function(b,a){var c=g._bin,d={};d.fmt=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;1==d.fmt&&(d.tab=c.readUshorts(b,a,e));2==d.fmt&&(d.tab=c.readUshorts(b,a,3*e));return d};g._lctf.coverageIndex=function(b,a){var c=b.tab;return 1==b.fmt?c.indexOf(a):2==b.fmt&&(b=g._lctf.getInterval(c,a),-1!=b)?c[b+2]+(a-c[b]):-1};g._lctf.readFeatureList=function(b,a){var c=g._bin,d=a,e=[],f=c.readUshort(b,a);a+=2;for(var h= | ||
0;h<f;h++){var k=c.readASCII(b,a,4);a+=4;var n=c.readUshort(b,a);a+=2;e.push({tag:k.trim(),tab:g._lctf.readFeatureTable(b,d+n)})}return e};g._lctf.readFeatureTable=function(b,a){var c=g._bin;c.readUshort(b,a);a+=2;var d=c.readUshort(b,a);a+=2;for(var e=[],f=0;f<d;f++)e.push(c.readUshort(b,a+2*f));return e};g._lctf.readScriptList=function(b,a){var c=g._bin,d=a,e={},f=c.readUshort(b,a);a+=2;for(var h=0;h<f;h++){var k=c.readASCII(b,a,4);a+=4;var n=c.readUshort(b,a);a+=2;e[k.trim()]=g._lctf.readScriptTable(b, | ||
d+n)}return e};g._lctf.readScriptTable=function(b,a){var c=g._bin,d=a,e={},f=c.readUshort(b,a);a+=2;e.default=g._lctf.readLangSysTable(b,d+f);f=c.readUshort(b,a);a+=2;for(var h=0;h<f;h++){var k=c.readASCII(b,a,4);a+=4;var n=c.readUshort(b,a);a+=2;e[k.trim()]=g._lctf.readLangSysTable(b,d+n)}return e};g._lctf.readLangSysTable=function(b,a){var c=g._bin,d={};c.readUshort(b,a);a+=2;d.reqFeature=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);d.features=c.readUshorts(b,a+2,e);return d};g.CFF={};g.CFF.parse= | ||
function(b,a,c){var d=g._bin;b=new Uint8Array(b.buffer,a,c);a=0;a++;a++;a++;a++;var e=[];a=g.CFF.readIndex(b,a,e);var f=[];for(c=0;c<e.length-1;c++)f.push(d.readASCII(b,a+e[c],e[c+1]-e[c]));a+=e[e.length-1];e=[];a=g.CFF.readIndex(b,a,e);f=[];for(c=0;c<e.length-1;c++)f.push(g.CFF.readDict(b,a+e[c],a+e[c+1]));a+=e[e.length-1];e=f[0];var h=[];a=g.CFF.readIndex(b,a,h);f=[];for(c=0;c<h.length-1;c++)f.push(d.readASCII(b,a+h[c],h[c+1]-h[c]));a+=h[h.length-1];g.CFF.readSubrs(b,a,e);if(e.CharStrings){a=e.CharStrings; | ||
h=[];a=g.CFF.readIndex(b,a,h);var k=[];for(c=0;c<h.length-1;c++)k.push(d.readBytes(b,a+h[c],h[c+1]-h[c]));e.CharStrings=k}if(e.ROS){a=e.FDArray;h=[];a=g.CFF.readIndex(b,a,h);e.FDArray=[];for(c=0;c<h.length-1;c++)k=g.CFF.readDict(b,a+h[c],a+h[c+1]),g.CFF._readFDict(b,k,f),e.FDArray.push(k);a=e.FDSelect;e.FDSelect=[];c=b[a];a++;if(3==c)for(h=d.readUshort(b,a),a+=2,c=0;c<h+1;c++)e.FDSelect.push(d.readUshort(b,a),b[a+2]),a+=3;else throw c;}e.Encoding&&(e.Encoding=g.CFF.readEncoding(b,e.Encoding,e.CharStrings.length)); | ||
e.charset&&(e.charset=g.CFF.readCharset(b,e.charset,e.CharStrings.length));g.CFF._readFDict(b,e,f);return e};g.CFF._readFDict=function(b,a,c){if(a.Private){var d=a.Private[1];a.Private=g.CFF.readDict(b,d,d+a.Private[0]);a.Private.Subrs&&g.CFF.readSubrs(b,d+a.Private.Subrs,a.Private)}for(var e in a)-1!="FamilyName FontName FullName Notice version Copyright".split(" ").indexOf(e)&&(a[e]=c[a[e]-426+35])};g.CFF.readSubrs=function(b,a,c){var d=g._bin,e=[];a=g.CFF.readIndex(b,a,e);var f=e.length;c.Bias= | ||
1240>f?107:33900>f?1131:32768;c.Subrs=[];for(f=0;f<e.length-1;f++)c.Subrs.push(d.readBytes(b,a+e[f],e[f+1]-e[f]))};g.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0];g.CFF.glyphByUnicode=function(b,a){for(var c=0;c<b.charset.length;c++)if(b.charset[c]==a)return c;return-1};g.CFF.glyphBySE=function(b,a){return 0>a||255<a?-1:g.CFF.glyphByUnicode(b, | ||
g.CFF.tableSE[a])};g.CFF.readEncoding=function(b,a,c){c=[".notdef"];var d=b[a];a++;if(0==d){d=b[a];a++;for(var e=0;e<d;e++)c.push(b[a+e])}else throw"error: unknown encoding format: "+d;return c};g.CFF.readCharset=function(b,a,c){var d=g._bin,e=[".notdef"],f=b[a];a++;if(0==f)for(var h=0;h<c;h++){var k=d.readUshort(b,a);a+=2;e.push(k)}else if(1==f||2==f)for(;e.length<c;){k=d.readUshort(b,a);a+=2;if(1==f){var n=b[a];a++}else n=d.readUshort(b,a),a+=2;for(h=0;h<=n;h++)e.push(k),k++}else throw"error: format: "+ | ||
f;return e};g.CFF.readIndex=function(b,a,c){var d=g._bin,e=d.readUshort(b,a)+1;a+=2;var f=b[a];a++;if(1==f)for(var h=0;h<e;h++)c.push(b[a+h]);else if(2==f)for(h=0;h<e;h++)c.push(d.readUshort(b,a+2*h));else if(3==f)for(h=0;h<e;h++)c.push(d.readUint(b,a+3*h-1)&16777215);else if(1!=e)throw"unsupported offset size: "+f+", count: "+e;return a+e*f-1};g.CFF.getCharString=function(b,a,c){var d=g._bin,e=b[a],f=b[a+1],h=1,k=null,n=null;20>=e&&(k=e,h=1);12==e&&(k=100*e+f,h=2);21<=e&&27>=e&&(k=e,h=1);28==e&& | ||
(n=d.readShort(b,a+1),h=3);29<=e&&31>=e&&(k=e,h=1);32<=e&&246>=e&&(n=e-139,h=1);247<=e&&250>=e&&(n=256*(e-247)+f+108,h=2);251<=e&&254>=e&&(n=256*-(e-251)-f-108,h=2);255==e&&(n=d.readInt(b,a+1)/65535,h=5);c.val=null!=n?n:"o"+k;c.size=h};g.CFF.readCharString=function(b,a,c){c=a+c;for(var d=g._bin,e=[];a<c;){var f=b[a],h=b[a+1],k=1,n=null,t=null;20>=f&&(n=f,k=1);12==f&&(n=100*f+h,k=2);if(19==f||20==f)n=f,k=2;21<=f&&27>=f&&(n=f,k=1);28==f&&(t=d.readShort(b,a+1),k=3);29<=f&&31>=f&&(n=f,k=1);32<=f&&246>= | ||
f&&(t=f-139,k=1);247<=f&&250>=f&&(t=256*(f-247)+h+108,k=2);251<=f&&254>=f&&(t=256*-(f-251)-h-108,k=2);255==f&&(t=d.readInt(b,a+1)/65535,k=5);e.push(null!=t?t:"o"+n);a+=k}return e};g.CFF.readDict=function(b,a,c){for(var d=g._bin,e={},f=[];a<c;){var h=b[a],k=b[a+1],n=1,t=null,u=null;28==h&&(u=d.readShort(b,a+1),n=3);29==h&&(u=d.readInt(b,a+1),n=5);32<=h&&246>=h&&(u=h-139,n=1);247<=h&&250>=h&&(u=256*(h-247)+k+108,n=2);251<=h&&254>=h&&(u=256*-(h-251)-k-108,n=2);if(255==h)throw d.readInt(b,a+1),"unknown number"; | ||
if(30==h){u=[];for(n=1;;){var m=b[a+n];n++;var q=m>>4;m&=15;15!=q&&u.push(q);15!=m&&u.push(m);if(15==m)break}q="";m=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"];for(var p=0;p<u.length;p++)q+=m[u[p]];u=parseFloat(q)}21>=h&&(n="version Notice FullName FamilyName Weight FontBBox BlueValues OtherBlues FamilyBlues FamilyOtherBlues StdHW StdVW escape UniqueID XUID charset Encoding CharStrings Private Subrs defaultWidthX nominalWidthX".split(" "),t=n[h],n=1,12==h&&(n=["Copyright","isFixedPitch", | ||
"ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"],t=n[k],n=2));null!=t?(e[t]=1==g.length?g[0]:g,g=[]):g.push(u);a+=n}return e};f.cmap= | ||
{};f.cmap.parse=function(b,a,c){b=new Uint8Array(b.buffer,a,c);a=0;c=f._bin;var d={};c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;var g=[];d.tables=[];for(var h=0;h<e;h++){var k=c.readUshort(b,a);a+=2;var n=c.readUshort(b,a);a+=2;var t=c.readUint(b,a);a+=4;var u="p"+k+"e"+n,m=g.indexOf(t);if(-1==m){m=d.tables.length;var q;g.push(t);var p=c.readUshort(b,t);0==p?q=f.cmap.parse0(b,t):4==p?q=f.cmap.parse4(b,t):6==p?q=f.cmap.parse6(b,t):12==p?q=f.cmap.parse12(b,t):console.log("unknown format: "+ | ||
p,k,n,t);d.tables.push(q)}if(null!=d[u])throw"multiple tables for one platform+encoding";d[u]=m}return d};f.cmap.parse0=function(b,a){var c=f._bin,d={};d.format=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;d.map=[];for(c=0;c<e-6;c++)d.map.push(b[a+c]);return d};f.cmap.parse4=function(b,a){var c=f._bin,d=a,e={};e.format=c.readUshort(b,a);a+=2;var g=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;var h=c.readUshort(b,a);a+=2;h/=2;e.searchRange=c.readUshort(b,a);a+=2;e.entrySelector= | ||
c.readUshort(b,a);a+=2;e.rangeShift=c.readUshort(b,a);a+=2;e.endCount=c.readUshorts(b,a,h);a=a+2*h+2;e.startCount=c.readUshorts(b,a,h);a+=2*h;e.idDelta=[];for(var k=0;k<h;k++)e.idDelta.push(c.readShort(b,a)),a+=2;e.idRangeOffset=c.readUshorts(b,a,h);a+=2*h;for(e.glyphIdArray=[];a<d+g;)e.glyphIdArray.push(c.readUshort(b,a)),a+=2;return e};f.cmap.parse6=function(b,a){var c=f._bin,d={};d.format=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;d.firstCode=c.readUshort(b,a);a+=2;var e= | ||
c.readUshort(b,a);a+=2;d.glyphIdArray=[];for(var g=0;g<e;g++)d.glyphIdArray.push(c.readUshort(b,a)),a+=2;return d};f.cmap.parse12=function(b,a){var c=f._bin,d={};d.format=c.readUshort(b,a);a=a+2+2;c.readUint(b,a);a+=4;c.readUint(b,a);a+=4;var e=c.readUint(b,a);a+=4;d.groups=[];for(var g=0;g<e;g++){var h=a+12*g,k=c.readUint(b,h+0),n=c.readUint(b,h+4);h=c.readUint(b,h+8);d.groups.push([k,n,h])}return d};f.glyf={};f.glyf.parse=function(b,a,c,d){b=[];for(a=0;a<d.maxp.numGlyphs;a++)b.push(null);return b}; | ||
f.glyf._parseGlyf=function(b,a){var c=f._bin,d=b._data,e=f._tabOffset(d,"glyf",b._offset)+b.loca[a];if(b.loca[a]==b.loca[a+1])return null;b={};b.noc=c.readShort(d,e);e+=2;b.xMin=c.readShort(d,e);e+=2;b.yMin=c.readShort(d,e);e+=2;b.xMax=c.readShort(d,e);e+=2;b.yMax=c.readShort(d,e);e+=2;if(b.xMin>=b.xMax||b.yMin>=b.yMax)return null;if(0<b.noc){b.endPts=[];for(a=0;a<b.noc;a++)b.endPts.push(c.readUshort(d,e)),e+=2;a=c.readUshort(d,e);e+=2;if(d.length-e<a)return null;b.instructions=c.readBytes(d,e,a); | ||
e+=a;var g=b.endPts[b.noc-1]+1;b.flags=[];for(a=0;a<g;a++){var h=d[e];e++;b.flags.push(h);if(0!=(h&8)){var k=d[e];e++;for(var n=0;n<k;n++)b.flags.push(h),a++}}b.xs=[];for(a=0;a<g;a++)h=0!=(b.flags[a]&2),k=0!=(b.flags[a]&16),h?(b.xs.push(k?d[e]:-d[e]),e++):k?b.xs.push(0):(b.xs.push(c.readShort(d,e)),e+=2);b.ys=[];for(a=0;a<g;a++)h=0!=(b.flags[a]&4),k=0!=(b.flags[a]&32),h?(b.ys.push(k?d[e]:-d[e]),e++):k?b.ys.push(0):(b.ys.push(c.readShort(d,e)),e+=2);for(a=e=d=0;a<g;a++)d+=b.xs[a],e+=b.ys[a],b.xs[a]= | ||
d,b.ys[a]=e}else{b.parts=[];do a=c.readUshort(d,e),e+=2,g={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1},b.parts.push(g),g.glyphIndex=c.readUshort(d,e),e+=2,a&1?(h=c.readShort(d,e),e+=2,k=c.readShort(d,e),e+=2):(h=c.readInt8(d,e),e++,k=c.readInt8(d,e),e++),a&2?(g.m.tx=h,g.m.ty=k):(g.p1=h,g.p2=k),a&8?(g.m.a=g.m.d=c.readF2dot14(d,e),e+=2):a&64?(g.m.a=c.readF2dot14(d,e),e+=2,g.m.d=c.readF2dot14(d,e),e+=2):a&128&&(g.m.a=c.readF2dot14(d,e),e+=2,g.m.b=c.readF2dot14(d,e),e+=2,g.m.c=c.readF2dot14(d,e),e+=2, | ||
g.m.d=c.readF2dot14(d,e),e+=2);while(a&32);if(a&256)for(c=c.readUshort(d,e),e+=2,b.instr=[],a=0;a<c;a++)b.instr.push(d[e]),e++}return b};f.GPOS={};f.GPOS.parse=function(b,a,c,d){return f._lctf.parse(b,a,c,d,f.GPOS.subt)};f.GPOS.subt=function(b,a,c){var d=f._bin,e=c,g={};g.fmt=d.readUshort(b,c);c+=2;if(1==a||2==a||3==a||7==a||8==a&&2>=g.fmt){var h=d.readUshort(b,c);c+=2;g.coverage=f._lctf.readCoverage(b,h+e)}if(1==a&&1==g.fmt){var k=d.readUshort(b,c);c+=2;f._lctf.numOfOnes(k);0!=k&&(g.pos=f.GPOS.readValueRecord(b, | ||
c,k))}else if(2==a){k=d.readUshort(b,c);c+=2;var n=d.readUshort(b,c);c+=2;a=f._lctf.numOfOnes(k);h=f._lctf.numOfOnes(n);if(1==g.fmt){g.pairsets=[];var t=d.readUshort(b,c);c+=2;for(var u=0;u<t;u++){var m=e+d.readUshort(b,c);c+=2;var q=d.readUshort(b,m);m+=2;for(var p=[],r=0;r<q;r++){var A=d.readUshort(b,m);m+=2;if(0!=k){var l=f.GPOS.readValueRecord(b,m,k);m+=2*a}if(0!=n){var x=f.GPOS.readValueRecord(b,m,n);m+=2*h}p.push({gid2:A,val1:l,val2:x})}g.pairsets.push(p)}}if(2==g.fmt)for(l=d.readUshort(b,c), | ||
c+=2,x=d.readUshort(b,c),c+=2,k=d.readUshort(b,c),c+=2,d=d.readUshort(b,c),c+=2,g.classDef1=f._lctf.readClassDef(b,e+l),g.classDef2=f._lctf.readClassDef(b,e+x),g.matrix=[],u=0;u<k;u++){e=[];for(r=0;r<d;r++)x=l=null,0!=g.valFmt1&&(l=f.GPOS.readValueRecord(b,c,g.valFmt1),c+=2*a),0!=g.valFmt2&&(x=f.GPOS.readValueRecord(b,c,g.valFmt2),c+=2*h),e.push({val1:l,val2:x});g.matrix.push(e)}}return g};f.GPOS.readValueRecord=function(b,a,c){var d=f._bin,e=[];e.push(c&1?d.readShort(b,a):0);a+=c&1?2:0;e.push(c& | ||
2?d.readShort(b,a):0);a+=c&2?2:0;e.push(c&4?d.readShort(b,a):0);e.push(c&8?d.readShort(b,a+(c&4?2:0)):0);return e};f.GSUB={};f.GSUB.parse=function(b,a,c,d){return f._lctf.parse(b,a,c,d,f.GSUB.subt)};f.GSUB.subt=function(b,a,c){var d=f._bin,e=c,g={};g.fmt=d.readUshort(b,c);c+=2;if(1!=a&&4!=a&&5!=a&&6!=a)return null;if(1==a||4==a||5==a&&2>=g.fmt||6==a&&2>=g.fmt){var h=d.readUshort(b,c);c+=2;g.coverage=f._lctf.readCoverage(b,e+h)}if(1==a)1==g.fmt?g.delta=d.readShort(b,c):2==g.fmt&&(h=d.readUshort(b, | ||
c),g.newg=d.readUshorts(b,c+2,h));else if(4==a)for(g.vals=[],h=d.readUshort(b,c),c+=2,a=0;a<h;a++){var k=d.readUshort(b,c);c+=2;g.vals.push(f.GSUB.readLigatureSet(b,e+k))}else if(5==a){if(2==g.fmt)for(a=d.readUshort(b,c),c+=2,g.cDef=f._lctf.readClassDef(b,e+a),g.scset=[],h=d.readUshort(b,c),c+=2,a=0;a<h;a++)k=d.readUshort(b,c),c+=2,g.scset.push(0==k?null:f.GSUB.readSubClassSet(b,e+k))}else if(6==a&&3==g.fmt){for(a=0;3>a;a++){h=d.readUshort(b,c);c+=2;k=[];for(var n=0;n<h;n++)k.push(f._lctf.readCoverage(b, | ||
e+d.readUshort(b,c+2*n)));c+=2*h;0==a&&(g.backCvg=k);1==a&&(g.inptCvg=k);2==a&&(g.ahedCvg=k)}h=d.readUshort(b,c);g.lookupRec=f.GSUB.readSubstLookupRecords(b,c+2,h)}return g};f.GSUB.readSubClassSet=function(b,a){var c=f._bin.readUshort,d=a,e=[],g=c(b,a);a+=2;for(var h=0;h<g;h++){var k=c(b,a);a+=2;e.push(f.GSUB.readSubClassRule(b,d+k))}return e};f.GSUB.readSubClassRule=function(b,a){var c=f._bin.readUshort,d={},e=c(b,a);a+=2;var g=c(b,a);a+=2;d.input=[];for(var h=0;h<e-1;h++)d.input.push(c(b,a)),a+= | ||
2;d.substLookupRecords=f.GSUB.readSubstLookupRecords(b,a,g);return d};f.GSUB.readSubstLookupRecords=function(b,a,c){for(var d=f._bin.readUshort,e=[],g=0;g<c;g++)e.push(d(b,a),d(b,a+2)),a+=4;return e};f.GSUB.readChainSubClassSet=function(b,a){var c=f._bin,d=a,e=[],g=c.readUshort(b,a);a+=2;for(var h=0;h<g;h++){var k=c.readUshort(b,a);a+=2;e.push(f.GSUB.readChainSubClassRule(b,d+k))}return e};f.GSUB.readChainSubClassRule=function(b,a){for(var c=f._bin,d={},e=["backtrack","input","lookahead"],g=0;g<e.length;g++){var h= | ||
c.readUshort(b,a);a+=2;1==g&&h--;d[e[g]]=c.readUshorts(b,a,h);a+=2*d[e[g]].length}h=c.readUshort(b,a);d.subst=c.readUshorts(b,a+2,2*h);return d};f.GSUB.readLigatureSet=function(b,a){var c=f._bin,d=a,e=[],g=c.readUshort(b,a);a+=2;for(var h=0;h<g;h++){var k=c.readUshort(b,a);a+=2;e.push(f.GSUB.readLigature(b,d+k))}return e};f.GSUB.readLigature=function(b,a){var c=f._bin,d={chain:[]};d.nglyph=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;for(var g=0;g<e-1;g++)d.chain.push(c.readUshort(b,a)),a+= | ||
2;return d};f.head={};f.head.parse=function(b,a,c){c=f._bin;var d={};c.readFixed(b,a);a+=4;d.fontRevision=c.readFixed(b,a);a+=4;c.readUint(b,a);a+=4;c.readUint(b,a);a+=4;d.flags=c.readUshort(b,a);a+=2;d.unitsPerEm=c.readUshort(b,a);a+=2;d.created=c.readUint64(b,a);a+=8;d.modified=c.readUint64(b,a);a+=8;d.xMin=c.readShort(b,a);a+=2;d.yMin=c.readShort(b,a);a+=2;d.xMax=c.readShort(b,a);a+=2;d.yMax=c.readShort(b,a);a+=2;d.macStyle=c.readUshort(b,a);a+=2;d.lowestRecPPEM=c.readUshort(b,a);a+=2;d.fontDirectionHint= | ||
c.readShort(b,a);a+=2;d.indexToLocFormat=c.readShort(b,a);d.glyphDataFormat=c.readShort(b,a+2);return d};f.hhea={};f.hhea.parse=function(b,a,c){c=f._bin;var d={};c.readFixed(b,a);a+=4;d.ascender=c.readShort(b,a);a+=2;d.descender=c.readShort(b,a);a+=2;d.lineGap=c.readShort(b,a);a+=2;d.advanceWidthMax=c.readUshort(b,a);a+=2;d.minLeftSideBearing=c.readShort(b,a);a+=2;d.minRightSideBearing=c.readShort(b,a);a+=2;d.xMaxExtent=c.readShort(b,a);a+=2;d.caretSlopeRise=c.readShort(b,a);a+=2;d.caretSlopeRun= | ||
c.readShort(b,a);a+=2;d.caretOffset=c.readShort(b,a);a=a+2+8;d.metricDataFormat=c.readShort(b,a);d.numberOfHMetrics=c.readUshort(b,a+2);return d};f.hmtx={};f.hmtx.parse=function(b,a,c,d){c=f._bin;for(var e={aWidth:[],lsBearing:[]},g=0,h=0,k=0;k<d.maxp.numGlyphs;k++)k<d.hhea.numberOfHMetrics&&(g=c.readUshort(b,a),a+=2,h=c.readShort(b,a),a+=2),e.aWidth.push(g),e.lsBearing.push(h);return e};f.kern={};f.kern.parse=function(b,a,c,d){var e=f._bin,g=e.readUshort(b,a);a+=2;if(1==g)return f.kern.parseV1(b, | ||
a-2,c,d);c=e.readUshort(b,a);a+=2;d={glyph1:[],rval:[]};for(g=0;g<c;g++){a+=2;e.readUshort(b,a);a+=2;var h=e.readUshort(b,a);a+=2;h>>>=8;h&=15;if(0==h)a=f.kern.readFormat0(b,a,d);else throw"unknown kern table format: "+h;}return d};f.kern.parseV1=function(b,a,c,d){c=f._bin;c.readFixed(b,a);a+=4;d=c.readUint(b,a);a+=4;for(var e={glyph1:[],rval:[]},g=0;g<d;g++){c.readUint(b,a);a+=4;var h=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;h>>>=8;h&=15;if(0==h)a=f.kern.readFormat0(b,a,e);else throw"unknown kern table format: "+ | ||
h;}return e};f.kern.readFormat0=function(b,a,c){var d=f._bin,e=-1,g=d.readUshort(b,a);a+=2;d.readUshort(b,a);a+=2;d.readUshort(b,a);a+=2;d.readUshort(b,a);a+=2;for(var h=0;h<g;h++){var k=d.readUshort(b,a);a+=2;var n=d.readUshort(b,a);a+=2;var t=d.readShort(b,a);a+=2;k!=e&&(c.glyph1.push(k),c.rval.push({glyph2:[],vals:[]}));e=c.rval[c.rval.length-1];e.glyph2.push(n);e.vals.push(t);e=k}return a};f.loca={};f.loca.parse=function(b,a,c,d){c=f._bin;var e=[],g=d.head.indexToLocFormat;d=d.maxp.numGlyphs+ | ||
1;if(0==g)for(var h=0;h<d;h++)e.push(c.readUshort(b,a+(h<<1))<<1);if(1==g)for(h=0;h<d;h++)e.push(c.readUint(b,a+(h<<2)));return e};f.maxp={};f.maxp.parse=function(b,a,c){c=f._bin;var d={},e=c.readUint(b,a);a+=4;d.numGlyphs=c.readUshort(b,a);a+=2;65536==e&&(d.maxPoints=c.readUshort(b,a),a+=2,d.maxContours=c.readUshort(b,a),a+=2,d.maxCompositePoints=c.readUshort(b,a),a+=2,d.maxCompositeContours=c.readUshort(b,a),a+=2,d.maxZones=c.readUshort(b,a),a+=2,d.maxTwilightPoints=c.readUshort(b,a),a+=2,d.maxStorage= | ||
c.readUshort(b,a),a+=2,d.maxFunctionDefs=c.readUshort(b,a),a+=2,d.maxInstructionDefs=c.readUshort(b,a),a+=2,d.maxStackElements=c.readUshort(b,a),a+=2,d.maxSizeOfInstructions=c.readUshort(b,a),a+=2,d.maxComponentElements=c.readUshort(b,a),d.maxComponentDepth=c.readUshort(b,a+2));return d};f.name={};f.name.parse=function(b,a,c){c=f._bin;var d={};c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;for(var g="copyright fontFamily fontSubfamily ID fullName version postScriptName trademark manufacturer designer description urlVendor urlDesigner licence licenceURL --- typoFamilyName typoSubfamilyName compatibleFull sampleText postScriptCID wwsFamilyName wwsSubfamilyName lightPalette darkPalette".split(" "), | ||
h=a,k=0;k<e;k++){var n=c.readUshort(b,a);a+=2;var t=c.readUshort(b,a);a+=2;var u=c.readUshort(b,a);a+=2;var m=c.readUshort(b,a);a+=2;var q=c.readUshort(b,a);a+=2;var p=c.readUshort(b,a);a+=2;m=g[m];p=h+12*e+p;if(0==n)q=c.readUnicode(b,p,q/2);else if(3==n&&0==t)q=c.readUnicode(b,p,q/2);else if(0==t)q=c.readASCII(b,p,q);else if(1==t)q=c.readUnicode(b,p,q/2);else if(3==t)q=c.readUnicode(b,p,q/2);else if(1==n)q=c.readASCII(b,p,q),console.log("reading unknown MAC encoding "+t+" as ASCII");else throw"unknown encoding "+ | ||
t+", platformID: "+n;n="p"+n+","+u.toString(16);null==d[n]&&(d[n]={});d[n][m]=q;d[n]._lang=u}for(var r in d)if(null!=d[r].postScriptName&&1033==d[r]._lang)return d[r];for(r in d)if(null!=d[r].postScriptName&&0==d[r]._lang)return d[r];for(r in d)if(null!=d[r].postScriptName&&3084==d[r]._lang)return d[r];for(r in d)if(null!=d[r].postScriptName)return d[r];for(r in d){var l=r;break}console.log("returning name table with languageID "+d[l]._lang);return d[l]};f["OS/2"]={};f["OS/2"].parse=function(b,a, | ||
c){c=f._bin.readUshort(b,a);a+=2;var d={};if(0==c)f["OS/2"].version0(b,a,d);else if(1==c)f["OS/2"].version1(b,a,d);else if(2==c||3==c||4==c)f["OS/2"].version2(b,a,d);else if(5==c)f["OS/2"].version5(b,a,d);else throw"unknown OS/2 table version: "+c;return d};f["OS/2"].version0=function(b,a,c){var d=f._bin;c.xAvgCharWidth=d.readShort(b,a);a+=2;c.usWeightClass=d.readUshort(b,a);a+=2;c.usWidthClass=d.readUshort(b,a);a+=2;c.fsType=d.readUshort(b,a);a+=2;c.ySubscriptXSize=d.readShort(b,a);a+=2;c.ySubscriptYSize= | ||
"ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"],t=n[k],n=2));null!=t?(e[t]=1==f.length?f[0]:f,f=[]):f.push(u);a+=n}return e};g.cmap= | ||
{};g.cmap.parse=function(b,a,c){b=new Uint8Array(b.buffer,a,c);a=0;c=g._bin;var d={};c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;var f=[];d.tables=[];for(var h=0;h<e;h++){var k=c.readUshort(b,a);a+=2;var n=c.readUshort(b,a);a+=2;var t=c.readUint(b,a);a+=4;var u="p"+k+"e"+n,m=f.indexOf(t);if(-1==m){m=d.tables.length;var q;f.push(t);var p=c.readUshort(b,t);0==p?q=g.cmap.parse0(b,t):4==p?q=g.cmap.parse4(b,t):6==p?q=g.cmap.parse6(b,t):12==p?q=g.cmap.parse12(b,t):console.log("unknown format: "+ | ||
p,k,n,t);d.tables.push(q)}if(null!=d[u])throw"multiple tables for one platform+encoding";d[u]=m}return d};g.cmap.parse0=function(b,a){var c=g._bin,d={};d.format=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;d.map=[];for(c=0;c<e-6;c++)d.map.push(b[a+c]);return d};g.cmap.parse4=function(b,a){var c=g._bin,d=a,e={};e.format=c.readUshort(b,a);a+=2;var f=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;var h=c.readUshort(b,a);a+=2;h/=2;e.searchRange=c.readUshort(b,a);a+=2;e.entrySelector= | ||
c.readUshort(b,a);a+=2;e.rangeShift=c.readUshort(b,a);a+=2;e.endCount=c.readUshorts(b,a,h);a=a+2*h+2;e.startCount=c.readUshorts(b,a,h);a+=2*h;e.idDelta=[];for(var k=0;k<h;k++)e.idDelta.push(c.readShort(b,a)),a+=2;e.idRangeOffset=c.readUshorts(b,a,h);a+=2*h;for(e.glyphIdArray=[];a<d+f;)e.glyphIdArray.push(c.readUshort(b,a)),a+=2;return e};g.cmap.parse6=function(b,a){var c=g._bin,d={};d.format=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;d.firstCode=c.readUshort(b,a);a+=2;var e= | ||
c.readUshort(b,a);a+=2;d.glyphIdArray=[];for(var f=0;f<e;f++)d.glyphIdArray.push(c.readUshort(b,a)),a+=2;return d};g.cmap.parse12=function(b,a){var c=g._bin,d={};d.format=c.readUshort(b,a);a=a+2+2;c.readUint(b,a);a+=4;c.readUint(b,a);a+=4;var e=c.readUint(b,a);a+=4;d.groups=[];for(var f=0;f<e;f++){var h=a+12*f,k=c.readUint(b,h+0),n=c.readUint(b,h+4);h=c.readUint(b,h+8);d.groups.push([k,n,h])}return d};g.glyf={};g.glyf.parse=function(b,a,c,d){b=[];for(a=0;a<d.maxp.numGlyphs;a++)b.push(null);return b}; | ||
g.glyf._parseGlyf=function(b,a){var c=g._bin,d=b._data,e=g._tabOffset(d,"glyf",b._offset)+b.loca[a];if(b.loca[a]==b.loca[a+1])return null;b={};b.noc=c.readShort(d,e);e+=2;b.xMin=c.readShort(d,e);e+=2;b.yMin=c.readShort(d,e);e+=2;b.xMax=c.readShort(d,e);e+=2;b.yMax=c.readShort(d,e);e+=2;if(b.xMin>=b.xMax||b.yMin>=b.yMax)return null;if(0<b.noc){b.endPts=[];for(a=0;a<b.noc;a++)b.endPts.push(c.readUshort(d,e)),e+=2;a=c.readUshort(d,e);e+=2;if(d.length-e<a)return null;b.instructions=c.readBytes(d,e,a); | ||
e+=a;var f=b.endPts[b.noc-1]+1;b.flags=[];for(a=0;a<f;a++){var h=d[e];e++;b.flags.push(h);if(0!=(h&8)){var k=d[e];e++;for(var n=0;n<k;n++)b.flags.push(h),a++}}b.xs=[];for(a=0;a<f;a++)h=0!=(b.flags[a]&2),k=0!=(b.flags[a]&16),h?(b.xs.push(k?d[e]:-d[e]),e++):k?b.xs.push(0):(b.xs.push(c.readShort(d,e)),e+=2);b.ys=[];for(a=0;a<f;a++)h=0!=(b.flags[a]&4),k=0!=(b.flags[a]&32),h?(b.ys.push(k?d[e]:-d[e]),e++):k?b.ys.push(0):(b.ys.push(c.readShort(d,e)),e+=2);for(a=e=d=0;a<f;a++)d+=b.xs[a],e+=b.ys[a],b.xs[a]= | ||
d,b.ys[a]=e}else{b.parts=[];do a=c.readUshort(d,e),e+=2,f={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1},b.parts.push(f),f.glyphIndex=c.readUshort(d,e),e+=2,a&1?(h=c.readShort(d,e),e+=2,k=c.readShort(d,e),e+=2):(h=c.readInt8(d,e),e++,k=c.readInt8(d,e),e++),a&2?(f.m.tx=h,f.m.ty=k):(f.p1=h,f.p2=k),a&8?(f.m.a=f.m.d=c.readF2dot14(d,e),e+=2):a&64?(f.m.a=c.readF2dot14(d,e),e+=2,f.m.d=c.readF2dot14(d,e),e+=2):a&128&&(f.m.a=c.readF2dot14(d,e),e+=2,f.m.b=c.readF2dot14(d,e),e+=2,f.m.c=c.readF2dot14(d,e),e+=2, | ||
f.m.d=c.readF2dot14(d,e),e+=2);while(a&32);if(a&256)for(c=c.readUshort(d,e),e+=2,b.instr=[],a=0;a<c;a++)b.instr.push(d[e]),e++}return b};g.GPOS={};g.GPOS.parse=function(b,a,c,d){return g._lctf.parse(b,a,c,d,g.GPOS.subt)};g.GPOS.subt=function(b,a,c){var d=g._bin,e=c,f={};f.fmt=d.readUshort(b,c);c+=2;if(1==a||2==a||3==a||7==a||8==a&&2>=f.fmt){var h=d.readUshort(b,c);c+=2;f.coverage=g._lctf.readCoverage(b,h+e)}if(1==a&&1==f.fmt){var k=d.readUshort(b,c);c+=2;g._lctf.numOfOnes(k);0!=k&&(f.pos=g.GPOS.readValueRecord(b, | ||
c,k))}else if(2==a){k=d.readUshort(b,c);c+=2;var n=d.readUshort(b,c);c+=2;a=g._lctf.numOfOnes(k);h=g._lctf.numOfOnes(n);if(1==f.fmt){f.pairsets=[];var t=d.readUshort(b,c);c+=2;for(var u=0;u<t;u++){var m=e+d.readUshort(b,c);c+=2;var q=d.readUshort(b,m);m+=2;for(var p=[],r=0;r<q;r++){var A=d.readUshort(b,m);m+=2;if(0!=k){var l=g.GPOS.readValueRecord(b,m,k);m+=2*a}if(0!=n){var x=g.GPOS.readValueRecord(b,m,n);m+=2*h}p.push({gid2:A,val1:l,val2:x})}f.pairsets.push(p)}}if(2==f.fmt)for(l=d.readUshort(b,c), | ||
c+=2,x=d.readUshort(b,c),c+=2,k=d.readUshort(b,c),c+=2,d=d.readUshort(b,c),c+=2,f.classDef1=g._lctf.readClassDef(b,e+l),f.classDef2=g._lctf.readClassDef(b,e+x),f.matrix=[],u=0;u<k;u++){e=[];for(r=0;r<d;r++)x=l=null,0!=f.valFmt1&&(l=g.GPOS.readValueRecord(b,c,f.valFmt1),c+=2*a),0!=f.valFmt2&&(x=g.GPOS.readValueRecord(b,c,f.valFmt2),c+=2*h),e.push({val1:l,val2:x});f.matrix.push(e)}}return f};g.GPOS.readValueRecord=function(b,a,c){var d=g._bin,e=[];e.push(c&1?d.readShort(b,a):0);a+=c&1?2:0;e.push(c& | ||
2?d.readShort(b,a):0);a+=c&2?2:0;e.push(c&4?d.readShort(b,a):0);e.push(c&8?d.readShort(b,a+(c&4?2:0)):0);return e};g.GSUB={};g.GSUB.parse=function(b,a,c,d){return g._lctf.parse(b,a,c,d,g.GSUB.subt)};g.GSUB.subt=function(b,a,c){var d=g._bin,e=c,f={};f.fmt=d.readUshort(b,c);c+=2;if(1!=a&&4!=a&&5!=a&&6!=a)return null;if(1==a||4==a||5==a&&2>=f.fmt||6==a&&2>=f.fmt){var h=d.readUshort(b,c);c+=2;f.coverage=g._lctf.readCoverage(b,e+h)}if(1==a)1==f.fmt?f.delta=d.readShort(b,c):2==f.fmt&&(h=d.readUshort(b, | ||
c),f.newg=d.readUshorts(b,c+2,h));else if(4==a)for(f.vals=[],h=d.readUshort(b,c),c+=2,a=0;a<h;a++){var k=d.readUshort(b,c);c+=2;f.vals.push(g.GSUB.readLigatureSet(b,e+k))}else if(5==a){if(2==f.fmt)for(a=d.readUshort(b,c),c+=2,f.cDef=g._lctf.readClassDef(b,e+a),f.scset=[],h=d.readUshort(b,c),c+=2,a=0;a<h;a++)k=d.readUshort(b,c),c+=2,f.scset.push(0==k?null:g.GSUB.readSubClassSet(b,e+k))}else if(6==a&&3==f.fmt){for(a=0;3>a;a++){h=d.readUshort(b,c);c+=2;k=[];for(var n=0;n<h;n++)k.push(g._lctf.readCoverage(b, | ||
e+d.readUshort(b,c+2*n)));c+=2*h;0==a&&(f.backCvg=k);1==a&&(f.inptCvg=k);2==a&&(f.ahedCvg=k)}h=d.readUshort(b,c);f.lookupRec=g.GSUB.readSubstLookupRecords(b,c+2,h)}return f};g.GSUB.readSubClassSet=function(b,a){var c=g._bin.readUshort,d=a,e=[],f=c(b,a);a+=2;for(var h=0;h<f;h++){var k=c(b,a);a+=2;e.push(g.GSUB.readSubClassRule(b,d+k))}return e};g.GSUB.readSubClassRule=function(b,a){var c=g._bin.readUshort,d={},e=c(b,a);a+=2;var f=c(b,a);a+=2;d.input=[];for(var h=0;h<e-1;h++)d.input.push(c(b,a)),a+= | ||
2;d.substLookupRecords=g.GSUB.readSubstLookupRecords(b,a,f);return d};g.GSUB.readSubstLookupRecords=function(b,a,c){for(var d=g._bin.readUshort,e=[],f=0;f<c;f++)e.push(d(b,a),d(b,a+2)),a+=4;return e};g.GSUB.readChainSubClassSet=function(b,a){var c=g._bin,d=a,e=[],f=c.readUshort(b,a);a+=2;for(var h=0;h<f;h++){var k=c.readUshort(b,a);a+=2;e.push(g.GSUB.readChainSubClassRule(b,d+k))}return e};g.GSUB.readChainSubClassRule=function(b,a){for(var c=g._bin,d={},e=["backtrack","input","lookahead"],f=0;f<e.length;f++){var h= | ||
c.readUshort(b,a);a+=2;1==f&&h--;d[e[f]]=c.readUshorts(b,a,h);a+=2*d[e[f]].length}h=c.readUshort(b,a);d.subst=c.readUshorts(b,a+2,2*h);return d};g.GSUB.readLigatureSet=function(b,a){var c=g._bin,d=a,e=[],f=c.readUshort(b,a);a+=2;for(var h=0;h<f;h++){var k=c.readUshort(b,a);a+=2;e.push(g.GSUB.readLigature(b,d+k))}return e};g.GSUB.readLigature=function(b,a){var c=g._bin,d={chain:[]};d.nglyph=c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;for(var f=0;f<e-1;f++)d.chain.push(c.readUshort(b,a)),a+= | ||
2;return d};g.head={};g.head.parse=function(b,a,c){c=g._bin;var d={};c.readFixed(b,a);a+=4;d.fontRevision=c.readFixed(b,a);a+=4;c.readUint(b,a);a+=4;c.readUint(b,a);a+=4;d.flags=c.readUshort(b,a);a+=2;d.unitsPerEm=c.readUshort(b,a);a+=2;d.created=c.readUint64(b,a);a+=8;d.modified=c.readUint64(b,a);a+=8;d.xMin=c.readShort(b,a);a+=2;d.yMin=c.readShort(b,a);a+=2;d.xMax=c.readShort(b,a);a+=2;d.yMax=c.readShort(b,a);a+=2;d.macStyle=c.readUshort(b,a);a+=2;d.lowestRecPPEM=c.readUshort(b,a);a+=2;d.fontDirectionHint= | ||
c.readShort(b,a);a+=2;d.indexToLocFormat=c.readShort(b,a);d.glyphDataFormat=c.readShort(b,a+2);return d};g.hhea={};g.hhea.parse=function(b,a,c){c=g._bin;var d={};c.readFixed(b,a);a+=4;d.ascender=c.readShort(b,a);a+=2;d.descender=c.readShort(b,a);a+=2;d.lineGap=c.readShort(b,a);a+=2;d.advanceWidthMax=c.readUshort(b,a);a+=2;d.minLeftSideBearing=c.readShort(b,a);a+=2;d.minRightSideBearing=c.readShort(b,a);a+=2;d.xMaxExtent=c.readShort(b,a);a+=2;d.caretSlopeRise=c.readShort(b,a);a+=2;d.caretSlopeRun= | ||
c.readShort(b,a);a+=2;d.caretOffset=c.readShort(b,a);a=a+2+8;d.metricDataFormat=c.readShort(b,a);d.numberOfHMetrics=c.readUshort(b,a+2);return d};g.hmtx={};g.hmtx.parse=function(b,a,c,d){c=g._bin;for(var e={aWidth:[],lsBearing:[]},f=0,h=0,k=0;k<d.maxp.numGlyphs;k++)k<d.hhea.numberOfHMetrics&&(f=c.readUshort(b,a),a+=2,h=c.readShort(b,a),a+=2),e.aWidth.push(f),e.lsBearing.push(h);return e};g.kern={};g.kern.parse=function(b,a,c,d){var e=g._bin,f=e.readUshort(b,a);a+=2;if(1==f)return g.kern.parseV1(b, | ||
a-2,c,d);c=e.readUshort(b,a);a+=2;d={glyph1:[],rval:[]};for(f=0;f<c;f++){a+=2;e.readUshort(b,a);a+=2;var h=e.readUshort(b,a);a+=2;h>>>=8;h&=15;if(0==h)a=g.kern.readFormat0(b,a,d);else throw"unknown kern table format: "+h;}return d};g.kern.parseV1=function(b,a,c,d){c=g._bin;c.readFixed(b,a);a+=4;d=c.readUint(b,a);a+=4;for(var e={glyph1:[],rval:[]},f=0;f<d;f++){c.readUint(b,a);a+=4;var h=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;h>>>=8;h&=15;if(0==h)a=g.kern.readFormat0(b,a,e);else throw"unknown kern table format: "+ | ||
h;}return e};g.kern.readFormat0=function(b,a,c){var d=g._bin,e=-1,f=d.readUshort(b,a);a+=2;d.readUshort(b,a);a+=2;d.readUshort(b,a);a+=2;d.readUshort(b,a);a+=2;for(var h=0;h<f;h++){var k=d.readUshort(b,a);a+=2;var n=d.readUshort(b,a);a+=2;var t=d.readShort(b,a);a+=2;k!=e&&(c.glyph1.push(k),c.rval.push({glyph2:[],vals:[]}));e=c.rval[c.rval.length-1];e.glyph2.push(n);e.vals.push(t);e=k}return a};g.loca={};g.loca.parse=function(b,a,c,d){c=g._bin;var e=[],f=d.head.indexToLocFormat;d=d.maxp.numGlyphs+ | ||
1;if(0==f)for(var h=0;h<d;h++)e.push(c.readUshort(b,a+(h<<1))<<1);if(1==f)for(h=0;h<d;h++)e.push(c.readUint(b,a+(h<<2)));return e};g.maxp={};g.maxp.parse=function(b,a,c){c=g._bin;var d={},e=c.readUint(b,a);a+=4;d.numGlyphs=c.readUshort(b,a);a+=2;65536==e&&(d.maxPoints=c.readUshort(b,a),a+=2,d.maxContours=c.readUshort(b,a),a+=2,d.maxCompositePoints=c.readUshort(b,a),a+=2,d.maxCompositeContours=c.readUshort(b,a),a+=2,d.maxZones=c.readUshort(b,a),a+=2,d.maxTwilightPoints=c.readUshort(b,a),a+=2,d.maxStorage= | ||
c.readUshort(b,a),a+=2,d.maxFunctionDefs=c.readUshort(b,a),a+=2,d.maxInstructionDefs=c.readUshort(b,a),a+=2,d.maxStackElements=c.readUshort(b,a),a+=2,d.maxSizeOfInstructions=c.readUshort(b,a),a+=2,d.maxComponentElements=c.readUshort(b,a),d.maxComponentDepth=c.readUshort(b,a+2));return d};g.name={};g.name.parse=function(b,a,c){c=g._bin;var d={};c.readUshort(b,a);a+=2;var e=c.readUshort(b,a);a+=2;c.readUshort(b,a);a+=2;for(var f="copyright fontFamily fontSubfamily ID fullName version postScriptName trademark manufacturer designer description urlVendor urlDesigner licence licenceURL --- typoFamilyName typoSubfamilyName compatibleFull sampleText postScriptCID wwsFamilyName wwsSubfamilyName lightPalette darkPalette".split(" "), | ||
h=a,k=0;k<e;k++){var n=c.readUshort(b,a);a+=2;var t=c.readUshort(b,a);a+=2;var u=c.readUshort(b,a);a+=2;var m=c.readUshort(b,a);a+=2;var q=c.readUshort(b,a);a+=2;var p=c.readUshort(b,a);a+=2;m=f[m];p=h+12*e+p;if(0==n)q=c.readUnicode(b,p,q/2);else if(3==n&&0==t)q=c.readUnicode(b,p,q/2);else if(0==t)q=c.readASCII(b,p,q);else if(1==t)q=c.readUnicode(b,p,q/2);else if(3==t)q=c.readUnicode(b,p,q/2);else if(1==n)q=c.readASCII(b,p,q),console.log("reading unknown MAC encoding "+t+" as ASCII");else throw"unknown encoding "+ | ||
t+", platformID: "+n;n="p"+n+","+u.toString(16);null==d[n]&&(d[n]={});d[n][m]=q;d[n]._lang=u}for(var r in d)if(null!=d[r].postScriptName&&1033==d[r]._lang)return d[r];for(r in d)if(null!=d[r].postScriptName&&0==d[r]._lang)return d[r];for(r in d)if(null!=d[r].postScriptName&&3084==d[r]._lang)return d[r];for(r in d)if(null!=d[r].postScriptName)return d[r];for(r in d){var l=r;break}console.log("returning name table with languageID "+d[l]._lang);return d[l]};g["OS/2"]={};g["OS/2"].parse=function(b,a, | ||
c){c=g._bin.readUshort(b,a);a+=2;var d={};if(0==c)g["OS/2"].version0(b,a,d);else if(1==c)g["OS/2"].version1(b,a,d);else if(2==c||3==c||4==c)g["OS/2"].version2(b,a,d);else if(5==c)g["OS/2"].version5(b,a,d);else throw"unknown OS/2 table version: "+c;return d};g["OS/2"].version0=function(b,a,c){var d=g._bin;c.xAvgCharWidth=d.readShort(b,a);a+=2;c.usWeightClass=d.readUshort(b,a);a+=2;c.usWidthClass=d.readUshort(b,a);a+=2;c.fsType=d.readUshort(b,a);a+=2;c.ySubscriptXSize=d.readShort(b,a);a+=2;c.ySubscriptYSize= | ||
d.readShort(b,a);a+=2;c.ySubscriptXOffset=d.readShort(b,a);a+=2;c.ySubscriptYOffset=d.readShort(b,a);a+=2;c.ySuperscriptXSize=d.readShort(b,a);a+=2;c.ySuperscriptYSize=d.readShort(b,a);a+=2;c.ySuperscriptXOffset=d.readShort(b,a);a+=2;c.ySuperscriptYOffset=d.readShort(b,a);a+=2;c.yStrikeoutSize=d.readShort(b,a);a+=2;c.yStrikeoutPosition=d.readShort(b,a);a+=2;c.sFamilyClass=d.readShort(b,a);a+=2;c.panose=d.readBytes(b,a,10);a+=10;c.ulUnicodeRange1=d.readUint(b,a);a+=4;c.ulUnicodeRange2=d.readUint(b, | ||
a);a+=4;c.ulUnicodeRange3=d.readUint(b,a);a+=4;c.ulUnicodeRange4=d.readUint(b,a);a+=4;c.achVendID=[d.readInt8(b,a),d.readInt8(b,a+1),d.readInt8(b,a+2),d.readInt8(b,a+3)];a+=4;c.fsSelection=d.readUshort(b,a);a+=2;c.usFirstCharIndex=d.readUshort(b,a);a+=2;c.usLastCharIndex=d.readUshort(b,a);a+=2;c.sTypoAscender=d.readShort(b,a);a+=2;c.sTypoDescender=d.readShort(b,a);a+=2;c.sTypoLineGap=d.readShort(b,a);a+=2;c.usWinAscent=d.readUshort(b,a);a+=2;c.usWinDescent=d.readUshort(b,a);return a+2};f["OS/2"].version1= | ||
function(b,a,c){var d=f._bin;a=f["OS/2"].version0(b,a,c);c.ulCodePageRange1=d.readUint(b,a);a+=4;c.ulCodePageRange2=d.readUint(b,a);return a+4};f["OS/2"].version2=function(b,a,c){var d=f._bin;a=f["OS/2"].version1(b,a,c);c.sxHeight=d.readShort(b,a);a+=2;c.sCapHeight=d.readShort(b,a);a+=2;c.usDefault=d.readUshort(b,a);a+=2;c.usBreak=d.readUshort(b,a);a+=2;c.usMaxContext=d.readUshort(b,a);return a+2};f["OS/2"].version5=function(b,a,c){var d=f._bin;a=f["OS/2"].version2(b,a,c);c.usLowerOpticalPointSize= | ||
d.readUshort(b,a);a+=2;c.usUpperOpticalPointSize=d.readUshort(b,a);return a+2};f.post={};f.post.parse=function(b,a,c){c=f._bin;var d={};d.version=c.readFixed(b,a);a+=4;d.italicAngle=c.readFixed(b,a);a+=4;d.underlinePosition=c.readShort(b,a);d.underlineThickness=c.readShort(b,a+2);return d};f.SVG={};f.SVG.parse=function(b,a,c){c=f._bin;var d={entries:[]},e=a;c.readUshort(b,a);a+=2;var g=c.readUint(b,a);c.readUint(b,a+4);a=g+e;var h=c.readUshort(b,a);a+=2;for(var k=0;k<h;k++){var n=c.readUshort(b,a); | ||
a+=2;var t=c.readUshort(b,a);a+=2;var u=c.readUint(b,a);a+=4;var m=c.readUint(b,a);a+=4;u=new Uint8Array(b.buffer,e+u+g,m);for(u=c.readUTF8(u,0,u.length);n<=t;n++)d.entries[n]=u}return d};f.SVG.toPath=function(b){var a={cmds:[],crds:[]};if(null==b)return a;for(var c=(new DOMParser).parseFromString(b,"image/svg+xml").firstChild;"svg"!=c.tagName;)c=c.nextSibling;b=(b=c.getAttribute("viewBox"))?b.trim().split(" ").map(parseFloat):[0,0,1E3,1E3];f.SVG._toPath(c.children,a);for(c=0;c<a.crds.length;c+=2){var d= | ||
a.crds[c],e=a.crds[c+1];d-=b[0];e-=b[1];e=-e;a.crds[c]=d;a.crds[c+1]=e}return a};f.SVG._toPath=function(b,a,c){for(var d=0;d<b.length;d++){var e=b[d],g=e.tagName,h=e.getAttribute("fill");null==h&&(h=c);"g"==g?f.SVG._toPath(e.children,a,h):"path"==g?(a.cmds.push(h?h:"#000000"),e=e.getAttribute("d"),e=f.SVG._tokens(e),f.SVG._toksToPath(e,a),a.cmds.push("X")):"defs"!=g&&console.log(g,e)}};f.SVG._tokens=function(b){for(var a=[],c=0,d=!1,e="";c<b.length;){var g=b.charCodeAt(c),f=b.charAt(c);c++;g=48<= | ||
g&&57>=g||"."==f||"-"==f;d?"-"==f?(a.push(parseFloat(e)),e=f):g?e+=f:(a.push(parseFloat(e)),","!=f&&" "!=f&&a.push(f),d=!1):g?(e=f,d=!0):","!=f&&" "!=f&&a.push(f)}d&&a.push(parseFloat(e));return a};f.SVG._toksToPath=function(b,a){var c=0,d=0,e=0,g=0,h=0,k={M:2,L:2,H:1,V:1,S:4,C:6},n=a.cmds;for(a=a.crds;c<b.length;){var t=b[c];c++;if("z"==t)n.push("Z"),d=g,e=h;else for(var u=t.toUpperCase(),m=f.SVG._reps(b,c,k[u]),q=0;q<m;q++){var p=0,r=0;t!=u&&(p=d,r=e);if("M"==u)d=p+b[c++],e=r+b[c++],n.push("M"), | ||
a.push(d,e),g=d,h=e;else if("L"==u)d=p+b[c++],e=r+b[c++],n.push("L"),a.push(d,e);else if("H"==u)d=p+b[c++],n.push("L"),a.push(d,e);else if("V"==u)e=r+b[c++],n.push("L"),a.push(d,e);else if("C"==u){d=p+b[c++];e=r+b[c++];var l=p+b[c++],v=r+b[c++];p+=b[c++];r+=b[c++];n.push("C");a.push(d,e,l,v,p,r);d=p;e=r}else"S"==u?(l=Math.max(a.length-4,0),d=d+d-a[l],e=e+e-a[l+1],l=p+b[c++],v=r+b[c++],p+=b[c++],r+=b[c++],n.push("C"),a.push(d,e,l,v,p,r),d=p,e=r):console.log("Unknown SVG command "+t)}}};f.SVG._reps= | ||
function(b,a,c){for(var d=a;d<b.length&&"string"!=typeof b[d];)d+=c;return(d-a)/c};null==f&&(f={});null==f.U&&(f.U={});f.U.codeToGlyph=function(b,a){b=b.cmap;var c=-1;null!=b.p0e4?c=b.p0e4:null!=b.p3e1?c=b.p3e1:null!=b.p1e0?c=b.p1e0:null!=b.p0e3&&(c=b.p0e3);if(-1==c)throw"no familiar platform and encoding!";b=b.tables[c];if(0==b.format)return a>=b.map.length?0:b.map[a];if(4==b.format){var d=-1;for(c=0;c<b.endCount.length;c++)if(a<=b.endCount[c]){d=c;break}return-1==d||b.startCount[d]>a?0:(0!=b.idRangeOffset[d]? | ||
b.glyphIdArray[a-b.startCount[d]+(b.idRangeOffset[d]>>1)-(b.idRangeOffset.length-d)]:a+b.idDelta[d])&65535}if(12==b.format){if(a>b.groups[b.groups.length-1][1])return 0;for(c=0;c<b.groups.length;c++)if(d=b.groups[c],d[0]<=a&&a<=d[1])return d[2]+(a-d[0]);return 0}throw"unknown cmap table format "+b.format;};f.U.glyphToPath=function(b,a){var c={cmds:[],crds:[]};if(b.SVG&&b.SVG.entries[a]){var d=b.SVG.entries[a];if(null==d)return c;"string"==typeof d&&(d=f.SVG.toPath(d),b.SVG.entries[a]=d);return d}if(b.CFF){d= | ||
{x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:b.CFF.Private?b.CFF.Private.defaultWidthX:0,open:!1};var e=b.CFF,g=b.CFF.Private;if(e.ROS){for(g=0;e.FDSelect[g+2]<=a;)g+=2;g=e.FDArray[e.FDSelect[g+1]].Private}f.U._drawCFF(b.CFF.CharStrings[a],d,e,g,c)}else b.glyf&&f.U._drawGlyf(a,b,c);return c};f.U._drawGlyf=function(b,a,c){var d=a.glyf[b];null==d&&(d=a.glyf[b]=f.glyf._parseGlyf(a,b));null!=d&&(-1<d.noc?f.U._simpleGlyph(d,c):f.U._compoGlyph(d,a,c))};f.U._simpleGlyph=function(b,a){for(var c=0;c<b.noc;c++){for(var d= | ||
0==c?0:b.endPts[c-1]+1,e=b.endPts[c],g=d;g<=e;g++){var h=g==d?e:g-1,k=g==e?d:g+1,n=b.flags[g]&1,t=b.flags[h]&1,u=b.flags[k]&1,m=b.xs[g],q=b.ys[g];if(g==d)if(n)if(t)f.U.P.moveTo(a,b.xs[h],b.ys[h]);else{f.U.P.moveTo(a,m,q);continue}else t?f.U.P.moveTo(a,b.xs[h],b.ys[h]):f.U.P.moveTo(a,(b.xs[h]+m)/2,(b.ys[h]+q)/2);n?t&&f.U.P.lineTo(a,m,q):u?f.U.P.qcurveTo(a,m,q,b.xs[k],b.ys[k]):f.U.P.qcurveTo(a,m,q,(m+b.xs[k])/2,(q+b.ys[k])/2)}f.U.P.closePath(a)}};f.U._compoGlyph=function(b,a,c){for(var d=0;d<b.parts.length;d++){var e= | ||
{cmds:[],crds:[]},g=b.parts[d];f.U._drawGlyf(g.glyphIndex,a,e);g=g.m;for(var h=0;h<e.crds.length;h+=2){var k=e.crds[h],n=e.crds[h+1];c.crds.push(k*g.a+n*g.b+g.tx);c.crds.push(k*g.c+n*g.d+g.ty)}for(h=0;h<e.cmds.length;h++)c.cmds.push(e.cmds[h])}};f.U._getGlyphClass=function(b,a){b=f._lctf.getInterval(a,b);return-1==b?0:a[b+2]};f.U.getPairAdjustment=function(b,a,c){if(b.GPOS){var d=b.GPOS,e=d.lookupList;d=d.featureList;for(var g=[],h=0;h<d.length;h++){var k=d[h];if("kern"==k.tag)for(var n=0;n<k.tab.length;n++)if(!g[k.tab[n]]){g[k.tab[n]]= | ||
!0;for(var t=e[k.tab[n]],u=0;u<t.tabs.length;u++)if(null!=t.tabs[h]){var m=t.tabs[u];if(m.coverage){var q=f._lctf.coverageIndex(m.coverage,a);if(-1==q)continue}if(1!=t.ltype&&2==t.ltype){var p;if(1==m.fmt)for(m=m.pairsets[q],h=0;h<m.length;h++)m[h].gid2==c&&(p=m[h]);else if(2==m.fmt){p=f.U._getGlyphClass(a,m.classDef1);var r=f.U._getGlyphClass(c,m.classDef2);p=m.matrix[p][r]}if(p&&p.val2)return p.val2[2]}}}}}return b.kern&&(a=b.kern.glyph1.indexOf(a),-1!=a&&(c=b.kern.rval[a].glyph2.indexOf(c),-1!= | ||
c))?b.kern.rval[a].vals[c]:0};f.U.stringToGlyphs=function(b,a){for(var c=[],d=0;d<a.length;d++){var e=a.codePointAt(d);65535<e&&d++;c.push(f.U.codeToGlyph(b,e))}for(d=0;d<a.length;d++){e=a.codePointAt(d);if(2367==e){var g=c[d-1];c[d-1]=c[d];c[d]=g}65535<e&&d++}d=b.GSUB;if(null==d)return c;b=d.lookupList;d=d.featureList;e="rlig liga mset isol init fina medi half pres blws".split(" ");g=[];for(var h=0;h<d.length;h++){var k=d[h];if(-1!=e.indexOf(k.tag))for(var n=0;n<k.tab.length;n++)if(!g[k.tab[n]]){g[k.tab[n]]= | ||
!0;for(var t=b[k.tab[n]],u=0;u<c.length;u++){var m=f.U._getWPfeature(a,u);-1!="isol,init,fina,medi".indexOf(k.tag)&&k.tag!=m||f.U._applySubs(c,u,t,b)}}}return c};f.U._getWPfeature=function(b,a){var c=0==a||-1!='\n\t" ,.:;!?() \u060c'.indexOf(b[a-1]),d=a==b.length-1||-1!='\n\t" ,.:;!?() \u060c'.indexOf(b[a+1]);c||-1=="\u0622\u0623\u0624\u0625\u0627\u0629\u062f\u0630\u0631\u0632\u0648\u0671\u0672\u0673\u0675\u0676\u0677\u0688\u0689\u068a\u068b\u068c\u068d\u068e\u068f\u0690\u0691\u0692\u0693\u0694\u0695\u0696\u0697\u0698\u0699\u06c0\u06c3\u06c4\u06c5\u06c6\u06c7\u06c8\u06c9\u06ca\u06cb\u06cd\u06cf\u06d2\u06d3\u06d5\u06ee\u06ef\u0710\u0715\u0716\u0717\u0718\u0719\u071e\u0728\u072a\u072c\u072f\u074d\u0759\u075a\u075b\u076b\u076c\u0771\u0773\u0774\u0778\u0779\u0840\u0846\u0847\u0849\u0854\u0867\u0869\u086a\u08aa\u08ab\u08ac\u08ae\u08b1\u08b2\u08b9\u0ac5\u0ac7\u0ac9\u0aca\u0ace\u0acf\u0ad0\u0ad1\u0ad2\u0add\u0ae1\u0ae4\u0aef\u0b81\u0b83\u0b84\u0b85\u0b89\u0b8c\u0b8e\u0b8f\u0b91\u0ba9\u0baa\u0bab\u0bac".indexOf(b[a- | ||
a);a+=4;c.ulUnicodeRange3=d.readUint(b,a);a+=4;c.ulUnicodeRange4=d.readUint(b,a);a+=4;c.achVendID=[d.readInt8(b,a),d.readInt8(b,a+1),d.readInt8(b,a+2),d.readInt8(b,a+3)];a+=4;c.fsSelection=d.readUshort(b,a);a+=2;c.usFirstCharIndex=d.readUshort(b,a);a+=2;c.usLastCharIndex=d.readUshort(b,a);a+=2;c.sTypoAscender=d.readShort(b,a);a+=2;c.sTypoDescender=d.readShort(b,a);a+=2;c.sTypoLineGap=d.readShort(b,a);a+=2;c.usWinAscent=d.readUshort(b,a);a+=2;c.usWinDescent=d.readUshort(b,a);return a+2};g["OS/2"].version1= | ||
function(b,a,c){var d=g._bin;a=g["OS/2"].version0(b,a,c);c.ulCodePageRange1=d.readUint(b,a);a+=4;c.ulCodePageRange2=d.readUint(b,a);return a+4};g["OS/2"].version2=function(b,a,c){var d=g._bin;a=g["OS/2"].version1(b,a,c);c.sxHeight=d.readShort(b,a);a+=2;c.sCapHeight=d.readShort(b,a);a+=2;c.usDefault=d.readUshort(b,a);a+=2;c.usBreak=d.readUshort(b,a);a+=2;c.usMaxContext=d.readUshort(b,a);return a+2};g["OS/2"].version5=function(b,a,c){var d=g._bin;a=g["OS/2"].version2(b,a,c);c.usLowerOpticalPointSize= | ||
d.readUshort(b,a);a+=2;c.usUpperOpticalPointSize=d.readUshort(b,a);return a+2};g.post={};g.post.parse=function(b,a,c){c=g._bin;var d={};d.version=c.readFixed(b,a);a+=4;d.italicAngle=c.readFixed(b,a);a+=4;d.underlinePosition=c.readShort(b,a);d.underlineThickness=c.readShort(b,a+2);return d};g.SVG={};g.SVG.parse=function(b,a,c){c=g._bin;var d={entries:[]},e=a;c.readUshort(b,a);a+=2;var f=c.readUint(b,a);c.readUint(b,a+4);a=f+e;var h=c.readUshort(b,a);a+=2;for(var k=0;k<h;k++){var n=c.readUshort(b,a); | ||
a+=2;var t=c.readUshort(b,a);a+=2;var u=c.readUint(b,a);a+=4;var m=c.readUint(b,a);a+=4;u=new Uint8Array(b.buffer,e+u+f,m);for(u=c.readUTF8(u,0,u.length);n<=t;n++)d.entries[n]=u}return d};g.SVG.toPath=function(b){var a={cmds:[],crds:[]};if(null==b)return a;for(var c=(new DOMParser).parseFromString(b,"image/svg+xml").firstChild;"svg"!=c.tagName;)c=c.nextSibling;b=(b=c.getAttribute("viewBox"))?b.trim().split(" ").map(parseFloat):[0,0,1E3,1E3];g.SVG._toPath(c.children,a);for(c=0;c<a.crds.length;c+=2){var d= | ||
a.crds[c],e=a.crds[c+1];d-=b[0];e-=b[1];e=-e;a.crds[c]=d;a.crds[c+1]=e}return a};g.SVG._toPath=function(b,a,c){for(var d=0;d<b.length;d++){var e=b[d],f=e.tagName,h=e.getAttribute("fill");null==h&&(h=c);"g"==f?g.SVG._toPath(e.children,a,h):"path"==f?(a.cmds.push(h?h:"#000000"),e=e.getAttribute("d"),e=g.SVG._tokens(e),g.SVG._toksToPath(e,a),a.cmds.push("X")):"defs"!=f&&console.log(f,e)}};g.SVG._tokens=function(b){for(var a=[],c=0,d=!1,e="";c<b.length;){var f=b.charCodeAt(c),g=b.charAt(c);c++;f=48<= | ||
f&&57>=f||"."==g||"-"==g;d?"-"==g?(a.push(parseFloat(e)),e=g):f?e+=g:(a.push(parseFloat(e)),","!=g&&" "!=g&&a.push(g),d=!1):f?(e=g,d=!0):","!=g&&" "!=g&&a.push(g)}d&&a.push(parseFloat(e));return a};g.SVG._toksToPath=function(b,a){var c=0,d=0,e=0,f=0,h=0,k={M:2,L:2,H:1,V:1,S:4,C:6},n=a.cmds;for(a=a.crds;c<b.length;){var t=b[c];c++;if("z"==t)n.push("Z"),d=f,e=h;else for(var u=t.toUpperCase(),m=g.SVG._reps(b,c,k[u]),q=0;q<m;q++){var p=0,r=0;t!=u&&(p=d,r=e);if("M"==u)d=p+b[c++],e=r+b[c++],n.push("M"), | ||
a.push(d,e),f=d,h=e;else if("L"==u)d=p+b[c++],e=r+b[c++],n.push("L"),a.push(d,e);else if("H"==u)d=p+b[c++],n.push("L"),a.push(d,e);else if("V"==u)e=r+b[c++],n.push("L"),a.push(d,e);else if("C"==u){d=p+b[c++];e=r+b[c++];var l=p+b[c++],v=r+b[c++];p+=b[c++];r+=b[c++];n.push("C");a.push(d,e,l,v,p,r);d=p;e=r}else"S"==u?(l=Math.max(a.length-4,0),d=d+d-a[l],e=e+e-a[l+1],l=p+b[c++],v=r+b[c++],p+=b[c++],r+=b[c++],n.push("C"),a.push(d,e,l,v,p,r),d=p,e=r):console.log("Unknown SVG command "+t)}}};g.SVG._reps= | ||
function(b,a,c){for(var d=a;d<b.length&&"string"!=typeof b[d];)d+=c;return(d-a)/c};null==g&&(g={});null==g.U&&(g.U={});g.U.codeToGlyph=function(b,a){b=b.cmap;var c=-1;null!=b.p0e4?c=b.p0e4:null!=b.p3e1?c=b.p3e1:null!=b.p1e0?c=b.p1e0:null!=b.p0e3&&(c=b.p0e3);if(-1==c)throw"no familiar platform and encoding!";b=b.tables[c];if(0==b.format)return a>=b.map.length?0:b.map[a];if(4==b.format){var d=-1;for(c=0;c<b.endCount.length;c++)if(a<=b.endCount[c]){d=c;break}return-1==d||b.startCount[d]>a?0:(0!=b.idRangeOffset[d]? | ||
b.glyphIdArray[a-b.startCount[d]+(b.idRangeOffset[d]>>1)-(b.idRangeOffset.length-d)]:a+b.idDelta[d])&65535}if(12==b.format){if(a>b.groups[b.groups.length-1][1])return 0;for(c=0;c<b.groups.length;c++)if(d=b.groups[c],d[0]<=a&&a<=d[1])return d[2]+(a-d[0]);return 0}throw"unknown cmap table format "+b.format;};g.U.glyphToPath=function(b,a){var c={cmds:[],crds:[]};if(b.SVG&&b.SVG.entries[a]){var d=b.SVG.entries[a];if(null==d)return c;"string"==typeof d&&(d=g.SVG.toPath(d),b.SVG.entries[a]=d);return d}if(b.CFF){d= | ||
{x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:b.CFF.Private?b.CFF.Private.defaultWidthX:0,open:!1};var e=b.CFF,f=b.CFF.Private;if(e.ROS){for(f=0;e.FDSelect[f+2]<=a;)f+=2;f=e.FDArray[e.FDSelect[f+1]].Private}g.U._drawCFF(b.CFF.CharStrings[a],d,e,f,c)}else b.glyf&&g.U._drawGlyf(a,b,c);return c};g.U._drawGlyf=function(b,a,c){var d=a.glyf[b];null==d&&(d=a.glyf[b]=g.glyf._parseGlyf(a,b));null!=d&&(-1<d.noc?g.U._simpleGlyph(d,c):g.U._compoGlyph(d,a,c))};g.U._simpleGlyph=function(b,a){for(var c=0;c<b.noc;c++){for(var d= | ||
0==c?0:b.endPts[c-1]+1,e=b.endPts[c],f=d;f<=e;f++){var h=f==d?e:f-1,k=f==e?d:f+1,n=b.flags[f]&1,t=b.flags[h]&1,u=b.flags[k]&1,m=b.xs[f],q=b.ys[f];if(f==d)if(n)if(t)g.U.P.moveTo(a,b.xs[h],b.ys[h]);else{g.U.P.moveTo(a,m,q);continue}else t?g.U.P.moveTo(a,b.xs[h],b.ys[h]):g.U.P.moveTo(a,(b.xs[h]+m)/2,(b.ys[h]+q)/2);n?t&&g.U.P.lineTo(a,m,q):u?g.U.P.qcurveTo(a,m,q,b.xs[k],b.ys[k]):g.U.P.qcurveTo(a,m,q,(m+b.xs[k])/2,(q+b.ys[k])/2)}g.U.P.closePath(a)}};g.U._compoGlyph=function(b,a,c){for(var d=0;d<b.parts.length;d++){var e= | ||
{cmds:[],crds:[]},f=b.parts[d];g.U._drawGlyf(f.glyphIndex,a,e);f=f.m;for(var h=0;h<e.crds.length;h+=2){var k=e.crds[h],n=e.crds[h+1];c.crds.push(k*f.a+n*f.b+f.tx);c.crds.push(k*f.c+n*f.d+f.ty)}for(h=0;h<e.cmds.length;h++)c.cmds.push(e.cmds[h])}};g.U._getGlyphClass=function(b,a){b=g._lctf.getInterval(a,b);return-1==b?0:a[b+2]};g.U.getPairAdjustment=function(b,a,c){if(b.GPOS){var d=b.GPOS,e=d.lookupList;d=d.featureList;for(var f=[],h=0;h<d.length;h++){var k=d[h];if("kern"==k.tag)for(var n=0;n<k.tab.length;n++)if(!f[k.tab[n]]){f[k.tab[n]]= | ||
!0;for(var t=e[k.tab[n]],u=0;u<t.tabs.length;u++)if(null!=t.tabs[h]){var m=t.tabs[u];if(m.coverage){var q=g._lctf.coverageIndex(m.coverage,a);if(-1==q)continue}if(1!=t.ltype&&2==t.ltype){var p;if(1==m.fmt)for(m=m.pairsets[q],h=0;h<m.length;h++)m[h].gid2==c&&(p=m[h]);else if(2==m.fmt){p=g.U._getGlyphClass(a,m.classDef1);var r=g.U._getGlyphClass(c,m.classDef2);p=m.matrix[p][r]}if(p&&p.val2)return p.val2[2]}}}}}return b.kern&&(a=b.kern.glyph1.indexOf(a),-1!=a&&(c=b.kern.rval[a].glyph2.indexOf(c),-1!= | ||
c))?b.kern.rval[a].vals[c]:0};g.U.stringToGlyphs=function(b,a){for(var c=[],d=0;d<a.length;d++){var e=a.codePointAt(d);65535<e&&d++;c.push(g.U.codeToGlyph(b,e))}for(d=0;d<a.length;d++){e=a.codePointAt(d);if(2367==e){var f=c[d-1];c[d-1]=c[d];c[d]=f}65535<e&&d++}d=b.GSUB;if(null==d)return c;b=d.lookupList;d=d.featureList;e="rlig liga mset isol init fina medi half pres blws".split(" ");f=[];for(var h=0;h<d.length;h++){var k=d[h];if(-1!=e.indexOf(k.tag))for(var n=0;n<k.tab.length;n++)if(!f[k.tab[n]]){f[k.tab[n]]= | ||
!0;for(var t=b[k.tab[n]],u=0;u<c.length;u++){var m=g.U._getWPfeature(a,u);-1!="isol,init,fina,medi".indexOf(k.tag)&&k.tag!=m||g.U._applySubs(c,u,t,b)}}}return c};g.U._getWPfeature=function(b,a){var c=0==a||-1!='\n\t" ,.:;!?() \u060c'.indexOf(b[a-1]),d=a==b.length-1||-1!='\n\t" ,.:;!?() \u060c'.indexOf(b[a+1]);c||-1=="\u0622\u0623\u0624\u0625\u0627\u0629\u062f\u0630\u0631\u0632\u0648\u0671\u0672\u0673\u0675\u0676\u0677\u0688\u0689\u068a\u068b\u068c\u068d\u068e\u068f\u0690\u0691\u0692\u0693\u0694\u0695\u0696\u0697\u0698\u0699\u06c0\u06c3\u06c4\u06c5\u06c6\u06c7\u06c8\u06c9\u06ca\u06cb\u06cd\u06cf\u06d2\u06d3\u06d5\u06ee\u06ef\u0710\u0715\u0716\u0717\u0718\u0719\u071e\u0728\u072a\u072c\u072f\u074d\u0759\u075a\u075b\u076b\u076c\u0771\u0773\u0774\u0778\u0779\u0840\u0846\u0847\u0849\u0854\u0867\u0869\u086a\u08aa\u08ab\u08ac\u08ae\u08b1\u08b2\u08b9\u0ac5\u0ac7\u0ac9\u0aca\u0ace\u0acf\u0ad0\u0ad1\u0ad2\u0add\u0ae1\u0ae4\u0aef\u0b81\u0b83\u0b84\u0b85\u0b89\u0b8c\u0b8e\u0b8f\u0b91\u0ba9\u0baa\u0bab\u0bac".indexOf(b[a- | ||
1])||(c=!0);d||-1=="\u0622\u0623\u0624\u0625\u0627\u0629\u062f\u0630\u0631\u0632\u0648\u0671\u0672\u0673\u0675\u0676\u0677\u0688\u0689\u068a\u068b\u068c\u068d\u068e\u068f\u0690\u0691\u0692\u0693\u0694\u0695\u0696\u0697\u0698\u0699\u06c0\u06c3\u06c4\u06c5\u06c6\u06c7\u06c8\u06c9\u06ca\u06cb\u06cd\u06cf\u06d2\u06d3\u06d5\u06ee\u06ef\u0710\u0715\u0716\u0717\u0718\u0719\u071e\u0728\u072a\u072c\u072f\u074d\u0759\u075a\u075b\u076b\u076c\u0771\u0773\u0774\u0778\u0779\u0840\u0846\u0847\u0849\u0854\u0867\u0869\u086a\u08aa\u08ab\u08ac\u08ae\u08b1\u08b2\u08b9\u0ac5\u0ac7\u0ac9\u0aca\u0ace\u0acf\u0ad0\u0ad1\u0ad2\u0add\u0ae1\u0ae4\u0aef\u0b81\u0b83\u0b84\u0b85\u0b89\u0b8c\u0b8e\u0b8f\u0b91\u0ba9\u0baa\u0bab\u0bac".indexOf(b[a])|| | ||
(d=!0);d||-1=="\ua872\u0acd\u0ad7".indexOf(b[a+1])||(d=!0);c||-1=="\ua872\u0acd\u0ad7".indexOf(b[a])||(c=!0);return c?d?"isol":"init":d?"fina":"medi"};f.U._applySubs=function(b,a,c,d){for(var e=b.length-a-1,g=0;g<c.tabs.length;g++)if(null!=c.tabs[g]){var h=c.tabs[g];if(h.coverage){var k=f._lctf.coverageIndex(h.coverage,b[a]);if(-1==k)continue}if(1==c.ltype)b[a]=1==h.fmt?b[a]+h.delta:h.newg[k];else if(4==c.ltype)for(var n=h.vals[k],t=0;t<n.length;t++){var u=n[t];h=u.chain.length;if(!(h>e)){for(var m= | ||
!0,q=0,p=0;p<h;p++){for(;-1==b[a+q+(1+p)];)q++;u.chain[p]!=b[a+q+(1+p)]&&(m=!1)}if(m){b[a]=u.nglyph;for(p=0;p<h+q;p++)b[a+p+1]=-1;break}}}else if(5==c.ltype&&2==h.fmt)for(n=f._lctf.getInterval(h.cDef,b[a]),q=h.scset[h.cDef[n+2]],u=0;u<q.length;u++){t=q[u];var r=t.input;if(!(r.length>e)){m=!0;for(p=0;p<r.length;p++){var l=f._lctf.getInterval(h.cDef,b[a+1+p]);if(-1==n&&h.cDef[l+2]!=r[p]){m=!1;break}}if(m)for(m=t.substLookupRecords,t=0;t<m.length;t+=2);}}else if(6==c.ltype&&3==h.fmt&&f.U._glsCovered(b, | ||
h.backCvg,a-h.backCvg.length)&&f.U._glsCovered(b,h.inptCvg,a)&&f.U._glsCovered(b,h.ahedCvg,a+h.inptCvg.length))for(m=h.lookupRec,u=0;u<m.length;u+=2)n=m[u],f.U._applySubs(b,a+n,d[m[u+1]],d)}};f.U._glsCovered=function(b,a,c){for(var d=0;d<a.length;d++)if(-1==f._lctf.coverageIndex(a[d],b[c+d]))return!1;return!0};f.U.glyphsToPath=function(b,a,c){for(var d={cmds:[],crds:[]},e=0,g=0;g<a.length;g++){var h=a[g];if(-1!=h){for(var k=g<a.length-1&&-1!=a[g+1]?a[g+1]:0,n=f.U.glyphToPath(b,h),t=0;t<n.crds.length;t+= | ||
2)d.crds.push(n.crds[t]+e),d.crds.push(n.crds[t+1]);c&&d.cmds.push(c);for(t=0;t<n.cmds.length;t++)d.cmds.push(n.cmds[t]);c&&d.cmds.push("X");e+=b.hmtx.aWidth[h];g<a.length-1&&(e+=f.U.getPairAdjustment(b,h,k))}}return d};f.U.pathToSVG=function(b,a){null==a&&(a=5);for(var c=[],d=0,e={M:2,L:2,Q:4,C:6},g=0;g<b.cmds.length;g++){var f=b.cmds[g],k=d+(e[f]?e[f]:0);for(c.push(f);d<k;)f=b.crds[d++],c.push(parseFloat(f.toFixed(a))+(d==k?"":" "))}return c.join("")};f.U.pathToContext=function(b,a){for(var c=0, | ||
d=b.crds,e=0;e<b.cmds.length;e++){var g=b.cmds[e];"M"==g?(a.moveTo(d[c],d[c+1]),c+=2):"L"==g?(a.lineTo(d[c],d[c+1]),c+=2):"C"==g?(a.bezierCurveTo(d[c],d[c+1],d[c+2],d[c+3],d[c+4],d[c+5]),c+=6):"Q"==g?(a.quadraticCurveTo(d[c],d[c+1],d[c+2],d[c+3]),c+=4):"#"==g.charAt(0)?(a.beginPath(),a.fillStyle=g):"Z"==g?a.closePath():"X"==g&&a.fill()}};f.U.P={};f.U.P.moveTo=function(b,a,c){b.cmds.push("M");b.crds.push(a,c)};f.U.P.lineTo=function(b,a,c){b.cmds.push("L");b.crds.push(a,c)};f.U.P.curveTo=function(b, | ||
a,c,d,e,g,f){b.cmds.push("C");b.crds.push(a,c,d,e,g,f)};f.U.P.qcurveTo=function(b,a,c,d,e){b.cmds.push("Q");b.crds.push(a,c,d,e)};f.U.P.closePath=function(b){b.cmds.push("Z")};f.U._drawCFF=function(b,a,c,d,e){for(var g=a.stack,h=a.nStems,k=a.haveWidth,n=a.width,t=a.open,u=0,m=a.x,q=a.y,p,r,l,v,x,z,B,D,E,G,y={val:0,size:0};u<b.length;){f.CFF.getCharString(b,u,y);var w=y.val;u+=y.size;if("o1"==w||"o18"==w)(p=0!==g.length%2)&&!k&&(n=g.shift()+d.nominalWidthX),h+=g.length>>1,g.length=0,k=!0;else if("o3"== | ||
w||"o23"==w)(p=0!==g.length%2)&&!k&&(n=g.shift()+d.nominalWidthX),h+=g.length>>1,g.length=0,k=!0;else if("o4"==w)1<g.length&&!k&&(n=g.shift()+d.nominalWidthX,k=!0),t&&f.U.P.closePath(e),q+=g.pop(),f.U.P.moveTo(e,m,q),t=!0;else if("o5"==w)for(;0<g.length;)m+=g.shift(),q+=g.shift(),f.U.P.lineTo(e,m,q);else if("o6"==w||"o7"==w)for(x=g.length,p="o6"==w,r=0;r<x;r++)l=g.shift(),p?m+=l:q+=l,p=!p,f.U.P.lineTo(e,m,q);else if("o8"==w||"o24"==w){x=g.length;for(z=0;z+6<=x;)p=m+g.shift(),r=q+g.shift(),l=p+g.shift(), | ||
v=r+g.shift(),m=l+g.shift(),q=v+g.shift(),f.U.P.curveTo(e,p,r,l,v,m,q),z+=6;"o24"==w&&(m+=g.shift(),q+=g.shift(),f.U.P.lineTo(e,m,q))}else if("o11"==w)break;else if("o1234"==w||"o1235"==w||"o1236"==w||"o1237"==w)"o1234"==w&&(p=m+g.shift(),r=q,l=p+g.shift(),v=r+g.shift(),E=l+g.shift(),G=v,x=E+g.shift(),z=v,B=x+g.shift(),D=q,m=B+g.shift(),f.U.P.curveTo(e,p,r,l,v,E,G),f.U.P.curveTo(e,x,z,B,D,m,q)),"o1235"==w&&(p=m+g.shift(),r=q+g.shift(),l=p+g.shift(),v=r+g.shift(),E=l+g.shift(),G=v+g.shift(),x=E+g.shift(), | ||
z=G+g.shift(),B=x+g.shift(),D=z+g.shift(),m=B+g.shift(),q=D+g.shift(),g.shift(),f.U.P.curveTo(e,p,r,l,v,E,G),f.U.P.curveTo(e,x,z,B,D,m,q)),"o1236"==w&&(p=m+g.shift(),r=q+g.shift(),l=p+g.shift(),v=r+g.shift(),E=l+g.shift(),G=v,x=E+g.shift(),z=v,B=x+g.shift(),D=z+g.shift(),m=B+g.shift(),f.U.P.curveTo(e,p,r,l,v,E,G),f.U.P.curveTo(e,x,z,B,D,m,q)),"o1237"==w&&(p=m+g.shift(),r=q+g.shift(),l=p+g.shift(),v=r+g.shift(),E=l+g.shift(),G=v+g.shift(),x=E+g.shift(),z=G+g.shift(),B=x+g.shift(),D=z+g.shift(),Math.abs(B- | ||
m)>Math.abs(D-q)?m=B+g.shift():q=D+g.shift(),f.U.P.curveTo(e,p,r,l,v,E,G),f.U.P.curveTo(e,x,z,B,D,m,q));else if("o14"==w)0<g.length&&!k&&(n=g.shift()+c.nominalWidthX,k=!0),4==g.length&&(p=g.shift(),r=g.shift(),v=g.shift(),l=g.shift(),v=f.CFF.glyphBySE(c,v),l=f.CFF.glyphBySE(c,l),f.U._drawCFF(c.CharStrings[v],a,c,d,e),a.x=p,a.y=r,f.U._drawCFF(c.CharStrings[l],a,c,d,e)),t&&(f.U.P.closePath(e),t=!1);else if("o19"==w||"o20"==w)(p=0!==g.length%2)&&!k&&(n=g.shift()+d.nominalWidthX),h+=g.length>>1,g.length= | ||
0,k=!0,u+=h+7>>3;else if("o21"==w)2<g.length&&!k&&(n=g.shift()+d.nominalWidthX,k=!0),q+=g.pop(),m+=g.pop(),t&&f.U.P.closePath(e),f.U.P.moveTo(e,m,q),t=!0;else if("o22"==w)1<g.length&&!k&&(n=g.shift()+d.nominalWidthX,k=!0),m+=g.pop(),t&&f.U.P.closePath(e),f.U.P.moveTo(e,m,q),t=!0;else if("o25"==w){for(;6<g.length;)m+=g.shift(),q+=g.shift(),f.U.P.lineTo(e,m,q);p=m+g.shift();r=q+g.shift();l=p+g.shift();v=r+g.shift();m=l+g.shift();q=v+g.shift();f.U.P.curveTo(e,p,r,l,v,m,q)}else if("o26"==w)for(g.length% | ||
2&&(m+=g.shift());0<g.length;)p=m,r=q+g.shift(),l=p+g.shift(),v=r+g.shift(),m=l,q=v+g.shift(),f.U.P.curveTo(e,p,r,l,v,m,q);else if("o27"==w)for(g.length%2&&(q+=g.shift());0<g.length;)p=m+g.shift(),r=q,l=p+g.shift(),v=r+g.shift(),m=l+g.shift(),q=v,f.U.P.curveTo(e,p,r,l,v,m,q);else if("o10"==w||"o29"==w)p="o10"==w?d:c,0==g.length?console.log("error: empty stack"):(r=g.pop(),p=p.Subrs[r+p.Bias],a.x=m,a.y=q,a.nStems=h,a.haveWidth=k,a.width=n,a.open=t,f.U._drawCFF(p,a,c,d,e),m=a.x,q=a.y,h=a.nStems,k=a.haveWidth, | ||
n=a.width,t=a.open);else if("o30"==w||"o31"==w)for(p=g.length,z=0,w="o31"==w,x=p&-3,z+=p-x;z<x;)w?(p=m+g.shift(),r=q,l=p+g.shift(),v=r+g.shift(),q=v+g.shift(),5==x-z?(m=l+g.shift(),z++):m=l,w=!1):(p=m,r=q+g.shift(),l=p+g.shift(),v=r+g.shift(),m=l+g.shift(),5==x-z?(q=v+g.shift(),z++):q=v,w=!0),f.U.P.curveTo(e,p,r,l,v,m,q),z+=4;else{if("o"==(w+"").charAt(0))throw console.log("Unknown operation: "+w,b),w;g.push(w)}}a.x=m;a.y=q;a.nStems=h;a.haveWidth=k;a.width=n;a.open=t};return f},function(){function l(b, | ||
a){function c(){var a=f.getUint16(k);k+=2;return a}function d(){var a=f.getUint32(k);k+=4;return a}function e(a){x.setUint16(z,a);z+=2}function g(a){x.setUint32(z,a);z+=4}var f=new DataView(b),k=0;d();var n=d();d();var l=c();c();d();c();c();d();d();d();d();d();for(var u=0;Math.pow(2,u)<=l;)u++;u--;for(var m=16*Math.pow(2,u),q=16*l-m,p=12,r=[],A=0;A<l;A++)r.push({tag:d(),offset:d(),compLength:d(),origLength:d(),origChecksum:d()}),p+=16;var v=new Uint8Array(12+16*r.length+r.reduce(function(a,b){return a+ | ||
b.origLength+4},0));A=v.buffer;var x=new DataView(A),z=0;g(n);e(l);e(m);e(u);e(q);r.forEach(function(a){g(a.tag);g(a.origChecksum);g(p);g(a.origLength);a.outOffset=p;p+=a.origLength;0!=p%4&&(p+=4-p%4)});var B;r.forEach(function(c){var d=b.slice(c.offset,c.offset+c.compLength);if(c.compLength!=c.origLength){var e=new Uint8Array(c.origLength);a(new Uint8Array(d,2),e)}else e=new Uint8Array(d);v.set(e,c.outOffset);p=c.outOffset+c.origLength;d=0;0!=p%4&&(d=4-p%4);v.set((new Uint8Array(d)).buffer,c.outOffset+ | ||
c.origLength);B=p+d});return A.slice(0,B)}var f=function(){function b(){this.table=new Uint16Array(16);this.trans=new Uint16Array(288)}function a(a,c){this.source=a;this.bitcount=this.tag=this.sourceIndex=0;this.dest=c;this.destLen=0;this.ltree=new b;this.dtree=new b}function c(a,b,c,d){var e;for(e=0;e<c;++e)a[e]=0;for(e=0;e<30-c;++e)a[e+c]=e/c|0;c=d;for(e=0;30>e;++e)b[e]=c,c+=1<<a[e]}function d(a,b,c,d){var e,g;for(e=0;16>e;++e)a.table[e]=0;for(e=0;e<d;++e)a.table[b[c+e]]++;for(e=g=a.table[0]=0;16> | ||
e;++e)v[e]=g,g+=a.table[e];for(e=0;e<d;++e)b[c+e]&&(a.trans[v[b[c+e]]++]=e)}function e(a,b,c){if(!b)return c;for(;24>a.bitcount;)a.tag|=a.source[a.sourceIndex++]<<a.bitcount,a.bitcount+=8;var d=a.tag&65535>>>16-b;a.tag>>>=b;a.bitcount-=b;return d+c}function g(a,b){for(;24>a.bitcount;)a.tag|=a.source[a.sourceIndex++]<<a.bitcount,a.bitcount+=8;var c=0,d=0,e=0,g=a.tag;do d=2*d+(g&1),g>>>=1,++e,c+=b.table[e],d-=b.table[e];while(0<=d);a.tag=g;a.bitcount-=e;return b.trans[c+d]}function f(a,b,c){for(;;){var d= | ||
g(a,b);if(256===d)return 0;if(256>d)a.dest[a.destLen++]=d;else{var f;d-=257;d=e(a,l[d],u[d]);var h=g(a,c);for(f=h=a.destLen-e(a,m[h],q[h]);f<h+d;++f)a.dest[a.destLen++]=a.dest[f]}}}var k=new b,n=new b,l=new Uint8Array(30),u=new Uint16Array(30),m=new Uint8Array(30),q=new Uint16Array(30),p=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),r=new b,A=new Uint8Array(320),v=new Uint16Array(16);(function(a,b){var c;for(c=0;7>c;++c)a.table[c]=0;a.table[7]=24;a.table[8]=152;a.table[9]=112;for(c= | ||
(d=!0);d||-1=="\ua872\u0acd\u0ad7".indexOf(b[a+1])||(d=!0);c||-1=="\ua872\u0acd\u0ad7".indexOf(b[a])||(c=!0);return c?d?"isol":"init":d?"fina":"medi"};g.U._applySubs=function(b,a,c,d){for(var e=b.length-a-1,f=0;f<c.tabs.length;f++)if(null!=c.tabs[f]){var h=c.tabs[f];if(h.coverage){var k=g._lctf.coverageIndex(h.coverage,b[a]);if(-1==k)continue}if(1==c.ltype)b[a]=1==h.fmt?b[a]+h.delta:h.newg[k];else if(4==c.ltype)for(var n=h.vals[k],t=0;t<n.length;t++){var u=n[t];h=u.chain.length;if(!(h>e)){for(var m= | ||
!0,q=0,p=0;p<h;p++){for(;-1==b[a+q+(1+p)];)q++;u.chain[p]!=b[a+q+(1+p)]&&(m=!1)}if(m){b[a]=u.nglyph;for(p=0;p<h+q;p++)b[a+p+1]=-1;break}}}else if(5==c.ltype&&2==h.fmt)for(n=g._lctf.getInterval(h.cDef,b[a]),q=h.scset[h.cDef[n+2]],u=0;u<q.length;u++){t=q[u];var r=t.input;if(!(r.length>e)){m=!0;for(p=0;p<r.length;p++){var l=g._lctf.getInterval(h.cDef,b[a+1+p]);if(-1==n&&h.cDef[l+2]!=r[p]){m=!1;break}}if(m)for(m=t.substLookupRecords,t=0;t<m.length;t+=2);}}else if(6==c.ltype&&3==h.fmt&&g.U._glsCovered(b, | ||
h.backCvg,a-h.backCvg.length)&&g.U._glsCovered(b,h.inptCvg,a)&&g.U._glsCovered(b,h.ahedCvg,a+h.inptCvg.length))for(m=h.lookupRec,u=0;u<m.length;u+=2)n=m[u],g.U._applySubs(b,a+n,d[m[u+1]],d)}};g.U._glsCovered=function(b,a,c){for(var d=0;d<a.length;d++)if(-1==g._lctf.coverageIndex(a[d],b[c+d]))return!1;return!0};g.U.glyphsToPath=function(b,a,c){for(var d={cmds:[],crds:[]},e=0,f=0;f<a.length;f++){var h=a[f];if(-1!=h){for(var k=f<a.length-1&&-1!=a[f+1]?a[f+1]:0,n=g.U.glyphToPath(b,h),t=0;t<n.crds.length;t+= | ||
2)d.crds.push(n.crds[t]+e),d.crds.push(n.crds[t+1]);c&&d.cmds.push(c);for(t=0;t<n.cmds.length;t++)d.cmds.push(n.cmds[t]);c&&d.cmds.push("X");e+=b.hmtx.aWidth[h];f<a.length-1&&(e+=g.U.getPairAdjustment(b,h,k))}}return d};g.U.pathToSVG=function(b,a){null==a&&(a=5);for(var c=[],d=0,e={M:2,L:2,Q:4,C:6},f=0;f<b.cmds.length;f++){var g=b.cmds[f],k=d+(e[g]?e[g]:0);for(c.push(g);d<k;)g=b.crds[d++],c.push(parseFloat(g.toFixed(a))+(d==k?"":" "))}return c.join("")};g.U.pathToContext=function(b,a){for(var c=0, | ||
d=b.crds,e=0;e<b.cmds.length;e++){var f=b.cmds[e];"M"==f?(a.moveTo(d[c],d[c+1]),c+=2):"L"==f?(a.lineTo(d[c],d[c+1]),c+=2):"C"==f?(a.bezierCurveTo(d[c],d[c+1],d[c+2],d[c+3],d[c+4],d[c+5]),c+=6):"Q"==f?(a.quadraticCurveTo(d[c],d[c+1],d[c+2],d[c+3]),c+=4):"#"==f.charAt(0)?(a.beginPath(),a.fillStyle=f):"Z"==f?a.closePath():"X"==f&&a.fill()}};g.U.P={};g.U.P.moveTo=function(b,a,c){b.cmds.push("M");b.crds.push(a,c)};g.U.P.lineTo=function(b,a,c){b.cmds.push("L");b.crds.push(a,c)};g.U.P.curveTo=function(b, | ||
a,c,d,e,f,g){b.cmds.push("C");b.crds.push(a,c,d,e,f,g)};g.U.P.qcurveTo=function(b,a,c,d,e){b.cmds.push("Q");b.crds.push(a,c,d,e)};g.U.P.closePath=function(b){b.cmds.push("Z")};g.U._drawCFF=function(b,a,c,d,e){for(var f=a.stack,h=a.nStems,k=a.haveWidth,n=a.width,t=a.open,u=0,m=a.x,q=a.y,p,r,l,v,x,z,B,D,E,G,y={val:0,size:0};u<b.length;){g.CFF.getCharString(b,u,y);var w=y.val;u+=y.size;if("o1"==w||"o18"==w)(p=0!==f.length%2)&&!k&&(n=f.shift()+d.nominalWidthX),h+=f.length>>1,f.length=0,k=!0;else if("o3"== | ||
w||"o23"==w)(p=0!==f.length%2)&&!k&&(n=f.shift()+d.nominalWidthX),h+=f.length>>1,f.length=0,k=!0;else if("o4"==w)1<f.length&&!k&&(n=f.shift()+d.nominalWidthX,k=!0),t&&g.U.P.closePath(e),q+=f.pop(),g.U.P.moveTo(e,m,q),t=!0;else if("o5"==w)for(;0<f.length;)m+=f.shift(),q+=f.shift(),g.U.P.lineTo(e,m,q);else if("o6"==w||"o7"==w)for(x=f.length,p="o6"==w,r=0;r<x;r++)l=f.shift(),p?m+=l:q+=l,p=!p,g.U.P.lineTo(e,m,q);else if("o8"==w||"o24"==w){x=f.length;for(z=0;z+6<=x;)p=m+f.shift(),r=q+f.shift(),l=p+f.shift(), | ||
v=r+f.shift(),m=l+f.shift(),q=v+f.shift(),g.U.P.curveTo(e,p,r,l,v,m,q),z+=6;"o24"==w&&(m+=f.shift(),q+=f.shift(),g.U.P.lineTo(e,m,q))}else if("o11"==w)break;else if("o1234"==w||"o1235"==w||"o1236"==w||"o1237"==w)"o1234"==w&&(p=m+f.shift(),r=q,l=p+f.shift(),v=r+f.shift(),E=l+f.shift(),G=v,x=E+f.shift(),z=v,B=x+f.shift(),D=q,m=B+f.shift(),g.U.P.curveTo(e,p,r,l,v,E,G),g.U.P.curveTo(e,x,z,B,D,m,q)),"o1235"==w&&(p=m+f.shift(),r=q+f.shift(),l=p+f.shift(),v=r+f.shift(),E=l+f.shift(),G=v+f.shift(),x=E+f.shift(), | ||
z=G+f.shift(),B=x+f.shift(),D=z+f.shift(),m=B+f.shift(),q=D+f.shift(),f.shift(),g.U.P.curveTo(e,p,r,l,v,E,G),g.U.P.curveTo(e,x,z,B,D,m,q)),"o1236"==w&&(p=m+f.shift(),r=q+f.shift(),l=p+f.shift(),v=r+f.shift(),E=l+f.shift(),G=v,x=E+f.shift(),z=v,B=x+f.shift(),D=z+f.shift(),m=B+f.shift(),g.U.P.curveTo(e,p,r,l,v,E,G),g.U.P.curveTo(e,x,z,B,D,m,q)),"o1237"==w&&(p=m+f.shift(),r=q+f.shift(),l=p+f.shift(),v=r+f.shift(),E=l+f.shift(),G=v+f.shift(),x=E+f.shift(),z=G+f.shift(),B=x+f.shift(),D=z+f.shift(),Math.abs(B- | ||
m)>Math.abs(D-q)?m=B+f.shift():q=D+f.shift(),g.U.P.curveTo(e,p,r,l,v,E,G),g.U.P.curveTo(e,x,z,B,D,m,q));else if("o14"==w)0<f.length&&!k&&(n=f.shift()+c.nominalWidthX,k=!0),4==f.length&&(p=f.shift(),r=f.shift(),v=f.shift(),l=f.shift(),v=g.CFF.glyphBySE(c,v),l=g.CFF.glyphBySE(c,l),g.U._drawCFF(c.CharStrings[v],a,c,d,e),a.x=p,a.y=r,g.U._drawCFF(c.CharStrings[l],a,c,d,e)),t&&(g.U.P.closePath(e),t=!1);else if("o19"==w||"o20"==w)(p=0!==f.length%2)&&!k&&(n=f.shift()+d.nominalWidthX),h+=f.length>>1,f.length= | ||
0,k=!0,u+=h+7>>3;else if("o21"==w)2<f.length&&!k&&(n=f.shift()+d.nominalWidthX,k=!0),q+=f.pop(),m+=f.pop(),t&&g.U.P.closePath(e),g.U.P.moveTo(e,m,q),t=!0;else if("o22"==w)1<f.length&&!k&&(n=f.shift()+d.nominalWidthX,k=!0),m+=f.pop(),t&&g.U.P.closePath(e),g.U.P.moveTo(e,m,q),t=!0;else if("o25"==w){for(;6<f.length;)m+=f.shift(),q+=f.shift(),g.U.P.lineTo(e,m,q);p=m+f.shift();r=q+f.shift();l=p+f.shift();v=r+f.shift();m=l+f.shift();q=v+f.shift();g.U.P.curveTo(e,p,r,l,v,m,q)}else if("o26"==w)for(f.length% | ||
2&&(m+=f.shift());0<f.length;)p=m,r=q+f.shift(),l=p+f.shift(),v=r+f.shift(),m=l,q=v+f.shift(),g.U.P.curveTo(e,p,r,l,v,m,q);else if("o27"==w)for(f.length%2&&(q+=f.shift());0<f.length;)p=m+f.shift(),r=q,l=p+f.shift(),v=r+f.shift(),m=l+f.shift(),q=v,g.U.P.curveTo(e,p,r,l,v,m,q);else if("o10"==w||"o29"==w)p="o10"==w?d:c,0==f.length?console.log("error: empty stack"):(r=f.pop(),p=p.Subrs[r+p.Bias],a.x=m,a.y=q,a.nStems=h,a.haveWidth=k,a.width=n,a.open=t,g.U._drawCFF(p,a,c,d,e),m=a.x,q=a.y,h=a.nStems,k=a.haveWidth, | ||
n=a.width,t=a.open);else if("o30"==w||"o31"==w)for(p=f.length,z=0,w="o31"==w,x=p&-3,z+=p-x;z<x;)w?(p=m+f.shift(),r=q,l=p+f.shift(),v=r+f.shift(),q=v+f.shift(),5==x-z?(m=l+f.shift(),z++):m=l,w=!1):(p=m,r=q+f.shift(),l=p+f.shift(),v=r+f.shift(),m=l+f.shift(),5==x-z?(q=v+f.shift(),z++):q=v,w=!0),g.U.P.curveTo(e,p,r,l,v,m,q),z+=4;else{if("o"==(w+"").charAt(0))throw console.log("Unknown operation: "+w,b),w;f.push(w)}}a.x=m;a.y=q;a.nStems=h;a.haveWidth=k;a.width=n;a.open=t};return g},function(){function l(b, | ||
a){function c(){var a=g.getUint16(k);k+=2;return a}function d(){var a=g.getUint32(k);k+=4;return a}function e(a){x.setUint16(z,a);z+=2}function f(a){x.setUint32(z,a);z+=4}var g=new DataView(b),k=0;d();var n=d();d();var l=c();c();d();c();c();d();d();d();d();d();for(var u=0;Math.pow(2,u)<=l;)u++;u--;for(var m=16*Math.pow(2,u),q=16*l-m,p=12,r=[],A=0;A<l;A++)r.push({tag:d(),offset:d(),compLength:d(),origLength:d(),origChecksum:d()}),p+=16;var v=new Uint8Array(12+16*r.length+r.reduce(function(a,b){return a+ | ||
b.origLength+4},0));A=v.buffer;var x=new DataView(A),z=0;f(n);e(l);e(m);e(u);e(q);r.forEach(function(a){f(a.tag);f(a.origChecksum);f(p);f(a.origLength);a.outOffset=p;p+=a.origLength;0!=p%4&&(p+=4-p%4)});var B;r.forEach(function(c){var d=b.slice(c.offset,c.offset+c.compLength);if(c.compLength!=c.origLength){var e=new Uint8Array(c.origLength);a(new Uint8Array(d,2),e)}else e=new Uint8Array(d);v.set(e,c.outOffset);p=c.outOffset+c.origLength;d=0;0!=p%4&&(d=4-p%4);v.set((new Uint8Array(d)).buffer,c.outOffset+ | ||
c.origLength);B=p+d});return A.slice(0,B)}var g=function(){function b(){this.table=new Uint16Array(16);this.trans=new Uint16Array(288)}function a(a,c){this.source=a;this.bitcount=this.tag=this.sourceIndex=0;this.dest=c;this.destLen=0;this.ltree=new b;this.dtree=new b}function c(a,b,c,d){var e;for(e=0;e<c;++e)a[e]=0;for(e=0;e<30-c;++e)a[e+c]=e/c|0;c=d;for(e=0;30>e;++e)b[e]=c,c+=1<<a[e]}function d(a,b,c,d){var e,f;for(e=0;16>e;++e)a.table[e]=0;for(e=0;e<d;++e)a.table[b[c+e]]++;for(e=f=a.table[0]=0;16> | ||
e;++e)v[e]=f,f+=a.table[e];for(e=0;e<d;++e)b[c+e]&&(a.trans[v[b[c+e]]++]=e)}function e(a,b,c){if(!b)return c;for(;24>a.bitcount;)a.tag|=a.source[a.sourceIndex++]<<a.bitcount,a.bitcount+=8;var d=a.tag&65535>>>16-b;a.tag>>>=b;a.bitcount-=b;return d+c}function f(a,b){for(;24>a.bitcount;)a.tag|=a.source[a.sourceIndex++]<<a.bitcount,a.bitcount+=8;var c=0,d=0,e=0,f=a.tag;do d=2*d+(f&1),f>>>=1,++e,c+=b.table[e],d-=b.table[e];while(0<=d);a.tag=f;a.bitcount-=e;return b.trans[c+d]}function g(a,b,c){for(;;){var d= | ||
f(a,b);if(256===d)return 0;if(256>d)a.dest[a.destLen++]=d;else{var g;d-=257;d=e(a,l[d],u[d]);var h=f(a,c);for(g=h=a.destLen-e(a,m[h],q[h]);g<h+d;++g)a.dest[a.destLen++]=a.dest[g]}}}var k=new b,n=new b,l=new Uint8Array(30),u=new Uint16Array(30),m=new Uint8Array(30),q=new Uint16Array(30),p=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),r=new b,A=new Uint8Array(320),v=new Uint16Array(16);(function(a,b){var c;for(c=0;7>c;++c)a.table[c]=0;a.table[7]=24;a.table[8]=152;a.table[9]=112;for(c= | ||
0;24>c;++c)a.trans[c]=256+c;for(c=0;144>c;++c)a.trans[24+c]=c;for(c=0;8>c;++c)a.trans[168+c]=280+c;for(c=0;112>c;++c)a.trans[176+c]=144+c;for(c=0;5>c;++c)b.table[c]=0;b.table[5]=32;for(c=0;32>c;++c)b.trans[c]=c})(k,n);c(l,u,4,3);c(m,q,2,1);l[28]=0;u[28]=258;return function(b,c){b=new a(b,c);do{c=b;c.bitcount--||(c.tag=c.source[c.sourceIndex++],c.bitcount=7);var h=c.tag&1;c.tag>>>=1;c=h;h=e(b,2,0);switch(h){case 0:for(h=b;8<h.bitcount;)h.sourceIndex--,h.bitcount-=8;var m=h.source[h.sourceIndex+1]; | ||
m=256*m+h.source[h.sourceIndex];var l=h.source[h.sourceIndex+3];l=256*l+h.source[h.sourceIndex+2];if(m!==(~l&65535))h=-3;else{h.sourceIndex+=4;for(l=m;l;--l)h.dest[h.destLen++]=h.source[h.sourceIndex++];h=h.bitcount=0}break;case 1:h=f(b,k,n);break;case 2:var q;m=b;var t=b.ltree,u=b.dtree;l=e(m,5,257);h=e(m,5,1);var v=e(m,4,4);for(q=0;19>q;++q)A[q]=0;for(q=0;q<v;++q){var x=e(m,3,0);A[p[q]]=x}d(r,A,0,19);for(q=0;q<l+h;)switch(v=g(m,r),v){case 16:x=A[q-1];for(v=e(m,2,3);v;--v)A[q++]=x;break;case 17:for(v= | ||
e(m,3,3);v;--v)A[q++]=0;break;case 18:for(v=e(m,7,11);v;--v)A[q++]=0;break;default:A[q++]=v}d(t,A,0,l);d(u,A,l,h);h=f(b,b.ltree,b.dtree);break;default:h=-3}if(0!==h)throw Error("Data error");}while(!c);return b.destLen<b.dest.length?"function"===typeof b.dest.slice?b.dest.slice(0,b.destLen):b.dest.subarray(0,b.destLen):b.dest}}();return function(b){return l(b,f)}},function(l,f){function b(b){var d=b[0],g=Object.create(null),f={unitsPerEm:d.head.unitsPerEm,ascender:d.hhea.ascender,descender:d.hhea.descender, | ||
forEachGlyph:function(b,e,h,u){var k=0,n=1/f.unitsPerEm*e;l.U.stringToGlyphs(d,b).forEach(function(b){if(-1!==b){var f=g[b];if(!f){f=l.glyf._parseGlyf(d,b)||{xMin:0,xMax:0,yMin:0,yMax:0};var m=l.U.glyphToPath(d,b),q=m.cmds,p=m.crds;f=g[b]={index:b,unicode:a(d,b),advanceWidth:d.hmtx.aWidth[b],xMin:f.xMin,yMin:f.yMin,xMax:f.xMax,yMax:f.yMax,pathCommandCount:q.length,forEachPathCommand:function(a){for(var b=0,d=[],e=0,g=q.length;e<g;e++){var f=c[q[e]];d.length=1+f;d[0]=q[e];for(var h=1;h<=f;h++)d[h]= | ||
p[b++];a.apply(null,d)}}}}u.call(null,f,k);f.advanceWidth&&(k+=f.advanceWidth*n);h&&(k+=h*e)}});return k}};return f}function a(a,b){var c=a.glyphToUnicodeMap;if(!c){c=a.glyphToUnicodeMap=Object.create(null);var d=a.cmap,e=-1;null!=d.p0e4?e=d.p0e4:null!=d.p3e1?e=d.p3e1:null!=d.p1e0?e=d.p1e0:null!=d.p0e3&&(e=d.p0e3);if(-1===e)throw"no familiar platform and encoding!";e=d.tables[e];if(0===e.format)for(a=0;a<e.map.length;a++)c[e.map[a]]=a;else if(4===e.format){d=e.startCount;e=e.endCount;for(var f=0;f< | ||
d.length;f++)for(var t=d[f];t<=e[f];t++)c[l.U.codeToGlyph(a,t)]=t}else if(12===e.format)e.groups.forEach(function(a){var b=a[1],d=a[2];for(a=a[0];a<=b;a++)c[d++]=a});else throw"unknown cmap table format "+e.format;}return c[b]||0}var c={M:2,L:2,Q:4,C:6,Z:0};return function(a){var c=new Uint8Array(a,0,4);c=l._bin.readASCII(c,0,4);if("wOFF"===c)a=f(a);else if("wOF2"===c)throw Error("woff2 fonts not supported");return b(l.parse(a))}}],init:function(l,f,b){l=l();f=f();return b(l,f)}}),I={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff", | ||
sdfGlyphSize:64},L=document.createElement("a"),M=Object.create(null);H=F.defineWorkerModule({dependencies:[I,.125,H,function(l){function f(a){return a*a}var b=l.sdfTextureSize,a=l.sdfDistancePercent,c=function(a){var b=a.xMin,c=a.yMin,d=a.xMax-b;a=a.yMax-c;this._root={0:null,1:null,2:null,3:null,data:null,cx:Math.round(b+d/2),cy:Math.round(c+a/2),r:Math.pow(2,Math.floor(Math.log(Math.max(d,a))*Math.LOG2E)),minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity}};c.prototype.addLineSegment=function(a, | ||
b,c,f){this._insertSegment({x0:a,y0:b,x1:c,y1:f,cx:(a+c)/2,cy:(b+f)/2,minX:Math.min(a,c),minY:Math.min(b,f),maxX:Math.max(a,c),maxY:Math.max(b,f),next:null},this._root)};c.prototype._insertSegment=function(a,b){var c=a.minX,d=a.minY,e=a.maxX,f=a.maxY,l=a.cx,u=a.cy;c<b.minX&&(b.minX=c);d<b.minY&&(b.minY=d);e>b.maxX&&(b.maxX=e);f>b.maxY&&(b.maxY=f);var m=b.data;if(m)if(m.cx===l&&m.cy===u){for(;m.next;)m=m.next;m.next=a}else b.data=null,this._insertSegment(m,b),this._insertSegment(a,b);else l=(u<b.cy? | ||
0:2)+(l<b.cx?0:1),b[l]?this._insertSegment(a,b[l]):b[l]={0:null,1:null,2:null,3:null,data:a,cx:b.cx+b.r/2*(l%2?1:-1),cy:b.cy+b.r/2*(2>l?-1:1),r:b.r/2,minX:c,minY:d,maxX:e,maxY:f}};c.prototype.walkTree=function(a){this.walkBranch(this._root,a)};c.prototype.walkBranch=function(a,b){if(!1!==b(a)&&!a.data)for(var c=0;4>c;c++)null!==a[c]&&this.walkBranch(a[c],b)};c.prototype.findNearestSignedDistance=function(a,b,c){var d=c;this.walkTree(function(c){if(a-d>c.maxX||a+d<c.minX||b-d>c.maxY||b+d<c.minY)return!1; | ||
if(c.data)for(c=c.data;c;c=c.next)if(a-d<c.maxX||a+d>c.minX||b-d<c.maxY||b+d>c.minY){var e=a;var g=b,h=c.x0,k=c.y0,l=c.x1-h,p=c.y1-k,r=l*l+p*p;r=r?Math.max(0,Math.min(1,((e-h)*l+(g-k)*p)/r)):0;e=Math.sqrt(f(e-(h+r*l))+f(g-(k+r*p)));e<d&&(d=e)}});this.isPointInPoly(a,b)||(d=-d);return d};c.prototype.isPointInPoly=function(a,b){var c=!1;this.walkTree(function(d){if(d.maxX<a||d.minY>b||d.maxY<b)return!1;if(d.data)for(d=d.data;d;d=d.next){var e=d.x0,g=d.y0,f=d.x1,h=d.y1;g>b!==h>b&&a<(f-e)*(b-g)/(h-g)+ | ||
e&&(c=!c)}});return c};return function(d){var e=new Uint8Array(b*b),g=d.xMax-d.xMin,f=d.yMax-d.yMin,k=Math.max(g,f)*a,l=(g+2*k)/b,t=(f+2*k)/b;f=d.xMin-k-l;g=d.yMin-k-t;l=d.xMax+k+l;t=d.yMax+k+t;if(d.pathCommandCount){var u=new c(d),m,q,p,r;d.forEachPathCommand(function(a,b,c,d,e,g,f){switch(a){case "M":p=m=b;r=q=c;break;case "L":b===p&&c===r||u.addLineSegment(p,r,p=b,r=c);break;case "Q":g={x:p,y:r};for(f=1;16>f;f++){a=f/15;var h=1-a;a={x:h*h*p+2*h*a*b+a*a*d,y:h*h*r+2*h*a*c+a*a*e};u.addLineSegment(g.x, | ||
g.y,a.x,a.y);g=a}p=d;r=e;break;case "C":a={x:p,y:r};for(h=1;16>h;h++){var k=h/15;var l=1-k;k={x:l*l*l*p+3*l*l*k*b+3*l*k*k*d+k*k*k*g,y:l*l*l*r+3*l*l*k*c+3*l*k*k*e+k*k*k*f};u.addLineSegment(a.x,a.y,k.x,k.y);a=k}p=g;r=f;break;case "Z":p===m&&r===q||u.addLineSegment(p,r,m,q)}});for(d=0;d<b;d++)for(var A=0;A<b;A++){var v=u.findNearestSignedDistance(f+(l-f)*(d+.5)/b,g+(t-g)*(A+.5)/b,k);v=isFinite(v)?Math.round(127.5*(1+v/k)):v;v=Math.max(0,Math.min(255,v));e[A*b+d]=v}}return{textureData:e,renderingBounds:[f, | ||
g,l,t]}}},function(l,f,b){function a(a,b){function c(){var d=function(b){console.error("Failure loading font "+a+(a===g?"":"; trying fallback"),b);a!==g&&(a=g,c())};try{var e=new XMLHttpRequest;e.open("get",a,!0);e.responseType="arraybuffer";e.onload=function(){if(400<=e.status)d(Error(e.statusText));else if(0<e.status)try{var a=l(e.response);b(a)}catch(p){d(p)}};e.onerror=d;e.send()}catch(q){d(q)}}c()}function c(b,c){b||(b=g);var d=h[b];if(d)d.onload?d.onload.push(c):c();else{var e=h[b]={onload:[c]}; | ||
a(b,function(a){d=h[b]={fontObj:a,glyphs:{},glyphCount:0};e.onload.forEach(function(a){return a()})})}}function d(a,b){a||(a=g);c(a,function(){b(h[a])})}function e(a,b,c){var e=a.text;void 0===e&&(e="");var h=a.font;void 0===h&&(h=g);var k=a.fontSize;void 0===k&&(k=1);var l=a.letterSpacing;void 0===l&&(l=0);var n=a.lineHeight;void 0===n&&(n="normal");var t=a.maxWidth;void 0===t&&(t=Infinity);var v=a.textAlign;void 0===v&&(v="left");var x=a.whiteSpace;void 0===x&&(x="normal");var z=a.overflowWrap; | ||
void 0===z&&(z="normal");var y=a.anchor;void 0===c&&(c=!1);d(h,function(a){var d=a.fontObj,g=isFinite(t),h=null,m=null,p=null,q=null,r=0,u=0,A="nowrap"!==x,B=k/d.unitsPerEm;"normal"===n&&(n=(d.ascender-d.descender)/d.unitsPerEm);n*=k;var C=(n-(d.ascender-d.descender)*B)/2,D=e.split(/\r?\n/).map(function(a){var b=0,c=[],e=[c];d.forEachGlyph(a,k,l,function(a,d){var f=a.unicode;f="number"===typeof f&&String.fromCharCode(f);var h=a.advanceWidth*B,k=!!f&&/\s/.test(f);if(A&&g&&!k&&d+h+b>t&&c.length){if(c[c.length- | ||
1].isWhitespace){var l=[];b=-d}else for(var m=c.length;m--;)if(0===m&&"break-word"===z){l=[];b=-d;break}else if(c[m].isWhitespace){l=c.splice(m+1);m=l[0].x;b-=m;for(var n=0;n<l.length;n++)l[n].x-=m;break}if(l){for(;c[c.length-1].isWhitespace;)c.pop();e.push(c=l);u=t}}c.push({glyphObj:a,x:d+b,y:0,width:h,char:f,isWhitespace:k,isEmpty:a.xMin===a.xMax||a.yMin===a.yMax,atlasInfo:null})});for(a=0;a<e.length&&u<t;a++){var f=e[a];f.length&&(f=f[f.length-1],u=Math.max(u,f.x+f.width))}r+=e.length;return e}); | ||
if(!c){var F=[],I=-(k+C);D.forEach(function(b){for(var c=0;c<b.length;c++){var d=b[c];if(d.length){var e=0,g=d[d.length-1];g=g.x+g.width;var k=0;if("center"===v)e=(u-g)/2;else if("right"===v)e=u-g;else if("justify"===v)for(var l=0,m=d.length;l<m;l++)d[l].isWhitespace&&k++;l=0;for(m=d.length;l<m;l++){var p=d[l];p.isWhitespace&&"justify"===v&&c!==b.length-1&&(e+=(u-g)/k);if(!p.isWhitespace&&!p.isEmpty){var q=p.glyphObj,r=a.glyphs[q.index];r||(r=f(q),r.atlasIndex=a.glyphCount++,h||(h=[]),h.push(r),r= | ||
a.glyphs[q.index]={atlasIndex:r.atlasIndex,glyphObj:q,renderingBounds:r.renderingBounds});p.atlasInfo=r;e&&(p.x+=e);p.y=I;F.push(p)}}}I-=n}});var H=0,J=0;y&&(y[0]&&(H=-u*y[0]),y[1]&&(J=r*n*y[1]));m=new Float32Array(4*F.length);p=new Float32Array(F.length);q=[Infinity,Infinity,-Infinity,-Infinity];F.forEach(function(a,b){var c=a.atlasInfo,d=c.renderingBounds;c=c.atlasIndex;var e=m[4*b]=a.x+d[0]*B+H,g=m[4*b+1]=a.y+d[1]*B+J,f=m[4*b+2]=a.x+d[2]*B+H;a=m[4*b+3]=a.y+d[3]*B+J;e<q[0]&&(q[0]=e);g<q[1]&&(q[1]= | ||
g);f>q[2]&&(q[2]=f);a>q[3]&&(q[3]=a);p[b]=c})}b({glyphBounds:m,glyphIndices:p,totalBounds:q,totalBlockSize:[u,r*n],newGlyphSDFs:h})})}var g=b.defaultFontUrl,h=Object.create(null);return{process:e,measure:function(a,b){e(a,function(a){b({width:a.totalBlockSize[0],height:a.totalBlockSize[1]})},!0)},loadFont:c}}],init:function(l,f,b,a,c){f=a({sdfTextureSize:l.sdfGlyphSize,sdfDistancePercent:f});return c(b,f,{defaultFontUrl:l.defaultFontURL})}});var U=F.defineWorkerModule({dependencies:[H,F.ThenableWorkerModule], | ||
init:function(l,f){return function(b){var a=new f;l.process(b,a.resolve);return a}},getTransferables:function(l){var f=[l.glyphBounds.buffer,l.glyphIndices.buffer];l.newGlyphSDFs&&l.newGlyphSDFs.forEach(function(b){f.push(b.textureData.buffer)});return f}}),W=(new y.PlaneBufferGeometry(1,1)).translate(.5,.5,0),X=new y.Vector3,O=function(l){function f(){l.call(this);this.copy(W);this.addAttribute("aTroikaGlyphBounds",new y.InstancedBufferAttribute(new Float32Array(0),4));this.addAttribute("aTroikaGlyphIndex", | ||
new y.InstancedBufferAttribute(new Float32Array(0),1));this.boundingSphere=new y.Sphere}l&&(f.__proto__=l);f.prototype=Object.create(l&&l.prototype);f.prototype.constructor=f;f.prototype.computeBoundingSphere=function(){};f.prototype.updateGlyphs=function(b,a,c){N(this.attributes.aTroikaGlyphBounds,b);N(this.attributes.aTroikaGlyphIndex,a);this.maxInstancedCount=a.length;b=this.boundingSphere;b.center.set((c[0]+c[2])/2,(c[1]+c[3])/2,0);b.radius=b.center.distanceTo(X.set(c[0],c[1],0))};return f}(y.InstancedBufferGeometry), | ||
P=new y.MeshBasicMaterial({color:16777215,side:y.DoubleSide,transparent:!0}),Y=Object.freeze([0,0,0,0]),Z=new y.Matrix4,Q=new y.Mesh((new y.PlaneBufferGeometry(1,1)).translate(.5,.5,0),P),J=function(l){function f(a){a=new O;l.call(this,a,null);this.text="";this.font=this.anchor=null;this.fontSize=.1;this.letterSpacing=0;this.lineHeight="normal";this.maxWidth=Infinity;this.overflowWrap="normal";this.textAlign="left";this.whiteSpace="normal";this.color=this.material=null;this.depthOffset=0;this.clipRect= | ||
null;this.debugSDF=!1}l&&(f.__proto__=l);f.prototype=Object.create(l&&l.prototype);f.prototype.constructor=f;var b={material:{configurable:!0},customDepthMaterial:{configurable:!0},customDistanceMaterial:{configurable:!0}};f.prototype.sync=function(a){var b=this;this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(a):(this._isSyncing=!0,T({text:this.text,font:this.font,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight, | ||
maxWidth:this.maxWidth,textAlign:this.textAlign,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchor:this.anchor},function(c){b._isSyncing=!1;b._textRenderInfo=c;b.geometry.updateGlyphs(c.glyphBounds,c.glyphIndices,c.totalBounds);var d=b._queuedSyncs;d&&(b._queuedSyncs=null,b._needsSync=!0,b.sync(function(){d.forEach(function(a){return a&&a()})}));a&&a()})))};f.prototype.onBeforeRender=function(){this.sync();this._prepareMaterial()};f.prototype.dispose=function(){this.geometry.dispose()}; | ||
m=256*m+h.source[h.sourceIndex];var l=h.source[h.sourceIndex+3];l=256*l+h.source[h.sourceIndex+2];if(m!==(~l&65535))h=-3;else{h.sourceIndex+=4;for(l=m;l;--l)h.dest[h.destLen++]=h.source[h.sourceIndex++];h=h.bitcount=0}break;case 1:h=g(b,k,n);break;case 2:var q;m=b;var t=b.ltree,u=b.dtree;l=e(m,5,257);h=e(m,5,1);var v=e(m,4,4);for(q=0;19>q;++q)A[q]=0;for(q=0;q<v;++q){var x=e(m,3,0);A[p[q]]=x}d(r,A,0,19);for(q=0;q<l+h;)switch(v=f(m,r),v){case 16:x=A[q-1];for(v=e(m,2,3);v;--v)A[q++]=x;break;case 17:for(v= | ||
e(m,3,3);v;--v)A[q++]=0;break;case 18:for(v=e(m,7,11);v;--v)A[q++]=0;break;default:A[q++]=v}d(t,A,0,l);d(u,A,l,h);h=g(b,b.ltree,b.dtree);break;default:h=-3}if(0!==h)throw Error("Data error");}while(!c);return b.destLen<b.dest.length?"function"===typeof b.dest.slice?b.dest.slice(0,b.destLen):b.dest.subarray(0,b.destLen):b.dest}}();return function(b){return l(b,g)}},function(l,g){function b(b){var d=b[0],f=Object.create(null),g={unitsPerEm:d.head.unitsPerEm,ascender:d.hhea.ascender,descender:d.hhea.descender, | ||
forEachGlyph:function(b,e,h,u){var k=0,n=1/g.unitsPerEm*e;l.U.stringToGlyphs(d,b).forEach(function(b){if(-1!==b){var g=f[b];if(!g){g=l.glyf._parseGlyf(d,b)||{xMin:0,xMax:0,yMin:0,yMax:0};var m=l.U.glyphToPath(d,b),q=m.cmds,p=m.crds;g=f[b]={index:b,unicode:a(d,b),advanceWidth:d.hmtx.aWidth[b],xMin:g.xMin,yMin:g.yMin,xMax:g.xMax,yMax:g.yMax,pathCommandCount:q.length,forEachPathCommand:function(a){for(var b=0,d=[],e=0,f=q.length;e<f;e++){var g=c[q[e]];d.length=1+g;d[0]=q[e];for(var h=1;h<=g;h++)d[h]= | ||
p[b++];a.apply(null,d)}}}}u.call(null,g,k);g.advanceWidth&&(k+=g.advanceWidth*n);h&&(k+=h*e)}});return k}};return g}function a(a,b){var c=a.glyphToUnicodeMap;if(!c){c=a.glyphToUnicodeMap=Object.create(null);var d=a.cmap,e=-1;null!=d.p0e4?e=d.p0e4:null!=d.p3e1?e=d.p3e1:null!=d.p1e0?e=d.p1e0:null!=d.p0e3&&(e=d.p0e3);if(-1===e)throw"no familiar platform and encoding!";e=d.tables[e];if(0===e.format)for(a=0;a<e.map.length;a++)c[e.map[a]]=a;else if(4===e.format){d=e.startCount;e=e.endCount;for(var g=0;g< | ||
d.length;g++)for(var t=d[g];t<=e[g];t++)c[l.U.codeToGlyph(a,t)]=t}else if(12===e.format)e.groups.forEach(function(a){var b=a[1],d=a[2];for(a=a[0];a<=b;a++)c[d++]=a});else throw"unknown cmap table format "+e.format;}return c[b]||0}var c={M:2,L:2,Q:4,C:6,Z:0};return function(a){var c=new Uint8Array(a,0,4);c=l._bin.readASCII(c,0,4);if("wOFF"===c)a=g(a);else if("wOF2"===c)throw Error("woff2 fonts not supported");return b(l.parse(a))}}],init:function(l,g,b){l=l();g=g();return b(l,g)}}),J={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff", | ||
sdfGlyphSize:64},M=document.createElement("a"),N=Object.create(null);H=F.defineWorkerModule({dependencies:[J,.125,H,function(l){function g(a){return a*a}var b=l.sdfTextureSize,a=l.sdfDistancePercent,c=function(a){var b=a.xMin,c=a.yMin,d=a.xMax-b;a=a.yMax-c;this._root={0:null,1:null,2:null,3:null,data:null,cx:Math.round(b+d/2),cy:Math.round(c+a/2),r:Math.pow(2,Math.floor(Math.log(Math.max(d,a))*Math.LOG2E)),minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity}};c.prototype.addLineSegment=function(a, | ||
b,c,g){this._insertSegment({x0:a,y0:b,x1:c,y1:g,cx:(a+c)/2,cy:(b+g)/2,minX:Math.min(a,c),minY:Math.min(b,g),maxX:Math.max(a,c),maxY:Math.max(b,g),next:null},this._root)};c.prototype._insertSegment=function(a,b){var c=a.minX,d=a.minY,e=a.maxX,g=a.maxY,l=a.cx,u=a.cy;c<b.minX&&(b.minX=c);d<b.minY&&(b.minY=d);e>b.maxX&&(b.maxX=e);g>b.maxY&&(b.maxY=g);var m=b.data;if(m)if(m.cx===l&&m.cy===u){for(;m.next;)m=m.next;m.next=a}else b.data=null,this._insertSegment(m,b),this._insertSegment(a,b);else l=(u<b.cy? | ||
0:2)+(l<b.cx?0:1),b[l]?this._insertSegment(a,b[l]):b[l]={0:null,1:null,2:null,3:null,data:a,cx:b.cx+b.r/2*(l%2?1:-1),cy:b.cy+b.r/2*(2>l?-1:1),r:b.r/2,minX:c,minY:d,maxX:e,maxY:g}};c.prototype.walkTree=function(a){this.walkBranch(this._root,a)};c.prototype.walkBranch=function(a,b){if(!1!==b(a)&&!a.data)for(var c=0;4>c;c++)null!==a[c]&&this.walkBranch(a[c],b)};c.prototype.findNearestSignedDistance=function(a,b,c){var d=c;this.walkTree(function(c){if(a-d>c.maxX||a+d<c.minX||b-d>c.maxY||b+d<c.minY)return!1; | ||
if(c.data)for(c=c.data;c;c=c.next)if(a-d<c.maxX||a+d>c.minX||b-d<c.maxY||b+d>c.minY){var e=a;var f=b,h=c.x0,k=c.y0,l=c.x1-h,p=c.y1-k,r=l*l+p*p;r=r?Math.max(0,Math.min(1,((e-h)*l+(f-k)*p)/r)):0;e=Math.sqrt(g(e-(h+r*l))+g(f-(k+r*p)));e<d&&(d=e)}});this.isPointInPoly(a,b)||(d=-d);return d};c.prototype.isPointInPoly=function(a,b){var c=!1;this.walkTree(function(d){if(d.maxX<a||d.minY>b||d.maxY<b)return!1;if(d.data)for(d=d.data;d;d=d.next){var e=d.x0,f=d.y0,g=d.x1,h=d.y1;f>b!==h>b&&a<(g-e)*(b-f)/(h-f)+ | ||
e&&(c=!c)}});return c};return function(d){var e=new Uint8Array(b*b),f=d.xMax-d.xMin,g=d.yMax-d.yMin,k=Math.max(f,g)*a,l=(f+2*k)/b,t=(g+2*k)/b;g=d.xMin-k-l;f=d.yMin-k-t;l=d.xMax+k+l;t=d.yMax+k+t;if(d.pathCommandCount){var u=new c(d),m,q,p,r;d.forEachPathCommand(function(a,b,c,d,e,f,g){switch(a){case "M":p=m=b;r=q=c;break;case "L":b===p&&c===r||u.addLineSegment(p,r,p=b,r=c);break;case "Q":f={x:p,y:r};for(g=1;16>g;g++){a=g/15;var h=1-a;a={x:h*h*p+2*h*a*b+a*a*d,y:h*h*r+2*h*a*c+a*a*e};u.addLineSegment(f.x, | ||
f.y,a.x,a.y);f=a}p=d;r=e;break;case "C":a={x:p,y:r};for(h=1;16>h;h++){var k=h/15;var l=1-k;k={x:l*l*l*p+3*l*l*k*b+3*l*k*k*d+k*k*k*f,y:l*l*l*r+3*l*l*k*c+3*l*k*k*e+k*k*k*g};u.addLineSegment(a.x,a.y,k.x,k.y);a=k}p=f;r=g;break;case "Z":p===m&&r===q||u.addLineSegment(p,r,m,q)}});for(d=0;d<b;d++)for(var A=0;A<b;A++){var v=u.findNearestSignedDistance(g+(l-g)*(d+.5)/b,f+(t-f)*(A+.5)/b,k);v=isFinite(v)?Math.round(127.5*(1+v/k)):v;v=Math.max(0,Math.min(255,v));e[A*b+d]=v}}return{textureData:e,renderingBounds:[g, | ||
f,l,t]}}},function(l,g,b){function a(a,b){function c(){var d=function(b){console.error("Failure loading font "+a+(a===f?"":"; trying fallback"),b);a!==f&&(a=f,c())};try{var e=new XMLHttpRequest;e.open("get",a,!0);e.responseType="arraybuffer";e.onload=function(){if(400<=e.status)d(Error(e.statusText));else if(0<e.status)try{var a=l(e.response);b(a)}catch(p){d(p)}};e.onerror=d;e.send()}catch(q){d(q)}}c()}function c(b,c){b||(b=f);var d=h[b];if(d)d.onload?d.onload.push(c):c();else{var e=h[b]={onload:[c]}; | ||
a(b,function(a){d=h[b]={fontObj:a,glyphs:{},glyphCount:0};e.onload.forEach(function(a){return a()})})}}function d(a,b){a||(a=f);c(a,function(){b(h[a])})}function e(a,b,c){var e=a.text;void 0===e&&(e="");var h=a.font;void 0===h&&(h=f);var k=a.fontSize;void 0===k&&(k=1);var l=a.letterSpacing;void 0===l&&(l=0);var n=a.lineHeight;void 0===n&&(n="normal");var t=a.maxWidth;void 0===t&&(t=Infinity);var v=a.textAlign;void 0===v&&(v="left");var x=a.whiteSpace;void 0===x&&(x="normal");var z=a.overflowWrap; | ||
void 0===z&&(z="normal");var y=a.anchor;void 0===c&&(c=!1);d(h,function(a){var d=a.fontObj,f=isFinite(t),h=null,m=null,p=null,q=null,r=0,u=0,A="nowrap"!==x,B=k/d.unitsPerEm;"normal"===n&&(n=(d.ascender-d.descender)/d.unitsPerEm);n*=k;var C=(n-(d.ascender-d.descender)*B)/2,D=e.split(/\r?\n/).map(function(a){var b=0,c=[],e=[c];d.forEachGlyph(a,k,l,function(a,d){var g=a.unicode;g="number"===typeof g&&String.fromCharCode(g);var h=a.advanceWidth*B,k=!!g&&/\s/.test(g);if(A&&f&&!k&&d+h+b>t&&c.length){if(c[c.length- | ||
1].isWhitespace){var l=[];b=-d}else for(var m=c.length;m--;)if(0===m&&"break-word"===z){l=[];b=-d;break}else if(c[m].isWhitespace){l=c.splice(m+1);m=l[0].x;b-=m;for(var n=0;n<l.length;n++)l[n].x-=m;break}if(l){for(;c[c.length-1].isWhitespace;)c.pop();e.push(c=l);u=t}}c.push({glyphObj:a,x:d+b,y:0,width:h,char:g,isWhitespace:k,isEmpty:a.xMin===a.xMax||a.yMin===a.yMax,atlasInfo:null})});for(a=0;a<e.length&&u<t;a++){var g=e[a];g.length&&(g=g[g.length-1],u=Math.max(u,g.x+g.width))}r+=e.length;return e}); | ||
if(!c){var F=[],J=-(k+C);D.forEach(function(b){for(var c=0;c<b.length;c++){var d=b[c];if(d.length){var e=0,f=d[d.length-1];f=f.x+f.width;var k=0;if("center"===v)e=(u-f)/2;else if("right"===v)e=u-f;else if("justify"===v)for(var l=0,m=d.length;l<m;l++)d[l].isWhitespace&&k++;l=0;for(m=d.length;l<m;l++){var p=d[l];p.isWhitespace&&"justify"===v&&c!==b.length-1&&(e+=(u-f)/k);if(!p.isWhitespace&&!p.isEmpty){var q=p.glyphObj,r=a.glyphs[q.index];r||(r=g(q),r.atlasIndex=a.glyphCount++,h||(h=[]),h.push(r),r= | ||
a.glyphs[q.index]={atlasIndex:r.atlasIndex,glyphObj:q,renderingBounds:r.renderingBounds});p.atlasInfo=r;e&&(p.x+=e);p.y=J;F.push(p)}}}J-=n}});var H=0,I=0;y&&(y[0]&&(H=-u*y[0]),y[1]&&(I=r*n*y[1]));m=new Float32Array(4*F.length);p=new Float32Array(F.length);q=[Infinity,Infinity,-Infinity,-Infinity];F.forEach(function(a,b){var c=a.atlasInfo,d=c.renderingBounds;c=c.atlasIndex;var e=m[4*b]=a.x+d[0]*B+H,f=m[4*b+1]=a.y+d[1]*B+I,g=m[4*b+2]=a.x+d[2]*B+H;a=m[4*b+3]=a.y+d[3]*B+I;e<q[0]&&(q[0]=e);f<q[1]&&(q[1]= | ||
f);g>q[2]&&(q[2]=g);a>q[3]&&(q[3]=a);p[b]=c})}b({glyphBounds:m,glyphIndices:p,totalBounds:q,totalBlockSize:[u,r*n],newGlyphSDFs:h})})}var f=b.defaultFontUrl,h=Object.create(null);return{process:e,measure:function(a,b){e(a,function(a){b({width:a.totalBlockSize[0],height:a.totalBlockSize[1]})},!0)},loadFont:c}}],init:function(l,g,b,a,c){g=a({sdfTextureSize:l.sdfGlyphSize,sdfDistancePercent:g});return c(b,g,{defaultFontUrl:l.defaultFontURL})}});var U=F.defineWorkerModule({dependencies:[H,F.ThenableWorkerModule], | ||
init:function(l,g){return function(b){var a=new g;l.process(b,a.resolve);return a}},getTransferables:function(l){var g=[l.glyphBounds.buffer,l.glyphIndices.buffer];l.newGlyphSDFs&&l.newGlyphSDFs.forEach(function(b){g.push(b.textureData.buffer)});return g}}),W=(new y.PlaneBufferGeometry(1,1)).translate(.5,.5,0),X=new y.Vector3,I=function(l){function g(){l.call(this);this.copy(W);this.boundingSphere=new y.Sphere}l&&(g.__proto__=l);g.prototype=Object.create(l&&l.prototype);g.prototype.constructor=g; | ||
g.prototype.computeBoundingSphere=function(){};g.prototype.updateGlyphs=function(b,a,c){O(this,"aTroikaGlyphBounds",b,4);O(this,"aTroikaGlyphIndex",a,1);this.maxInstancedCount=a.length;b=this.boundingSphere;b.center.set((c[0]+c[2])/2,(c[1]+c[3])/2,0);b.radius=b.center.distanceTo(X.set(c[0],c[1],0))};return g}(y.InstancedBufferGeometry);I.prototype.setAttribute||(I.prototype.setAttribute=function(l,g){this.attributes[l]=g;return this});var P=new y.MeshBasicMaterial({color:16777215,side:y.DoubleSide, | ||
transparent:!0});Object.freeze([-Infinity,-Infinity,Infinity,Infinity]);var Y=new y.Matrix4;new y.Plane;new y.Vector3;var Q=new y.Mesh((new y.PlaneBufferGeometry(1,1)).translate(.5,.5,0),P),K=function(l){function g(a){a=new I;l.call(this,a,null);this.text="";this.font=this.anchor=null;this.fontSize=.1;this.letterSpacing=0;this.lineHeight="normal";this.maxWidth=Infinity;this.overflowWrap="normal";this.textAlign="left";this.whiteSpace="normal";this.color=this.material=null;this.depthOffset=0;this.clipRect= | ||
null;this.debugSDF=!1}l&&(g.__proto__=l);g.prototype=Object.create(l&&l.prototype);g.prototype.constructor=g;var b={material:{configurable:!0},customDepthMaterial:{configurable:!0},customDistanceMaterial:{configurable:!0}};g.prototype.sync=function(a){var b=this;this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(a):(this._isSyncing=!0,T({text:this.text,font:this.font,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight, | ||
maxWidth:this.maxWidth,textAlign:this.textAlign,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchor:this.anchor},function(c){b._isSyncing=!1;b._textRenderInfo=c;b.geometry.updateGlyphs(c.glyphBounds,c.glyphIndices,c.totalBounds);var d=b._queuedSyncs;d&&(b._queuedSyncs=null,b._needsSync=!0,b.sync(function(){d.forEach(function(a){return a&&a()})}));a&&a()})))};g.prototype.onBeforeRender=function(){this.sync();this._prepareMaterial()};g.prototype.dispose=function(){this.geometry.dispose()}; | ||
b.material.get=function(){var a=this._derivedMaterial,b=this._baseMaterial||P;a&&a.baseMaterial===b||(a&&a.dispose(),a=this._derivedMaterial=V(b),b.addEventListener("dispose",function e(){b.removeEventListener("dispose",e);a.dispose()}));return a};b.material.set=function(a){this._baseMaterial=a};b.customDepthMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDepthMaterial())};b.customDistanceMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDistanceMaterial())}; | ||
f.prototype._prepareMaterial=function(){var a=this._derivedMaterial;this._updateLayoutUniforms(a);a.uniforms.uTroikaSDFDebug.value=!!this.debugSDF;a.polygonOffset=!!this.depthOffset;a.polygonOffsetFactor=a.polygonOffsetUnits=this.depthOffset||0;var b=this.color;null!=b&&a.color&&a.color.isColor&&b!==a._troikaColor&&a.color.set(a._troikaColor=b)};f.prototype._updateLayoutUniforms=function(a){var b=this._textRenderInfo,d=a.uniforms;if(b){var e=b.sdfTexture;d.uTroikaSDFTexture.value=e;d.uTroikaSDFMinDistancePct.value= | ||
b.sdfMinDistancePercent;d.uTroikaGlyphVSize.value=e.image.width/e.image.height;d.uTroikaTotalBounds.value.fromArray(b.totalBounds)}(b=this.clipRect)&&Array.isArray(b)&&4===b.length||(b=Y);d.uTroikaClipRect.value.fromArray(b);return a};f.prototype.raycast=function(a,b){var c=this._textRenderInfo;c&&(c=c.totalBounds,Q.matrixWorld.multiplyMatrices(this.matrixWorld,Z.set(c[2]-c[0],0,0,c[0],0,c[3]-c[1],0,c[1],0,0,1,0,0,0,0,1)),Q.raycast(a,b))};Object.defineProperties(f.prototype,b);return f}(y.Mesh);"font fontSize letterSpacing lineHeight maxWidth overflowWrap text textAlign whiteSpace anchor".split(" ").forEach(function(l){var f= | ||
"_private_"+l;Object.defineProperty(J.prototype,l,{get:function(){return this[f]},set:"anchor"===l?function(b){JSON.stringify(b)!==JSON.stringify(this[f])&&(this[f]=b,this._needsSync=!0)}:function(b){b!==this[f]&&(this[f]=b,this._needsSync=!0)}})});var aa="text anchor font fontSize letterSpacing lineHeight maxWidth overflowWrap textAlign whiteSpace material color depthOffset clipRect debugSDF".split(" ");F=function(l){function f(b){var a=new J;a.geometry.boundingSphere.version=0;l.call(this,b,a)} | ||
l&&(f.__proto__=l);f.prototype=Object.create(l&&l.prototype);f.prototype.constructor=f;f.prototype.afterUpdate=function(){var b=this,a=this.threeObject;aa.forEach(function(c){a[c]=b[c]});a.sync(function(){b.isDestroying||(a.geometry.boundingSphere.version++,b.notifyWorld("needsRender"))});l.prototype.afterUpdate.call(this)};f.prototype.destructor=function(){this.threeObject.dispose();l.prototype.destructor.call(this)};return f}(S.Object3DFacade);C.GlyphsGeometry=O;C.Text3DFacade=F;C.TextMesh=J;C.configureTextBuilder= | ||
function(l){K(I,l)};C.fontProcessorWorkerModule=H;Object.defineProperty(C,"__esModule",{value:!0})}); | ||
g.prototype._prepareMaterial=function(){var a=this._derivedMaterial;this._updateLayoutUniforms(a);a.uniforms.uTroikaSDFDebug.value=!!this.debugSDF;a.polygonOffset=!!this.depthOffset;a.polygonOffsetFactor=a.polygonOffsetUnits=this.depthOffset||0;var b=this.color;null!=b&&a.color&&a.color.isColor&&b!==a._troikaColor&&a.color.set(a._troikaColor=b)};g.prototype._updateLayoutUniforms=function(a){var b=this._textRenderInfo,d=a.uniforms;if(b){var e=b.sdfTexture,f=b.totalBounds;d.uTroikaSDFTexture.value= | ||
e;d.uTroikaSDFMinDistancePct.value=b.sdfMinDistancePercent;d.uTroikaGlyphVSize.value=e.image.width/e.image.height;d.uTroikaTotalBounds.value.fromArray(f);(b=this.clipRect)&&Array.isArray(b)&&4===b.length?d.uTroikaClipRect.value.set(Math.max(f[0],b[0]),Math.max(f[1],b[1]),Math.min(f[2],b[2]),Math.min(f[3],b[3])):d.uTroikaClipRect.value.fromArray(f)}return a};g.prototype.raycast=function(a,b){var c=this._textRenderInfo;c&&(c=c.totalBounds,Q.matrixWorld.multiplyMatrices(this.matrixWorld,Y.set(c[2]-c[0], | ||
0,0,c[0],0,c[3]-c[1],0,c[1],0,0,1,0,0,0,0,1)),Q.raycast(a,b))};Object.defineProperties(g.prototype,b);return g}(y.Mesh);"font fontSize letterSpacing lineHeight maxWidth overflowWrap text textAlign whiteSpace anchor".split(" ").forEach(function(l){var g="_private_"+l;Object.defineProperty(K.prototype,l,{get:function(){return this[g]},set:"anchor"===l?function(b){JSON.stringify(b)!==JSON.stringify(this[g])&&(this[g]=b,this._needsSync=!0)}:function(b){b!==this[g]&&(this[g]=b,this._needsSync=!0)}})}); | ||
var Z="text anchor font fontSize letterSpacing lineHeight maxWidth overflowWrap textAlign whiteSpace material color depthOffset clipRect debugSDF".split(" ");F=function(l){function g(b){var a=new K;a.geometry.boundingSphere.version=0;l.call(this,b,a)}l&&(g.__proto__=l);g.prototype=Object.create(l&&l.prototype);g.prototype.constructor=g;g.prototype.afterUpdate=function(){var b=this,a=this.threeObject;Z.forEach(function(c){a[c]=b[c]});a.sync(function(){b.isDestroying||(a.geometry.boundingSphere.version++, | ||
b.notifyWorld("needsRender"))});l.prototype.afterUpdate.call(this)};g.prototype.destructor=function(){this.threeObject.dispose();l.prototype.destructor.call(this)};return g}(S.Object3DFacade);C.GlyphsGeometry=I;C.Text3DFacade=F;C.TextMesh=K;C.configureTextBuilder=function(l){L(J,l)};C.fontProcessorWorkerModule=H;Object.defineProperty(C,"__esModule",{value:!0})}); |
{ | ||
"name": "troika-3d-text", | ||
"version": "0.15.5", | ||
"version": "0.15.6", | ||
"description": "Troika 3D Text", | ||
@@ -18,5 +18,5 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"dependencies": { | ||
"troika-3d": "^0.15.5", | ||
"troika-three-utils": "^0.15.3", | ||
"troika-worker-utils": "^0.15.0" | ||
"troika-3d": "^0.15.6", | ||
"troika-three-utils": "^0.15.6", | ||
"troika-worker-utils": "^0.15.6" | ||
}, | ||
@@ -31,3 +31,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "fdb26c958d6df07333af1429d4aa8cdfea52e4be" | ||
"gitHead": "13acfe60f037e5156d7b29940ea87c66b3e71ead" | ||
} |
@@ -55,12 +55,2 @@ import { | ||
// Add our custom instanced attributes | ||
this.addAttribute( | ||
glyphBoundsAttrName, | ||
new InstancedBufferAttribute(new Float32Array(0), 4) | ||
) | ||
this.addAttribute( | ||
glyphIndexAttrName, | ||
new InstancedBufferAttribute(new Float32Array(0), 1) | ||
) | ||
// Preallocate zero-radius bounding sphere | ||
@@ -84,4 +74,4 @@ this.boundingSphere = new Sphere() | ||
// Update the instance attributes | ||
updateBufferAttrArray(this.attributes[glyphBoundsAttrName], glyphBounds) | ||
updateBufferAttrArray(this.attributes[glyphIndexAttrName], glyphIndices) | ||
updateBufferAttr(this, glyphBoundsAttrName, glyphBounds, 4) | ||
updateBufferAttr(this, glyphIndexAttrName, glyphIndices, 1) | ||
this.maxInstancedCount = glyphIndices.length | ||
@@ -100,11 +90,20 @@ | ||
// Compat for pre r109: | ||
if (!GlyphsGeometry.prototype.setAttribute) { | ||
GlyphsGeometry.prototype.setAttribute = function(name, attribute) { | ||
this.attributes[ name ] = attribute | ||
return this | ||
} | ||
} | ||
function updateBufferAttrArray(attr, newArray) { | ||
if (attr.array.length === newArray.length) { | ||
function updateBufferAttr(geom, attrName, newArray, itemSize) { | ||
const attr = geom.getAttribute(attrName) | ||
// If length isn't changing, just update the attribute's array data | ||
if (attr && attr.array.length === newArray.length) { | ||
attr.array.set(newArray) | ||
attr.needsUpdate = true | ||
} else { | ||
attr.setArray(newArray) | ||
geom.setAttribute(attrName, new InstancedBufferAttribute(newArray, itemSize)) | ||
} | ||
attr.needsUpdate = true | ||
} | ||
@@ -111,0 +110,0 @@ |
@@ -41,13 +41,15 @@ import { createDerivedMaterial } from 'troika-three-utils' | ||
void troikaApplyClipping() { | ||
vec4 rect = uTroikaClipRect; | ||
float troikaGetClipAlpha() { | ||
vec4 clip = uTroikaClipRect; | ||
vec3 pos = vTroikaLocalPos; | ||
if (rect != vec4(.0,.0,.0,.0) && ( | ||
pos.x < min(rect.x, rect.z) || | ||
pos.y < min(rect.y, rect.w) || | ||
pos.x > max(rect.x, rect.z) || | ||
pos.y > max(rect.y, rect.w) | ||
)) { | ||
discard; | ||
} | ||
float dClip = min( | ||
min(pos.x - min(clip.x, clip.z), max(clip.x, clip.z) - pos.x), | ||
min(pos.y - min(clip.y, clip.w), max(clip.y, clip.w) - pos.y) | ||
); | ||
#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 | ||
float aa = length(fwidth(pos)) * 0.5; | ||
return smoothstep(-aa, aa, dClip); | ||
#else | ||
return step(0.0, dClip); | ||
#endif | ||
} | ||
@@ -57,4 +59,2 @@ ` | ||
const FRAGMENT_TRANSFORM = ` | ||
troikaApplyClipping(); | ||
float troikaSDFValue = texture2D(uTroikaSDFTexture, vTroikaGlyphUV).r; | ||
@@ -89,2 +89,5 @@ | ||
); | ||
textAlphaMult = min(textAlphaMult, troikaGetClipAlpha()); | ||
if (textAlphaMult == 0.0) { | ||
@@ -91,0 +94,0 @@ if (uTroikaSDFDebug) { |
@@ -6,3 +6,5 @@ import { | ||
MeshBasicMaterial, | ||
PlaneBufferGeometry | ||
PlaneBufferGeometry, | ||
Plane, | ||
Vector3 | ||
} from 'three' | ||
@@ -21,5 +23,7 @@ import { GlyphsGeometry } from './GlyphsGeometry.js' | ||
const noclip = Object.freeze([0, 0, 0, 0]) | ||
const noclip = Object.freeze([-Infinity, -Infinity, Infinity, Infinity]) | ||
const tempMat4 = new Matrix4() | ||
const tempPlane = new Plane() | ||
const tempVec3 = new Vector3() | ||
@@ -289,11 +293,20 @@ const raycastMesh = new Mesh( | ||
if (textInfo) { | ||
const sdfTexture = textInfo.sdfTexture | ||
const {sdfTexture, totalBounds} = textInfo | ||
uniforms.uTroikaSDFTexture.value = sdfTexture | ||
uniforms.uTroikaSDFMinDistancePct.value = textInfo.sdfMinDistancePercent | ||
uniforms.uTroikaGlyphVSize.value = sdfTexture.image.width / sdfTexture.image.height | ||
uniforms.uTroikaTotalBounds.value.fromArray(textInfo.totalBounds) | ||
uniforms.uTroikaTotalBounds.value.fromArray(totalBounds) | ||
let clipRect = this.clipRect | ||
if (!(clipRect && Array.isArray(clipRect) && clipRect.length === 4)) { | ||
uniforms.uTroikaClipRect.value.fromArray(totalBounds) | ||
} else { | ||
uniforms.uTroikaClipRect.value.set( | ||
Math.max(totalBounds[0], clipRect[0]), | ||
Math.max(totalBounds[1], clipRect[1]), | ||
Math.min(totalBounds[2], clipRect[2]), | ||
Math.min(totalBounds[3], clipRect[3]) | ||
) | ||
} | ||
} | ||
let clipRect = this.clipRect | ||
if (!(clipRect && Array.isArray(clipRect) && clipRect.length === 4)) { clipRect = noclip } | ||
uniforms.uTroikaClipRect.value.fromArray(clipRect) | ||
return material | ||
@@ -300,0 +313,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1841039
32011
Updatedtroika-3d@^0.15.6
Updatedtroika-three-utils@^0.15.6
Updatedtroika-worker-utils@^0.15.6