troika-3d-text
Advanced tools
Comparing version 0.16.0 to 0.17.0
@@ -1,18 +0,18 @@ | ||
'use strict';(function(D,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):(D=D||self,z(D.troika_3d_text={},D.THREE,D.troika_worker_utils,D.troika_three_utils))})(this,function(D,z,M,Y){function Z(m,g){m=R({},m);S.href=m.font||K.defaultFontURL;m.font=S.href;m.text=""+m.text;var b=K.sdfGlyphSize, | ||
a=K.textureWidth,c=T[m.font];c||(c=T[m.font]={sdfTexture:new z.DataTexture(new Uint8Array(b*a),a,b,z.LuminanceFormat,void 0,void 0,void 0,void 0,z.LinearFilter,z.LinearFilter)},c.sdfTexture.font=m.font);aa(m).then(function(a){a.newGlyphSDFs&&(a.newGlyphSDFs.forEach(function(a){var d=a.textureData;a=a.atlasIndex;for(var e=c.sdfTexture.image;e.data.length<(a+1)*b*b;){var g=new Uint8Array(2*e.data.length);g.set(e.data);e.data=g;e.height*=2}g=e.width/b;for(var n=0;n<b;n++)for(var q=n*b,u=e.width*b*Math.floor(a/ | ||
g)+a%g*b+n*e.width,l=0;l<b;l++)e.data[u+l]=d[q+l]}),c.sdfTexture.needsUpdate=!0);g(Object.freeze({sdfTexture:c.sdfTexture,sdfGlyphSize:b,sdfMinDistancePercent:.125,glyphBounds:a.glyphBounds,glyphAtlasIndices:a.glyphAtlasIndices,caretPositions:a.caretPositions,caretHeight:a.caretHeight,totalBounds:a.totalBounds,totalBlockSize:a.totalBlockSize}))})}function R(m,g){for(var b in g)g.hasOwnProperty(b)&&(m[b]=g[b]);return m}function U(m,g,b,a){var c=m.getAttribute(g);c&&c.array.length===b.length?(c.array.set(b), | ||
c.needsUpdate=!0):m.setAttribute(g,new z.InstancedBufferAttribute(b,a))}function ba(m){m=Y.createDerivedMaterial(m,{extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new z.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFMinDistancePct:{value:0},uTroikaTotalBounds:{value:new z.Vector4},uTroikaClipRect:{value:new z.Vector4},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nvarying vec2 vTroikaSDFTextureUV;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n", | ||
'use strict';(function(D,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):(D=D||self,z(D.troika_3d_text={},D.THREE,D.troika_worker_utils,D.troika_three_utils))})(this,function(D,z,M,Y){function Z(n,g){n=R({},n);S.href=n.font||K.defaultFontURL;n.font=S.href;n.text=""+n.text;var b=K.sdfGlyphSize, | ||
a=K.textureWidth,c=T[n.font];c||(c=T[n.font]={sdfTexture:new z.DataTexture(new Uint8Array(b*a),a,b,z.LuminanceFormat,void 0,void 0,void 0,void 0,z.LinearFilter,z.LinearFilter)},c.sdfTexture.font=n.font);aa(n).then(function(a){a.newGlyphSDFs&&(a.newGlyphSDFs.forEach(function(a){var d=a.textureData;a=a.atlasIndex;for(var e=c.sdfTexture.image;e.data.length<(a+1)*b*b;){var g=new Uint8Array(2*e.data.length);g.set(e.data);e.data=g;e.height*=2}g=e.width/b;for(var m=0;m<b;m++)for(var q=m*b,u=e.width*b*Math.floor(a/ | ||
g)+a%g*b+m*e.width,l=0;l<b;l++)e.data[u+l]=d[q+l]}),c.sdfTexture.needsUpdate=!0);g(Object.freeze({sdfTexture:c.sdfTexture,sdfGlyphSize:b,sdfMinDistancePercent:.125,glyphBounds:a.glyphBounds,glyphAtlasIndices:a.glyphAtlasIndices,caretPositions:a.caretPositions,caretHeight:a.caretHeight,totalBounds:a.totalBounds,totalBlockSize:a.totalBlockSize}))})}function R(n,g){for(var b in g)g.hasOwnProperty(b)&&(n[b]=g[b]);return n}function U(n,g,b,a){var c=n.getAttribute(g);c&&c.array.length===b.length?(c.array.set(b), | ||
c.needsUpdate=!0):n.setAttribute(g,new z.InstancedBufferAttribute(b,a))}function ba(n){n=Y.createDerivedMaterial(n,{extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new z.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFMinDistancePct:{value:0},uTroikaTotalBounds:{value:new z.Vector4},uTroikaClipRect:{value:new z.Vector4},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nvarying vec2 vTroikaSDFTextureUV;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n", | ||
vertexTransform:"\nvTroikaGlyphUV = vec2(position);\n\nvec2 colsAndRows = uTroikaSDFTextureSize / uTroikaSDFGlyphSize;\nvTroikaSDFTextureUV = vec2(\n mod(aTroikaGlyphIndex, colsAndRows.x) + position.x,\n floor(aTroikaGlyphIndex / colsAndRows.x) + position.y\n) * uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\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 vec4 uTroikaClipRect;\nvarying vec2 vTroikaSDFTextureUV;\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\nfloat troikaGetTextAlpha() {\n float troikaSDFValue = texture2D(uTroikaSDFTexture, vTroikaSDFTextureUV).r;\n \n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(0.5, troikaSDFValue);\n #else\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aaDist = min(\n 0.5,\n 0.5 * min(\n fwidth(vTroikaGlyphUV.x),\n fwidth(vTroikaGlyphUV.y)\n )\n ) / uTroikaSDFMinDistancePct;\n #else\n float aaDist = 0.01;\n #endif\n \n float alpha = uTroikaSDFDebug ? troikaSDFValue : smoothstep(\n 0.5 - aaDist,\n 0.5 + aaDist,\n troikaSDFValue\n );\n #endif\n \n return min(alpha, troikaGetClipAlpha());\n}\n", | ||
fragmentColorTransform:"\nfloat troikaAlphaMult = troikaGetTextAlpha();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n"});m.transparent=!0;Object.defineProperty(m,"shadowSide",{get:function(){return this.side}});return m}var G=M.defineWorkerModule({dependencies:[function(){var m=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 q=c.readUint(b,a);a+=4;var u=c.readUint(b, | ||
a);a+=4;h[n]={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,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, | ||
fragmentColorTransform:"\nfloat troikaAlphaMult = troikaGetTextAlpha();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n"});n.transparent=!0;Object.defineProperty(n,"shadowSide",{get:function(){return this.side}});return n}var G=M.defineWorkerModule({dependencies:[function(){var n=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 m=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[m]={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,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:m.TextDecoder?new m.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+ | ||
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:n.TextDecoder?new n.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, | ||
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 m=d.readUshort(b,a);a+=2;m=g._lctf.readLookupTable(b,e+m,c);f.push(m)}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 m=d.readUshort(b,a);a+=2;m=c(b,f.ltype,e+m);f.tabs.push(m)}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, | ||
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 m=c.readUshort(b,a);a+=2;e.push({tag:k.trim(),tab:g._lctf.readFeatureTable(b,d+m)})}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 m=c.readUshort(b,a);a+=2;e[k.trim()]=g._lctf.readScriptTable(b,d+m)}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 m=c.readUshort(b,a);a+=2;e[k.trim()]=g._lctf.readLangSysTable(b,d+m)}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]; | ||
@@ -23,21 +23,21 @@ 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]; | ||
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,q=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&&(q=d.readShort(b,a+1),k=3);29<=f&&31>=f&&(n=f,k=1);32<=f&&246>=f&&(q=f-139,k=1);247<=f&&250>=f&&(q=256*(f-247)+h+108,k=2);251<=f&&254>=f&&(q=256*-(f-251)-h-108,k=2);255==f&&(q=d.readInt(b,a+1)/65535,k=5);e.push(null!=q?q:"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,q=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 l=b[a+n];n++;var r=l>>4;l&=15;15!=r&&u.push(r);15!=l&&u.push(l);if(15==l)break}r="";l=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"];for(var p=0;p<u.length;p++)r+=l[u[p]];u=parseFloat(r)}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(" "), | ||
q=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"],q=n[k],n=2));null!=q?(e[q]=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 q=c.readUint(b,a);a+=4;var u="p"+k+"e"+n,l=f.indexOf(q);if(-1==l){l=d.tables.length;var r;f.push(q);var p=c.readUshort(b,q);0==p?r=g.cmap.parse0(b,q):4==p?r=g.cmap.parse4(b,q):6==p?r=g.cmap.parse6(b,q):12==p?r=g.cmap.parse12(b, | ||
q):console.log("unknown format: "+p,k,n,q);d.tables.push(r)}if(null!=d[u])throw"multiple tables for one platform+encoding";d[u]=l}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= | ||
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 m= | ||
b[a];a++}else m=d.readUshort(b,a),a+=2;for(h=0;h<=m;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,m=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&&(m=d.readShort(b,a+1),h=3);29<=e&&31>=e&&(k=e,h=1);32<=e&&246>=e&&(m=e-139,h=1);247<=e&&250>=e&&(m=256*(e-247)+f+108,h=2);251<=e&&254>=e&&(m=256*-(e-251)-f-108,h=2);255==e&&(m=d.readInt(b,a+1)/65535,h=5);c.val=null!=m?m:"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,m=null,q=null;20>=f&&(m=f,k=1);12==f&&(m=100*f+h,k=2);if(19==f||20==f)m= | ||
f,k=2;21<=f&&27>=f&&(m=f,k=1);28==f&&(q=d.readShort(b,a+1),k=3);29<=f&&31>=f&&(m=f,k=1);32<=f&&246>=f&&(q=f-139,k=1);247<=f&&250>=f&&(q=256*(f-247)+h+108,k=2);251<=f&&254>=f&&(q=256*-(f-251)-h-108,k=2);255==f&&(q=d.readInt(b,a+1)/65535,k=5);e.push(null!=q?q:"o"+m);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],m=1,q=null,u=null;28==h&&(u=d.readShort(b,a+1),m=3);29==h&&(u=d.readInt(b,a+1),m=5);32<=h&&246>=h&&(u=h-139,m=1);247<=h&&250>=h&&(u=256*(h- | ||
247)+k+108,m=2);251<=h&&254>=h&&(u=256*-(h-251)-k-108,m=2);if(255==h)throw d.readInt(b,a+1),"unknown number";if(30==h){u=[];for(m=1;;){var l=b[a+m];m++;var r=l>>4;l&=15;15!=r&&u.push(r);15!=l&&u.push(l);if(15==l)break}r="";l=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"];for(var p=0;p<u.length;p++)r+=l[u[p]];u=parseFloat(r)}21>=h&&(m="version Notice FullName FamilyName Weight FontBBox BlueValues OtherBlues FamilyBlues FamilyOtherBlues StdHW StdVW escape UniqueID XUID charset Encoding CharStrings Private Subrs defaultWidthX nominalWidthX".split(" "), | ||
q=m[h],m=1,12==h&&(m=["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"],q=m[k],m=2));null!=q?(e[q]=1==f.length? | ||
f[0]:f,f=[]):f.push(u);a+=m}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 m=c.readUshort(b,a);a+=2;var q=c.readUint(b,a);a+=4;var u="p"+k+"e"+m,l=f.indexOf(q);if(-1==l){l=d.tables.length;var r;f.push(q);var p=c.readUshort(b,q);0==p?r=g.cmap.parse0(b,q):4==p?r=g.cmap.parse4(b,q):6==p?r=g.cmap.parse6(b,q):12==p?r=g.cmap.parse12(b, | ||
q):console.log("unknown format: "+p,k,m,q);d.tables.push(r)}if(null!=d[u])throw"multiple tables for one platform+encoding";d[u]=l}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< | ||
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),m=c.readUint(b,h+4);h=c.readUint(b,h+8);d.groups.push([k,m,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< | ||
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 m=0;m<k;m++)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 q=d.readUshort(b,c);c+=2;for(var u=0;u<q;u++){var l=e+d.readUshort(b,c);c+=2;var r=d.readUshort(b,l);l+=2;for(var p=[],t=0;t<r;t++){var y=d.readUshort(b,l);l+=2;if(0!=k){var m=g.GPOS.readValueRecord(b,l,k);l+=2*a}if(0!=n){var x=g.GPOS.readValueRecord(b,l,n);l+=2*h}p.push({gid2:y,val1:m,val2:x})}f.pairsets.push(p)}}if(2== | ||
f.fmt)for(m=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+m),f.classDef2=g._lctf.readClassDef(b,e+x),f.matrix=[],u=0;u<k;u++){e=[];for(t=0;t<d;t++)x=m=null,0!=f.valFmt1&&(m=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:m,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, | ||
0!=k&&(f.pos=g.GPOS.readValueRecord(b,c,k))}else if(2==a){k=d.readUshort(b,c);c+=2;var m=d.readUshort(b,c);c+=2;a=g._lctf.numOfOnes(k);h=g._lctf.numOfOnes(m);if(1==f.fmt){f.pairsets=[];var q=d.readUshort(b,c);c+=2;for(var u=0;u<q;u++){var l=e+d.readUshort(b,c);c+=2;var r=d.readUshort(b,l);l+=2;for(var p=[],t=0;t<r;t++){var y=d.readUshort(b,l);l+=2;if(0!=k){var n=g.GPOS.readValueRecord(b,l,k);l+=2*a}if(0!=m){var x=g.GPOS.readValueRecord(b,l,m);l+=2*h}p.push({gid2:y,val1:n,val2:x})}f.pairsets.push(p)}}if(2== | ||
f.fmt)for(n=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+n),f.classDef2=g._lctf.readClassDef(b,e+x),f.matrix=[],u=0;u<k;u++){e=[];for(t=0;t<d;t++)x=n=null,0!=f.valFmt1&&(n=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:n,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+= | ||
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 m=0;m<h;m++)k.push(g._lctf.readCoverage(b, | ||
e+d.readUshort(b,c+2*m)));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= | ||
@@ -49,7 +49,7 @@ 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+= | ||
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 q=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(q);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+ | ||
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 m=d.readUshort(b,a);a+=2;var q=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(m);e.vals.push(q);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 q=c.readUshort(b,a);a+=2;var u=c.readUshort(b,a);a+=2;var l=c.readUshort(b,a);a+=2;var r=c.readUshort(b,a);a+=2;var p=c.readUshort(b,a);a+=2;l=f[l];p=h+12*e+p;if(0==n)r=c.readUnicode(b,p,r/2);else if(3==n&&0==q)r=c.readUnicode(b,p,r/2);else if(0==q)r=c.readASCII(b,p,r);else if(1==q)r=c.readUnicode(b,p,r/2);else if(3==q)r=c.readUnicode(b,p,r/2);else if(1==n)r=c.readASCII(b,p,r),console.log("reading unknown MAC encoding "+q+" as ASCII");else throw"unknown encoding "+ | ||
q+", platformID: "+n;n="p"+n+","+u.toString(16);null==d[n]&&(d[n]={});d[n][l]=r;d[n]._lang=u}for(var t in d)if(null!=d[t].postScriptName&&1033==d[t]._lang)return d[t];for(t in d)if(null!=d[t].postScriptName&&0==d[t]._lang)return d[t];for(t in d)if(null!=d[t].postScriptName&&3084==d[t]._lang)return d[t];for(t in d)if(null!=d[t].postScriptName)return d[t];for(t in d){var y=t;break}console.log("returning name table with languageID "+d[y]._lang);return d[y]};g["OS/2"]={};g["OS/2"].parse=function(b,a, | ||
h=a,k=0;k<e;k++){var m=c.readUshort(b,a);a+=2;var q=c.readUshort(b,a);a+=2;var u=c.readUshort(b,a);a+=2;var l=c.readUshort(b,a);a+=2;var r=c.readUshort(b,a);a+=2;var p=c.readUshort(b,a);a+=2;l=f[l];p=h+12*e+p;if(0==m)r=c.readUnicode(b,p,r/2);else if(3==m&&0==q)r=c.readUnicode(b,p,r/2);else if(0==q)r=c.readASCII(b,p,r);else if(1==q)r=c.readUnicode(b,p,r/2);else if(3==q)r=c.readUnicode(b,p,r/2);else if(1==m)r=c.readASCII(b,p,r),console.log("reading unknown MAC encoding "+q+" as ASCII");else throw"unknown encoding "+ | ||
q+", platformID: "+m;m="p"+m+","+u.toString(16);null==d[m]&&(d[m]={});d[m][l]=r;d[m]._lang=u}for(var t in d)if(null!=d[t].postScriptName&&1033==d[t]._lang)return d[t];for(t in d)if(null!=d[t].postScriptName&&0==d[t]._lang)return d[t];for(t in d)if(null!=d[t].postScriptName&&3084==d[t]._lang)return d[t];for(t in d)if(null!=d[t].postScriptName)return d[t];for(t in d){var y=t;break}console.log("returning name table with languageID "+d[y]._lang);return d[y]};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= | ||
@@ -59,57 +59,57 @@ 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, | ||
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 q=c.readUshort(b,a);a+=2;var u=c.readUint(b,a);a+=4;var l=c.readUint(b,a);a+=4;u=new Uint8Array(b.buffer,e+u+f,l);for(u=c.readUTF8(u,0,u.length);n<=q;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= | ||
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 m=c.readUshort(b,a); | ||
a+=2;var q=c.readUshort(b,a);a+=2;var u=c.readUint(b,a);a+=4;var l=c.readUint(b,a);a+=4;u=new Uint8Array(b.buffer,e+u+f,l);for(u=c.readUTF8(u,0,u.length);m<=q;m++)d.entries[m]=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 q=b[c];c++;if("z"==q)n.push("Z"),d=f,e=h;else for(var u=q.toUpperCase(),l=g.SVG._reps(b,c,k[u]),r=0;r<l;r++){var p=0,t=0;q!=u&&(p=d,t=e);if("M"==u)d=p+b[c++],e=t+b[c++],n.push("M"), | ||
a.push(d,e),f=d,h=e;else if("L"==u)d=p+b[c++],e=t+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=t+b[c++],n.push("L"),a.push(d,e);else if("C"==u){d=p+b[c++];e=t+b[c++];var y=p+b[c++],m=t+b[c++];p+=b[c++];t+=b[c++];n.push("C");a.push(d,e,y,m,p,t);d=p;e=t}else"S"==u?(y=Math.max(a.length-4,0),d=d+d-a[y],e=e+e-a[y+1],y=p+b[c++],m=t+b[c++],p+=b[c++],t+=b[c++],n.push("C"),a.push(d,e,y,m,p,t),d=p,e=t):console.log("Unknown SVG command "+q)}}};g.SVG._reps= | ||
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},m=a.cmds;for(a=a.crds;c<b.length;){var q=b[c];c++;if("z"==q)m.push("Z"),d=f,e=h;else for(var u=q.toUpperCase(),l=g.SVG._reps(b,c,k[u]),r=0;r<l;r++){var p=0,t=0;q!=u&&(p=d,t=e);if("M"==u)d=p+b[c++],e=t+b[c++],m.push("M"), | ||
a.push(d,e),f=d,h=e;else if("L"==u)d=p+b[c++],e=t+b[c++],m.push("L"),a.push(d,e);else if("H"==u)d=p+b[c++],m.push("L"),a.push(d,e);else if("V"==u)e=t+b[c++],m.push("L"),a.push(d,e);else if("C"==u){d=p+b[c++];e=t+b[c++];var y=p+b[c++],n=t+b[c++];p+=b[c++];t+=b[c++];m.push("C");a.push(d,e,y,n,p,t);d=p;e=t}else"S"==u?(y=Math.max(a.length-4,0),d=d+d-a[y],e=e+e-a[y+1],y=p+b[c++],n=t+b[c++],p+=b[c++],t+=b[c++],m.push("C"),a.push(d,e,y,n,p,t),d=p,e=t):console.log("Unknown SVG command "+q)}}};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,q=b.flags[h]&1,u=b.flags[k]&1,l=b.xs[f],r=b.ys[f];if(f==d)if(n)if(q)g.U.P.moveTo(a,b.xs[h],b.ys[h]);else{g.U.P.moveTo(a,l,r);continue}else q?g.U.P.moveTo(a,b.xs[h],b.ys[h]):g.U.P.moveTo(a,(b.xs[h]+l)/2,(b.ys[h]+r)/2);n?q&&g.U.P.lineTo(a,l,r):u?g.U.P.qcurveTo(a,l,r,b.xs[k],b.ys[k]):g.U.P.qcurveTo(a,l,r,(l+b.xs[k])/2,(r+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 q=e[k.tab[n]],u=0;u<q.tabs.length;u++)if(null!=q.tabs[h]){var l=q.tabs[u];if(l.coverage){var r=g._lctf.coverageIndex(l.coverage,a);if(-1==r)continue}if(1!=q.ltype&&2==q.ltype){var p;if(1==l.fmt)for(l=l.pairsets[r],h=0;h<l.length;h++)l[h].gid2==c&&(p=l[h]);else if(2==l.fmt){p=g.U._getGlyphClass(a,l.classDef1);var t=g.U._getGlyphClass(c,l.classDef2);p=l.matrix[p][t]}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 q=b[k.tab[n]],u=0;u<c.length;u++){var l=g.U._getWPfeature(a,u);-1!="isol,init,fina,medi".indexOf(k.tag)&&k.tag!=l||g.U._applySubs(c,u,q,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- | ||
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,m=b.flags[f]&1,q=b.flags[h]&1,u=b.flags[k]&1,l=b.xs[f],r=b.ys[f];if(f==d)if(m)if(q)g.U.P.moveTo(a,b.xs[h],b.ys[h]);else{g.U.P.moveTo(a,l,r);continue}else q?g.U.P.moveTo(a,b.xs[h],b.ys[h]):g.U.P.moveTo(a,(b.xs[h]+l)/2,(b.ys[h]+r)/2);m?q&&g.U.P.lineTo(a,l,r):u?g.U.P.qcurveTo(a,l,r,b.xs[k],b.ys[k]):g.U.P.qcurveTo(a,l,r,(l+b.xs[k])/2,(r+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],m=e.crds[h+1];c.crds.push(k*f.a+m*f.b+f.tx);c.crds.push(k*f.c+m*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 m=0;m<k.tab.length;m++)if(!f[k.tab[m]]){f[k.tab[m]]= | ||
!0;for(var q=e[k.tab[m]],u=0;u<q.tabs.length;u++)if(null!=q.tabs[h]){var l=q.tabs[u];if(l.coverage){var r=g._lctf.coverageIndex(l.coverage,a);if(-1==r)continue}if(1!=q.ltype&&2==q.ltype){var p;if(1==l.fmt)for(l=l.pairsets[r],h=0;h<l.length;h++)l[h].gid2==c&&(p=l[h]);else if(2==l.fmt){p=g.U._getGlyphClass(a,l.classDef1);var t=g.U._getGlyphClass(c,l.classDef2);p=l.matrix[p][t]}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 m=0;m<k.tab.length;m++)if(!f[k.tab[m]]){f[k.tab[m]]= | ||
!0;for(var q=b[k.tab[m]],u=0;u<c.length;u++){var l=g.U._getWPfeature(a,u);-1!="isol,init,fina,medi".indexOf(k.tag)&&k.tag!=l||g.U._applySubs(c,u,q,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"};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],q=0;q<n.length;q++){var u=n[q];h=u.chain.length;if(!(h>e)){for(var l= | ||
!0,r=0,p=0;p<h;p++){for(;-1==b[a+r+(1+p)];)r++;u.chain[p]!=b[a+r+(1+p)]&&(l=!1)}if(l){b[a]=u.nglyph;for(p=0;p<h+r;p++)b[a+p+1]=-1;break}}}else if(5==c.ltype&&2==h.fmt)for(n=g._lctf.getInterval(h.cDef,b[a]),r=h.scset[h.cDef[n+2]],u=0;u<r.length;u++){q=r[u];var t=q.input;if(!(t.length>e)){l=!0;for(p=0;p<t.length;p++){var m=g._lctf.getInterval(h.cDef,b[a+1+p]);if(-1==n&&h.cDef[m+2]!=t[p]){l=!1;break}}if(l)for(l=q.substLookupRecords,q=0;q<l.length;q+=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(l=h.lookupRec,u=0;u<l.length;u+=2)n=l[u],g.U._applySubs(b,a+n,d[l[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),q=0;q<n.crds.length;q+= | ||
2)d.crds.push(n.crds[q]+e),d.crds.push(n.crds[q+1]);c&&d.cmds.push(c);for(q=0;q<n.cmds.length;q++)d.cmds.push(n.cmds[q]);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=!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 m=h.vals[k],q=0;q<m.length;q++){var u=m[q];h=u.chain.length;if(!(h>e)){for(var l= | ||
!0,r=0,p=0;p<h;p++){for(;-1==b[a+r+(1+p)];)r++;u.chain[p]!=b[a+r+(1+p)]&&(l=!1)}if(l){b[a]=u.nglyph;for(p=0;p<h+r;p++)b[a+p+1]=-1;break}}}else if(5==c.ltype&&2==h.fmt)for(m=g._lctf.getInterval(h.cDef,b[a]),r=h.scset[h.cDef[m+2]],u=0;u<r.length;u++){q=r[u];var t=q.input;if(!(t.length>e)){l=!0;for(p=0;p<t.length;p++){var n=g._lctf.getInterval(h.cDef,b[a+1+p]);if(-1==m&&h.cDef[n+2]!=t[p]){l=!1;break}}if(l)for(l=q.substLookupRecords,q=0;q<l.length;q+=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(l=h.lookupRec,u=0;u<l.length;u+=2)m=l[u],g.U._applySubs(b,a+m,d[l[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,m=g.U.glyphToPath(b,h),q=0;q<m.crds.length;q+= | ||
2)d.crds.push(m.crds[q]+e),d.crds.push(m.crds[q+1]);c&&d.cmds.push(c);for(q=0;q<m.cmds.length;q++)d.cmds.push(m.cmds[q]);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,q=a.open,u=0,l=a.x,r=a.y,p,t,m,v,x,A,B,E,C,F,z={val:0,size:0};u<b.length;){g.CFF.getCharString(b,u,z);var w=z.val;u+=z.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),q&&g.U.P.closePath(e),r+=f.pop(),g.U.P.moveTo(e,l,r),q=!0;else if("o5"==w)for(;0<f.length;)l+=f.shift(),r+=f.shift(),g.U.P.lineTo(e,l,r);else if("o6"==w||"o7"==w)for(x=f.length,p="o6"==w,t=0;t<x;t++)m=f.shift(),p?l+=m:r+=m,p=!p,g.U.P.lineTo(e,l,r);else if("o8"==w||"o24"==w){x=f.length;for(A=0;A+6<=x;)p=l+f.shift(),t=r+f.shift(),m=p+f.shift(), | ||
v=t+f.shift(),l=m+f.shift(),r=v+f.shift(),g.U.P.curveTo(e,p,t,m,v,l,r),A+=6;"o24"==w&&(l+=f.shift(),r+=f.shift(),g.U.P.lineTo(e,l,r))}else if("o11"==w)break;else if("o1234"==w||"o1235"==w||"o1236"==w||"o1237"==w)"o1234"==w&&(p=l+f.shift(),t=r,m=p+f.shift(),v=t+f.shift(),C=m+f.shift(),F=v,x=C+f.shift(),A=v,B=x+f.shift(),E=r,l=B+f.shift(),g.U.P.curveTo(e,p,t,m,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r)),"o1235"==w&&(p=l+f.shift(),t=r+f.shift(),m=p+f.shift(),v=t+f.shift(),C=m+f.shift(),F=v+f.shift(),x=C+f.shift(), | ||
A=F+f.shift(),B=x+f.shift(),E=A+f.shift(),l=B+f.shift(),r=E+f.shift(),f.shift(),g.U.P.curveTo(e,p,t,m,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r)),"o1236"==w&&(p=l+f.shift(),t=r+f.shift(),m=p+f.shift(),v=t+f.shift(),C=m+f.shift(),F=v,x=C+f.shift(),A=v,B=x+f.shift(),E=A+f.shift(),l=B+f.shift(),g.U.P.curveTo(e,p,t,m,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r)),"o1237"==w&&(p=l+f.shift(),t=r+f.shift(),m=p+f.shift(),v=t+f.shift(),C=m+f.shift(),F=v+f.shift(),x=C+f.shift(),A=F+f.shift(),B=x+f.shift(),E=A+f.shift(),Math.abs(B- | ||
l)>Math.abs(E-r)?l=B+f.shift():r=E+f.shift(),g.U.P.curveTo(e,p,t,m,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r));else if("o14"==w)0<f.length&&!k&&(n=f.shift()+c.nominalWidthX,k=!0),4==f.length&&(p=f.shift(),t=f.shift(),v=f.shift(),m=f.shift(),v=g.CFF.glyphBySE(c,v),m=g.CFF.glyphBySE(c,m),g.U._drawCFF(c.CharStrings[v],a,c,d,e),a.x=p,a.y=t,g.U._drawCFF(c.CharStrings[m],a,c,d,e)),q&&(g.U.P.closePath(e),q=!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),r+=f.pop(),l+=f.pop(),q&&g.U.P.closePath(e),g.U.P.moveTo(e,l,r),q=!0;else if("o22"==w)1<f.length&&!k&&(n=f.shift()+d.nominalWidthX,k=!0),l+=f.pop(),q&&g.U.P.closePath(e),g.U.P.moveTo(e,l,r),q=!0;else if("o25"==w){for(;6<f.length;)l+=f.shift(),r+=f.shift(),g.U.P.lineTo(e,l,r);p=l+f.shift();t=r+f.shift();m=p+f.shift();v=t+f.shift();l=m+f.shift();r=v+f.shift();g.U.P.curveTo(e,p,t,m,v,l,r)}else if("o26"==w)for(f.length% | ||
2&&(l+=f.shift());0<f.length;)p=l,t=r+f.shift(),m=p+f.shift(),v=t+f.shift(),l=m,r=v+f.shift(),g.U.P.curveTo(e,p,t,m,v,l,r);else if("o27"==w)for(f.length%2&&(r+=f.shift());0<f.length;)p=l+f.shift(),t=r,m=p+f.shift(),v=t+f.shift(),l=m+f.shift(),r=v,g.U.P.curveTo(e,p,t,m,v,l,r);else if("o10"==w||"o29"==w)p="o10"==w?d:c,0==f.length?console.log("error: empty stack"):(t=f.pop(),p=p.Subrs[t+p.Bias],a.x=l,a.y=r,a.nStems=h,a.haveWidth=k,a.width=n,a.open=q,g.U._drawCFF(p,a,c,d,e),l=a.x,r=a.y,h=a.nStems,k=a.haveWidth, | ||
n=a.width,q=a.open);else if("o30"==w||"o31"==w)for(p=f.length,A=0,w="o31"==w,x=p&-3,A+=p-x;A<x;)w?(p=l+f.shift(),t=r,m=p+f.shift(),v=t+f.shift(),r=v+f.shift(),5==x-A?(l=m+f.shift(),A++):l=m,w=!1):(p=l,t=r+f.shift(),m=p+f.shift(),v=t+f.shift(),l=m+f.shift(),5==x-A?(r=v+f.shift(),A++):r=v,w=!0),g.U.P.curveTo(e,p,t,m,v,l,r),A+=4;else{if("o"==(w+"").charAt(0))throw console.log("Unknown operation: "+w,b),w;f.push(w)}}a.x=l;a.y=r;a.nStems=h;a.haveWidth=k;a.width=n;a.open=q};return g},function(){function m(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(A,a);A+=2}function f(a){x.setUint32(A,a);A+=4}var g=new DataView(b),k=0;d();var n=d();d();var q=c();c();d();c();c();d();d();d();d();d();for(var m=0;Math.pow(2,m)<=q;)m++;m--;for(var l=16*Math.pow(2,m),r=16*q-l,p=12,t=[],y=0;y<q;y++)t.push({tag:d(),offset:d(),compLength:d(),origLength:d(),origChecksum:d()}),p+=16;var v=new Uint8Array(12+16*t.length+t.reduce(function(a,b){return a+ | ||
b.origLength+4},0));y=v.buffer;var x=new DataView(y),A=0;f(n);e(q);e(l);e(m);e(r);t.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;t.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+ | ||
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,m=a.width,q=a.open,u=0,l=a.x,r=a.y,p,t,n,v,x,A,B,E,C,F,z={val:0,size:0};u<b.length;){g.CFF.getCharString(b,u,z);var w=z.val;u+=z.size;if("o1"==w||"o18"==w)(p=0!==f.length%2)&&!k&&(m=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&&(m=f.shift()+d.nominalWidthX),h+=f.length>>1,f.length=0,k=!0;else if("o4"==w)1<f.length&&!k&&(m=f.shift()+d.nominalWidthX,k=!0),q&&g.U.P.closePath(e),r+=f.pop(),g.U.P.moveTo(e,l,r),q=!0;else if("o5"==w)for(;0<f.length;)l+=f.shift(),r+=f.shift(),g.U.P.lineTo(e,l,r);else if("o6"==w||"o7"==w)for(x=f.length,p="o6"==w,t=0;t<x;t++)n=f.shift(),p?l+=n:r+=n,p=!p,g.U.P.lineTo(e,l,r);else if("o8"==w||"o24"==w){x=f.length;for(A=0;A+6<=x;)p=l+f.shift(),t=r+f.shift(),n=p+f.shift(), | ||
v=t+f.shift(),l=n+f.shift(),r=v+f.shift(),g.U.P.curveTo(e,p,t,n,v,l,r),A+=6;"o24"==w&&(l+=f.shift(),r+=f.shift(),g.U.P.lineTo(e,l,r))}else if("o11"==w)break;else if("o1234"==w||"o1235"==w||"o1236"==w||"o1237"==w)"o1234"==w&&(p=l+f.shift(),t=r,n=p+f.shift(),v=t+f.shift(),C=n+f.shift(),F=v,x=C+f.shift(),A=v,B=x+f.shift(),E=r,l=B+f.shift(),g.U.P.curveTo(e,p,t,n,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r)),"o1235"==w&&(p=l+f.shift(),t=r+f.shift(),n=p+f.shift(),v=t+f.shift(),C=n+f.shift(),F=v+f.shift(),x=C+f.shift(), | ||
A=F+f.shift(),B=x+f.shift(),E=A+f.shift(),l=B+f.shift(),r=E+f.shift(),f.shift(),g.U.P.curveTo(e,p,t,n,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r)),"o1236"==w&&(p=l+f.shift(),t=r+f.shift(),n=p+f.shift(),v=t+f.shift(),C=n+f.shift(),F=v,x=C+f.shift(),A=v,B=x+f.shift(),E=A+f.shift(),l=B+f.shift(),g.U.P.curveTo(e,p,t,n,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r)),"o1237"==w&&(p=l+f.shift(),t=r+f.shift(),n=p+f.shift(),v=t+f.shift(),C=n+f.shift(),F=v+f.shift(),x=C+f.shift(),A=F+f.shift(),B=x+f.shift(),E=A+f.shift(),Math.abs(B- | ||
l)>Math.abs(E-r)?l=B+f.shift():r=E+f.shift(),g.U.P.curveTo(e,p,t,n,v,C,F),g.U.P.curveTo(e,x,A,B,E,l,r));else if("o14"==w)0<f.length&&!k&&(m=f.shift()+c.nominalWidthX,k=!0),4==f.length&&(p=f.shift(),t=f.shift(),v=f.shift(),n=f.shift(),v=g.CFF.glyphBySE(c,v),n=g.CFF.glyphBySE(c,n),g.U._drawCFF(c.CharStrings[v],a,c,d,e),a.x=p,a.y=t,g.U._drawCFF(c.CharStrings[n],a,c,d,e)),q&&(g.U.P.closePath(e),q=!1);else if("o19"==w||"o20"==w)(p=0!==f.length%2)&&!k&&(m=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&&(m=f.shift()+d.nominalWidthX,k=!0),r+=f.pop(),l+=f.pop(),q&&g.U.P.closePath(e),g.U.P.moveTo(e,l,r),q=!0;else if("o22"==w)1<f.length&&!k&&(m=f.shift()+d.nominalWidthX,k=!0),l+=f.pop(),q&&g.U.P.closePath(e),g.U.P.moveTo(e,l,r),q=!0;else if("o25"==w){for(;6<f.length;)l+=f.shift(),r+=f.shift(),g.U.P.lineTo(e,l,r);p=l+f.shift();t=r+f.shift();n=p+f.shift();v=t+f.shift();l=n+f.shift();r=v+f.shift();g.U.P.curveTo(e,p,t,n,v,l,r)}else if("o26"==w)for(f.length% | ||
2&&(l+=f.shift());0<f.length;)p=l,t=r+f.shift(),n=p+f.shift(),v=t+f.shift(),l=n,r=v+f.shift(),g.U.P.curveTo(e,p,t,n,v,l,r);else if("o27"==w)for(f.length%2&&(r+=f.shift());0<f.length;)p=l+f.shift(),t=r,n=p+f.shift(),v=t+f.shift(),l=n+f.shift(),r=v,g.U.P.curveTo(e,p,t,n,v,l,r);else if("o10"==w||"o29"==w)p="o10"==w?d:c,0==f.length?console.log("error: empty stack"):(t=f.pop(),p=p.Subrs[t+p.Bias],a.x=l,a.y=r,a.nStems=h,a.haveWidth=k,a.width=m,a.open=q,g.U._drawCFF(p,a,c,d,e),l=a.x,r=a.y,h=a.nStems,k=a.haveWidth, | ||
m=a.width,q=a.open);else if("o30"==w||"o31"==w)for(p=f.length,A=0,w="o31"==w,x=p&-3,A+=p-x;A<x;)w?(p=l+f.shift(),t=r,n=p+f.shift(),v=t+f.shift(),r=v+f.shift(),5==x-A?(l=n+f.shift(),A++):l=n,w=!1):(p=l,t=r+f.shift(),n=p+f.shift(),v=t+f.shift(),l=n+f.shift(),5==x-A?(r=v+f.shift(),A++):r=v,w=!0),g.U.P.curveTo(e,p,t,n,v,l,r),A+=4;else{if("o"==(w+"").charAt(0))throw console.log("Unknown operation: "+w,b),w;f.push(w)}}a.x=l;a.y=r;a.nStems=h;a.haveWidth=k;a.width=m;a.open=q};return g},function(){function n(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(A,a);A+=2}function f(a){x.setUint32(A,a);A+=4}var g=new DataView(b),k=0;d();var m=d();d();var q=c();c();d();c();c();d();d();d();d();d();for(var n=0;Math.pow(2,n)<=q;)n++;n--;for(var l=16*Math.pow(2,n),r=16*q-l,p=12,t=[],y=0;y<q;y++)t.push({tag:d(),offset:d(),compLength:d(),origLength:d(),origChecksum:d()}),p+=16;var v=new Uint8Array(12+16*t.length+t.reduce(function(a,b){return a+ | ||
b.origLength+4},0));y=v.buffer;var x=new DataView(y),A=0;f(m);e(q);e(l);e(n);e(r);t.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;t.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 y.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,q[d],m[d]);var h=f(a,c);for(g=h=a.destLen-e(a,l[h],r[h]);g<h+d;++g)a.dest[a.destLen++]=a.dest[g]}}}var k=new b,n=new b,q=new Uint8Array(30),m=new Uint16Array(30),l=new Uint8Array(30),r=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]),t=new b,y=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(q,m,4,3);c(l,r,2,1);q[28]=0;m[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 l=h.source[h.sourceIndex+1]; | ||
l=256*l+h.source[h.sourceIndex];var m=h.source[h.sourceIndex+3];m=256*m+h.source[h.sourceIndex+2];if(l!==(~m&65535))h=-3;else{h.sourceIndex+=4;for(m=l;m;--m)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;l=b;var r=b.ltree,u=b.dtree;m=e(l,5,257);h=e(l,5,1);var v=e(l,4,4);for(q=0;19>q;++q)y[q]=0;for(q=0;q<v;++q){var x=e(l,3,0);y[p[q]]=x}d(t,y,0,19);for(q=0;q<m+h;)switch(v=f(l,t),v){case 16:x=y[q-1];for(v=e(l,2,3);v;--v)y[q++]=x;break;case 17:for(v= | ||
e(l,3,3);v;--v)y[q++]=0;break;case 18:for(v=e(l,7,11);v;--v)y[q++]=0;break;default:y[q++]=v}d(r,y,0,m);d(u,y,m,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 m(b,g)}},function(m,g){function b(b){var c=b[0],e=Object.create(null),f={unitsPerEm:c.head.unitsPerEm,ascender:c.hhea.ascender,descender:c.hhea.descender, | ||
forEachGlyph:function(b,d,g,q){var h=0,k=1/f.unitsPerEm*d,n=0;m.U.stringToGlyphs(c,b).forEach(function(f){if(-1!==f){var l=e[f];if(!l){l=m.glyf._parseGlyf(c,f)||{xMin:0,xMax:0,yMin:0,yMax:0};var p=m.U.glyphToPath(c,f),r=p.cmds,u=p.crds;l=e[f]={index:f,advanceWidth:c.hmtx.aWidth[f],xMin:l.xMin,yMin:l.yMin,xMax:l.xMax,yMax:l.yMax,pathCommandCount:r.length,forEachPathCommand:function(b){for(var c=0,d=[],e=0,f=r.length;e<f;e++){var g=a[r[e]];d.length=1+g;d[0]=r[e];for(var h=1;h<=g;h++)d[h]=u[c++];b.apply(null, | ||
d)}}}}q.call(null,l,h,n);l.advanceWidth&&(h+=l.advanceWidth*k);g&&(h+=g*d)}n+=65535<b.codePointAt(n)?2:1});return h}};return f}var a={M:2,L:2,Q:4,C:6,Z:0};return function(a){var c=new Uint8Array(a,0,4);c=m._bin.readASCII(c,0,4);if("wOFF"===c)a=g(a);else if("wOF2"===c)throw Error("woff2 fonts not supported");return b(m.parse(a))}}],init:function(m,g,b){m=m();g=g();return b(m,g)}}),K={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,textureWidth:2048}, | ||
S=document.createElement("a"),T=Object.create(null);G=M.defineWorkerModule({dependencies:[K,.125,G,function(m){function g(a){return a*a}var b=m.sdfTextureSize,a=m.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,m=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 l=b.data;if(l)if(l.cx===q&&l.cy===m){for(;l.next;)l=l.next;l.next=a}else b.data=null,this._insertSegment(l,b),this._insertSegment(a,b);else q=(m<b.cy?0:2)+(q<b.cx?0:1),b[q]?this._insertSegment(a, | ||
f(a,b);if(256===d)return 0;if(256>d)a.dest[a.destLen++]=d;else{var g;d-=257;d=e(a,q[d],n[d]);var h=f(a,c);for(g=h=a.destLen-e(a,l[h],r[h]);g<h+d;++g)a.dest[a.destLen++]=a.dest[g]}}}var k=new b,m=new b,q=new Uint8Array(30),n=new Uint16Array(30),l=new Uint8Array(30),r=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]),t=new b,y=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,m);c(q,n,4,3);c(l,r,2,1);q[28]=0;n[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 l=h.source[h.sourceIndex+1]; | ||
l=256*l+h.source[h.sourceIndex];var n=h.source[h.sourceIndex+3];n=256*n+h.source[h.sourceIndex+2];if(l!==(~n&65535))h=-3;else{h.sourceIndex+=4;for(n=l;n;--n)h.dest[h.destLen++]=h.source[h.sourceIndex++];h=h.bitcount=0}break;case 1:h=g(b,k,m);break;case 2:var q;l=b;var r=b.ltree,u=b.dtree;n=e(l,5,257);h=e(l,5,1);var v=e(l,4,4);for(q=0;19>q;++q)y[q]=0;for(q=0;q<v;++q){var x=e(l,3,0);y[p[q]]=x}d(t,y,0,19);for(q=0;q<n+h;)switch(v=f(l,t),v){case 16:x=y[q-1];for(v=e(l,2,3);v;--v)y[q++]=x;break;case 17:for(v= | ||
e(l,3,3);v;--v)y[q++]=0;break;case 18:for(v=e(l,7,11);v;--v)y[q++]=0;break;default:y[q++]=v}d(r,y,0,n);d(u,y,n,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 n(b,g)}},function(n,g){function b(b){var c=b[0],e=Object.create(null),f={unitsPerEm:c.head.unitsPerEm,ascender:c.hhea.ascender,descender:c.hhea.descender, | ||
forEachGlyph:function(b,d,g,q){var h=0,k=1/f.unitsPerEm*d,m=0;n.U.stringToGlyphs(c,b).forEach(function(f){if(-1!==f){var l=e[f];if(!l){l=n.glyf._parseGlyf(c,f)||{xMin:0,xMax:0,yMin:0,yMax:0};var p=n.U.glyphToPath(c,f),r=p.cmds,u=p.crds;l=e[f]={index:f,advanceWidth:c.hmtx.aWidth[f],xMin:l.xMin,yMin:l.yMin,xMax:l.xMax,yMax:l.yMax,pathCommandCount:r.length,forEachPathCommand:function(b){for(var c=0,d=[],e=0,f=r.length;e<f;e++){var g=a[r[e]];d.length=1+g;d[0]=r[e];for(var h=1;h<=g;h++)d[h]=u[c++];b.apply(null, | ||
d)}}}}q.call(null,l,h,m);l.advanceWidth&&(h+=l.advanceWidth*k);g&&(h+=g*d)}m+=65535<b.codePointAt(m)?2:1});return h}};return f}var a={M:2,L:2,Q:4,C:6,Z:0};return function(a){var c=new Uint8Array(a,0,4);c=n._bin.readASCII(c,0,4);if("wOFF"===c)a=g(a);else if("wOF2"===c)throw Error("woff2 fonts not supported");return b(n.parse(a))}}],init:function(n,g,b){n=n();g=g();return b(n,g)}}),K={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,textureWidth:2048}, | ||
S=document.createElement("a"),T=Object.create(null);G=M.defineWorkerModule({dependencies:[K,.125,G,function(n){function g(a){return a*a}var b=n.sdfTextureSize,a=n.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,n=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 l=b.data;if(l)if(l.cx===q&&l.cy===n){for(;l.next;)l=l.next;l.next=a}else b.data=null,this._insertSegment(l,b),this._insertSegment(a,b);else q=(n<b.cy?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;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,m=c.x1-h,p=c.y1-k,t=m*m+p*p;t=t?Math.max(0,Math.min(1,((e-h)*m+(f-k)*p)/t)):0;e=Math.sqrt(g(e-(h+t*m))+g(f-(k+t*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,n=(f+2*k)/b,m=(g+2*k)/b;g=d.xMin-k-n;f=d.yMin-k-m;n=d.xMax+k+n;m=d.yMax+k+m;if(d.pathCommandCount){var u=new c(d),l,r,p,t;d.forEachPathCommand(function(a,b,c,d,e,f,g){switch(a){case "M":p=l=b;t=r=c;break;case "L":b===p&&c===t||u.addLineSegment(p,t,p=b,t=c);break;case "Q":f={x:p,y:t};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*t+2*h*a*c+a*a*e};u.addLineSegment(f.x,f.y,a.x,a.y);f=a}p=d;t=e;break;case "C":a={x:p, | ||
y:t};for(h=1;16>h;h++){var k=h/15;var n=1-k;k={x:n*n*n*p+3*n*n*k*b+3*n*k*k*d+k*k*k*f,y:n*n*n*t+3*n*n*k*c+3*n*k*k*e+k*k*k*g};u.addLineSegment(a.x,a.y,k.x,k.y);a=k}p=f;t=g;break;case "Z":p===l&&t===r||u.addLineSegment(p,t,l,r)}});for(d=0;d<b;d++)for(var y=0;y<b;y++){var v=u.findNearestSignedDistance(g+(n-g)*(d+.5)/b,f+(m-f)*(y+.5)/b,k);v=isFinite(v)?Math.round(127.5*(1+v/k)):v;v=Math.max(0,Math.min(255,v));e[y*b+d]=v}}return{textureData:e,renderingBounds:[g,f,n,m]}}},function(m,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=m(e.response);b(a)}catch(p){d(p)}};e.onerror=d;e.send()}catch(r){d(r)}}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 n=a.letterSpacing;void 0===n&&(n=0);var m=a.lineHeight;void 0===m&&(m="normal");var q=a.maxWidth;void 0===q&&(q=Infinity);var v=a.textAlign;void 0===v&&(v="left");var x=a.whiteSpace;void 0===x&&(x="normal");var A=a.overflowWrap;void 0===A&&(A="normal");var z=a.anchor,E=a.includeCaretPositions; | ||
void 0===E&&(E=!1);void 0===c&&(c=!1);-1<e.indexOf("\r")&&(console.warn("FontProcessor.process: got text with \\r chars; normalizing to \\n"),e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"));d(h,function(a){var d=a.fontObj,f=isFinite(q),h=null,l=null,p=null,r=null,t=null,u=0,y="nowrap"!==x,B=d.ascender,D=d.descender,C=d.unitsPerEm,I=k/C;"normal"===m&&(m=(B-D)/C);m*=k;var K=(m-(B-D)*I)/2;C=Math.min(m,(B-D)*I);var M=(B+D)/2*I-C/2,N=0,J={glyphs:[],width:0},O=[J];d.forEachGlyph(e,k,n,function(a,b,c){var d= | ||
e.charAt(c),g=a.advanceWidth*I,h=!!d&&/\s/.test(d),k=J.glyphs;if(y&&f&&!h&&b+g+N>q&&k.length){if(k[k.length-1].isWhitespace){var n=[];N=-b}else for(var m=k.length;m--;)if(0===m&&"break-word"===A){n=[];N=-b;break}else if(k[m].isWhitespace){n=k.splice(m+1);k=n[0].x;N-=k;for(m=0;m<n.length;m++)n[m].x-=k;break}n&&(J.isSoftWrapped=!0,J={glyphs:n,width:0},O.push(J),u=q)}J.glyphs.push({glyphObj:a,x:b+N,y:0,width:g,char:d,charIndex:c,isWhitespace:h,isEmpty:a.xMin===a.xMax||a.yMin===a.yMax,atlasInfo:null}); | ||
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,n=c.x1-h,p=c.y1-k,t=n*n+p*p;t=t?Math.max(0,Math.min(1,((e-h)*n+(f-k)*p)/t)):0;e=Math.sqrt(g(e-(h+t*n))+g(f-(k+t*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,m=(f+2*k)/b,n=(g+2*k)/b;g=d.xMin-k-m;f=d.yMin-k-n;m=d.xMax+k+m;n=d.yMax+k+n;if(d.pathCommandCount){var u=new c(d),l,r,p,t;d.forEachPathCommand(function(a,b,c,d,e,f,g){switch(a){case "M":p=l=b;t=r=c;break;case "L":b===p&&c===t||u.addLineSegment(p,t,p=b,t=c);break;case "Q":f={x:p,y:t};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*t+2*h*a*c+a*a*e};u.addLineSegment(f.x,f.y,a.x,a.y);f=a}p=d;t=e;break;case "C":a={x:p, | ||
y:t};for(h=1;16>h;h++){var k=h/15;var m=1-k;k={x:m*m*m*p+3*m*m*k*b+3*m*k*k*d+k*k*k*f,y:m*m*m*t+3*m*m*k*c+3*m*k*k*e+k*k*k*g};u.addLineSegment(a.x,a.y,k.x,k.y);a=k}p=f;t=g;break;case "Z":p===l&&t===r||u.addLineSegment(p,t,l,r)}});for(d=0;d<b;d++)for(var y=0;y<b;y++){var v=u.findNearestSignedDistance(g+(m-g)*(d+.5)/b,f+(n-f)*(y+.5)/b,k);v=isFinite(v)?Math.round(127.5*(1+v/k)):v;v=Math.max(0,Math.min(255,v));e[y*b+d]=v}}return{textureData:e,renderingBounds:[g,f,m,n]}}},function(n,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=n(e.response);b(a)}catch(p){d(p)}};e.onerror=d;e.send()}catch(r){d(r)}}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 m=a.letterSpacing;void 0===m&&(m=0);var n=a.lineHeight;void 0===n&&(n="normal");var q=a.maxWidth;void 0===q&&(q=Infinity);var v=a.textAlign;void 0===v&&(v="left");var x=a.whiteSpace;void 0===x&&(x="normal");var A=a.overflowWrap;void 0===A&&(A="normal");var z=a.anchor,E=a.includeCaretPositions; | ||
void 0===E&&(E=!1);void 0===c&&(c=!1);-1<e.indexOf("\r")&&(console.warn("FontProcessor.process: got text with \\r chars; normalizing to \\n"),e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"));k=+k;m=+m;q=+q;d(h,function(a){var d=a.fontObj,f=isFinite(q),h=null,l=null,p=null,r=null,t=null,u=0,y="nowrap"!==x,B=d.ascender,D=d.descender,C=d.unitsPerEm,I=k/C;"normal"===n&&(n=(B-D)/C);n*=k;var K=(n-(B-D)*I)/2;C=Math.min(n,(B-D)*I);var M=(B+D)/2*I-C/2,N=0,J={glyphs:[],width:0},O=[J];d.forEachGlyph(e,k,m,function(a, | ||
b,c){var d=e.charAt(c),g=a.advanceWidth*I,h=!!d&&/\s/.test(d),k=J.glyphs;if(y&&f&&!h&&b+g+N>q&&k.length){if(k[k.length-1].isWhitespace){var m=[];N=-b}else for(var n=k.length;n--;)if(0===n&&"break-word"===A){m=[];N=-b;break}else if(k[n].isWhitespace){m=k.splice(n+1);k=m[0].x;N-=k;for(n=0;n<m.length;n++)m[n].x-=k;break}m&&(J.isSoftWrapped=!0,J={glyphs:m,width:0},O.push(J),u=q)}J.glyphs.push({glyphObj:a,x:b+N,y:0,width:g,char:d,charIndex:c,isWhitespace:h,isEmpty:a.xMin===a.xMax||a.yMin===a.yMax,atlasInfo:null}); | ||
"\n"===d&&(J={glyphs:[],width:0},O.push(J),N=-(b+g))});O.forEach(function(a){for(var b=a.glyphs,c=b.length;c--;){var d=b[c];if(!d.isWhitespace){a.width=d.x+d.width;a.width>u&&(u=a.width);break}}});if(!c){var G=[],L=-(k+K);E&&(r=new Float32Array(3*e.length));var H=-1;O.forEach(function(b){var c=b.glyphs,d=b.width;if(c.length){var e=0,f=0;if("center"===v)e=(u-d)/2;else if("right"===v)e=u-d;else if("justify"===v)for(var k=c.length;k--;)if(!c[k].isWhitespace){for(;k--;)c[k].isWhitespace&&f++;break}k= | ||
0;for(var n=c.length;k<n;k++){var l=c[k];e&&(l.x+=e);l.y=L;if(l.isWhitespace&&"justify"===v&&b.isSoftWrapped){var p=(u-d)/f;e+=p;l.width+=p}if(E){p=l.charIndex;r[3*p]=l.x;r[3*p+1]=l.x+l.width;for(r[3*p+2]=l.y+M;1<p-H;)r[3*(H+1)]=r[3*H+1],r[3*(H+1)+1]=r[3*H+1],r[3*(H+1)+2]=r[3*H+2],H++;H=p}if(!l.isWhitespace&&!l.isEmpty){p=l.glyphObj;var q=a.glyphs[p.index];q||(q=g(p),q.atlasIndex=a.glyphCount++,h||(h=[]),h.push(q),q=a.glyphs[p.index]={atlasIndex:q.atlasIndex,glyphObj:p,renderingBounds:q.renderingBounds}); | ||
l.atlasInfo=q;G.push(l)}}}L-=m});var P=0,Q=0;z&&(z[0]&&(P=-u*z[0]),z[1]&&(Q=O.length*m*z[1]));if(E&&(P||Q))for(d=0,B=r.length;d<B;d+=3)r[d]+=P,r[d+1]+=P,r[d+2]+=Q;l=new Float32Array(4*G.length);p=new Float32Array(G.length);t=[Infinity,Infinity,-Infinity,-Infinity];G.forEach(function(a,b){var c=a.atlasInfo,d=c.renderingBounds;c=c.atlasIndex;var e=l[4*b]=a.x+d[0]*I+P,f=l[4*b+1]=a.y+d[1]*I+Q,g=l[4*b+2]=a.x+d[2]*I+P;a=l[4*b+3]=a.y+d[3]*I+Q;e<t[0]&&(t[0]=e);f<t[1]&&(t[1]=f);g>t[2]&&(t[2]=g);a>t[3]&&(t[3]= | ||
a);p[b]=c})}b({glyphBounds:l,glyphAtlasIndices:p,caretPositions:r,caretHeight:C,totalBounds:t,totalBlockSize:[u,O.length*m],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]})},{metricsOnly:!0})},loadFont:c}}],init:function(m,g,b,a,c){g=a({sdfTextureSize:m.sdfGlyphSize,sdfDistancePercent:g});return c(b,g,{defaultFontUrl:m.defaultFontURL})}});var aa=M.defineWorkerModule({dependencies:[G, | ||
M.ThenableWorkerModule],init:function(m,g){return function(b){var a=new g;m.process(b,a.resolve);return a}},getTransferables:function(m){var g=[m.glyphBounds.buffer,m.glyphAtlasIndices.buffer];m.caretPositions&&g.push(m.caretPositions.buffer);m.newGlyphSDFs&&m.newGlyphSDFs.forEach(function(b){g.push(b.textureData.buffer)});return g}}),ca=(new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),da=new z.Vector3,L=function(m){function g(){m.call(this);this.copy(ca);this.boundingSphere=new z.Sphere}m&&(g.__proto__= | ||
m);g.prototype=Object.create(m&&m.prototype);g.prototype.constructor=g;g.prototype.computeBoundingSphere=function(){};g.prototype.updateGlyphs=function(b,a,c){U(this,"aTroikaGlyphBounds",b,4);U(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(da.set(c[0],c[1],0))};return g}(z.InstancedBufferGeometry);L.prototype.setAttribute||(L.prototype.setAttribute=function(m,g){this.attributes[m]=g;return this}); | ||
var V=new z.MeshBasicMaterial({color:16777215,side:z.DoubleSide,transparent:!0}),ea=new z.Matrix4,W=new z.Mesh((new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),V),X=function(m){function g(a){a=new L;m.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}m&&(g.__proto__=m);g.prototype=Object.create(m&&m.prototype);g.prototype.constructor=g;var b={textRenderInfo:{configurable:!0},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,Z({text:this.text,font:this.font,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight, | ||
0;for(var m=c.length;k<m;k++){var l=c[k];e&&(l.x+=e);l.y=L;if(l.isWhitespace&&"justify"===v&&b.isSoftWrapped){var p=(u-d)/f;e+=p;l.width+=p}if(E){p=l.charIndex;r[3*p]=l.x;r[3*p+1]=l.x+l.width;for(r[3*p+2]=l.y+M;1<p-H;)r[3*(H+1)]=r[3*H+1],r[3*(H+1)+1]=r[3*H+1],r[3*(H+1)+2]=r[3*H+2],H++;H=p}if(!l.isWhitespace&&!l.isEmpty){p=l.glyphObj;var q=a.glyphs[p.index];q||(q=g(p),q.atlasIndex=a.glyphCount++,h||(h=[]),h.push(q),q=a.glyphs[p.index]={atlasIndex:q.atlasIndex,glyphObj:p,renderingBounds:q.renderingBounds}); | ||
l.atlasInfo=q;G.push(l)}}}L-=n});var P=0,Q=0;z&&(z[0]&&(P=-u*z[0]),z[1]&&(Q=O.length*n*z[1]));if(E&&(P||Q))for(d=0,B=r.length;d<B;d+=3)r[d]+=P,r[d+1]+=P,r[d+2]+=Q;l=new Float32Array(4*G.length);p=new Float32Array(G.length);t=[Infinity,Infinity,-Infinity,-Infinity];G.forEach(function(a,b){var c=a.atlasInfo,d=c.renderingBounds;c=c.atlasIndex;var e=l[4*b]=a.x+d[0]*I+P,f=l[4*b+1]=a.y+d[1]*I+Q,g=l[4*b+2]=a.x+d[2]*I+P;a=l[4*b+3]=a.y+d[3]*I+Q;e<t[0]&&(t[0]=e);f<t[1]&&(t[1]=f);g>t[2]&&(t[2]=g);a>t[3]&&(t[3]= | ||
a);p[b]=c})}b({glyphBounds:l,glyphAtlasIndices:p,caretPositions:r,caretHeight:C,totalBounds:t,totalBlockSize:[u,O.length*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]})},{metricsOnly:!0})},loadFont:c}}],init:function(n,g,b,a,c){g=a({sdfTextureSize:n.sdfGlyphSize,sdfDistancePercent:g});return c(b,g,{defaultFontUrl:n.defaultFontURL})}});var aa=M.defineWorkerModule({dependencies:[G, | ||
M.ThenableWorkerModule],init:function(n,g){return function(b){var a=new g;n.process(b,a.resolve);return a}},getTransferables:function(n){var g=[n.glyphBounds.buffer,n.glyphAtlasIndices.buffer];n.caretPositions&&g.push(n.caretPositions.buffer);n.newGlyphSDFs&&n.newGlyphSDFs.forEach(function(b){g.push(b.textureData.buffer)});return g}}),ca=(new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),da=new z.Vector3,L=function(n){function g(){n.call(this);this.copy(ca);this.boundingSphere=new z.Sphere}n&&(g.__proto__= | ||
n);g.prototype=Object.create(n&&n.prototype);g.prototype.constructor=g;g.prototype.computeBoundingSphere=function(){};g.prototype.updateGlyphs=function(b,a,c){U(this,"aTroikaGlyphBounds",b,4);U(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(da.set(c[0],c[1],0))};return g}(z.InstancedBufferGeometry);L.prototype.setAttribute||(L.prototype.setAttribute=function(n,g){this.attributes[n]=g;return this}); | ||
var V=new z.MeshBasicMaterial({color:16777215,side:z.DoubleSide,transparent:!0}),ea=new z.Matrix4,W=new z.Mesh((new z.PlaneBufferGeometry(1,1)).translate(.5,.5,0),V),X=function(n){function g(a){a=new L;n.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}n&&(g.__proto__=n);g.prototype=Object.create(n&&n.prototype);g.prototype.constructor=g;var b={textRenderInfo:{configurable:!0},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,Z({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,includeCaretPositions:!0},function(c){b._isSyncing=!1;b._textRenderInfo=c;b.geometry.updateGlyphs(c.glyphBounds,c.glyphAtlasIndices,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()}; | ||
@@ -119,3 +119,3 @@ b.textRenderInfo.get=function(){return this._textRenderInfo||null};b.material.get=function(){var a=this._derivedMaterial,b=this._baseMaterial||V;a&&a.baseMaterial===b||(a&&a.dispose(),a=this._derivedMaterial=ba(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())}; | ||
d.uTroikaSDFTextureSize.value.set(e.image.width,e.image.height);d.uTroikaSDFGlyphSize.value=b.sdfGlyphSize;d.uTroikaSDFMinDistancePct.value=b.sdfMinDistancePercent;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,W.matrixWorld.multiplyMatrices(this.matrixWorld, | ||
ea.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)),W.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(m){var g="_private_"+m;Object.defineProperty(X.prototype,m,{get:function(){return this[g]},set:"anchor"===m?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)}})});D.GlyphsGeometry=L;D.TextMesh=X;D.configureTextBuilder=function(m){R(K,m)};D.fontProcessorWorkerModule=G;Object.defineProperty(D,"__esModule",{value:!0})}); | ||
ea.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)),W.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(n){var g="_private_"+n;Object.defineProperty(X.prototype,n,{get:function(){return this[g]},set:"anchor"===n?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)}})});D.GlyphsGeometry=L;D.TextMesh=X;D.configureTextBuilder=function(n){R(K,n)};D.fontProcessorWorkerModule=G;Object.defineProperty(D,"__esModule",{value:!0})}); |
{ | ||
"name": "troika-3d-text", | ||
"version": "0.16.0", | ||
"version": "0.17.0", | ||
"description": "Troika 3D Text", | ||
@@ -18,5 +18,5 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"dependencies": { | ||
"troika-3d": "^0.16.0", | ||
"troika-three-utils": "^0.16.0", | ||
"troika-worker-utils": "^0.16.0" | ||
"troika-3d": "^0.17.0", | ||
"troika-three-utils": "^0.17.0", | ||
"troika-worker-utils": "^0.17.0" | ||
}, | ||
@@ -31,3 +31,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "b17e3967b2166f102cabc6cd4bf46f5a725a8910" | ||
"gitHead": "31909f4beed23f5913aa380db1dd3c1802798b39" | ||
} |
@@ -5,3 +5,3 @@ # `troika-3d-text` | ||
Rather than relying on pre-generated SDF textures, this parses font files (.ttf, .otf, .woff) directly using [Typr.js](https://github.com/photopea/Typr.js), and generates the SDF atlas for glyphs on-the-fly as they are used. It also handles proper kerning and ligature glyph substitution. All font parsing, SDF generation, and glyph layout is performed in a web worker to prevent frame drops. | ||
Rather than relying on pre-generated SDF textures, this parses font files (.ttf, .otf, .woff) directly using [Typr.js](https://github.com/photopea/Typr.js), and generates the SDF atlas for glyphs on-the-fly as they are used. It also handles proper kerning and ligature glyph substitution. All font parsing, SDF generation, and glyph layout is performed in a web worker to prevent frame drops. | ||
@@ -23,7 +23,16 @@ Once the SDFs are generated, it assembles a geometry that positions all the glyphs, and _patches_ any Three.js Material with the proper shader code for rendering the SDFs. This means you can still benefit from all the features of Three.js's built-in materials like lighting, physically-based rendering, shadows, and fog. | ||
![Text with a texture](./screenshot4.png) | ||
## Installation | ||
Get it from [NPM](https://www.npmjs.com/package/troika-3d-text): | ||
```sh | ||
npm install troika-3d-text | ||
``` | ||
You will also need to install a compatible version of [Three.js](https://threejs.org); see the notes in the [Troika 3D Readme](../troika-3d/README.md#installation) for details. | ||
## Usage | ||
### Using within the Troika 3D framework | ||
### Using within the Troika 3D scene management framework | ||
@@ -93,3 +102,3 @@ This library is built first and foremost to work within Troika 3D scenes, via the `Text3DFacade` class. | ||
#### `text` | ||
The string of text to be rendered. Newlines and repeating whitespace characters are honored. | ||
@@ -175,3 +184,3 @@ | ||
Default: `'normal'` | ||
#### `textAlign` | ||
@@ -185,3 +194,3 @@ | ||
Defines whether text should wrap when a line reaches the `maxWidth`. Can be either `'normal'`, to allow wrapping according to the `overflowWrap` property, or `'nowrap'` to prevent wrapping. | ||
Defines whether text should wrap when a line reaches the `maxWidth`. Can be either `'normal'`, to allow wrapping according to the `overflowWrap` property, or `'nowrap'` to prevent wrapping. | ||
@@ -188,0 +197,0 @@ Note that `'normal'` in this context _does_ honor newline characters to manually break lines, making it behave more like `'pre-wrap'` does in CSS. |
import { Group3DFacade } from 'troika-3d' | ||
import { Matrix4, Plane, Vector3 } from 'three' | ||
import { getCaretAtPoint, getSelectionRects } from '../selectionUtils' | ||
import SelectionRangeRect from './SelectionRangeRect' | ||
import { getCaretAtPoint, getSelectionRects } from '../selectionUtils.js' | ||
import SelectionRangeRect from './SelectionRangeRect.js' | ||
@@ -92,2 +92,2 @@ const THICKNESS = 0.25 //rect depth as percentage of height | ||
export default SelectionManagerFacade | ||
export default SelectionManagerFacade |
import { Object3DFacade } from 'troika-3d' | ||
import { TextMesh } from '../three/TextMesh.js' | ||
import SelectionManagerFacade from './SelectionManagerFacade' | ||
import SelectionManagerFacade from './SelectionManagerFacade.js' | ||
@@ -5,0 +5,0 @@ // Properties that will simply be forwarded to the TextMesh: |
@@ -177,2 +177,7 @@ /** | ||
// Ensure we've got numbers not strings | ||
fontSize = +fontSize | ||
letterSpacing = +letterSpacing | ||
maxWidth = +maxWidth | ||
getSdfAtlas(font, atlas => { | ||
@@ -179,0 +184,0 @@ const fontObj = atlas.fontObj |
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
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
33520
196
1899362
89
2
7
0
10
+ Addedthree@0.112.1(transitive)
+ Addedtroika-3d@0.17.1(transitive)
+ Addedtroika-animation@0.17.1(transitive)
+ Addedtroika-core@0.17.1(transitive)
+ Addedtroika-three-utils@0.17.1(transitive)
+ Addedtroika-worker-utils@0.17.1(transitive)
- Removedthree@0.110.0(transitive)
- Removedtroika-3d@0.16.0(transitive)
- Removedtroika-animation@0.16.0(transitive)
- Removedtroika-core@0.16.0(transitive)
- Removedtroika-three-utils@0.16.0(transitive)
- Removedtroika-worker-utils@0.16.0(transitive)
Updatedtroika-3d@^0.17.0
Updatedtroika-three-utils@^0.17.0
Updatedtroika-worker-utils@^0.17.0