@shuding/opentype.js
Version:
OpenType font parser
1 lines • 169 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).opentype={})}(this,function(S){"use strict";function r(e){if(null==this)throw TypeError();var t,r,n=String(this),a=n.length;if(!((e=(e=e?Number(e):0)!=e?0:e)<0||a<=e))return 55296<=(t=n.charCodeAt(e))&&t<=56319&&e+1<a&&56320<=(r=n.charCodeAt(e+1))&&r<=57343?1024*(t-55296)+r-56320+65536:t}function n(e,t){for(var r=new f(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var a=new s(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)a[o]=o-r[n]<<5|n;return[r,a]}String.prototype.codePointAt||((a=function(){try{var e={},t=Object.defineProperty,r=t(e,e,e)&&t}catch(e){}return r}())?a(String.prototype,"codePointAt",{value:r,configurable:!0,writable:!0}):String.prototype.codePointAt=r);var N=Uint8Array,f=Uint16Array,s=Uint32Array,H=new N([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),z=new N([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),W=new N([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=n(H,2),_=a[0];a[1][_[28]=258]=28;for(var q=n(z,0)[0],d=new f(32768),e=0;e<32768;++e){var o=(43690&e)>>>1|(21845&e)<<1;d[e]=((65280&(o=(61680&(o=(52428&o)>>>2|(13107&o)<<2))>>>4|(3855&o)<<4))>>>8|(255&o)<<8)>>>1}for(var X=function(e,t,r){for(var n=e.length,a=0,o=new f(t);a<n;++a)e[a]&&++o[e[a]-1];var s=new f(t);for(a=0;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;if(r){for(var i=new f(1<<t),p=15-t,a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],l=s[e[a]-1]++<<u,h=l|(1<<u)-1;l<=h;++l)i[d[l]>>>p]=c}else for(i=new f(n),a=0;a<n;++a)e[a]&&(i[a]=d[s[e[a]-1]++]>>>15-e[a]);return i},l=new N(288),e=0;e<144;++e)l[e]=8;for(e=144;e<256;++e)l[e]=9;for(e=256;e<280;++e)l[e]=7;for(e=280;e<288;++e)l[e]=8;for(var p=new N(32),e=0;e<32;++e)p[e]=5;function c(e,r,t){var p=e.length;if(!p||t&&t.f&&!t.l)return r||new N(0);function c(e){var t=r.length;t<e&&((t=new N(Math.max(2*t,e))).set(r),r=t)}var h=!r||t,f=!t||t.i,d=(t=t||{},r=r||new N(3*p),t.f||0),n=t.p||0,a=t.b||0,o=t.l,g=t.d,v=t.m,m=t.n,y=8*p;do{if(!o){var d=Z(e,n,1),b=Z(e,n+1,3);if(n+=3,!b){var S=e[(i=K(n)+4)-4]|e[i-3]<<8,x=i+S;if(p<x){f&&$(0);break}h&&c(a+S),r.set(e.subarray(i,x),a),t.b=a+=S,t.p=n=8*x,t.f=d;continue}if(1==b)o=V,g=Y,v=9,m=5;else if(2==b){for(var S=Z(e,n,31)+257,T=Z(e,n+10,15)+4,k=S+Z(e,n+5,31)+1,U=(n+=14,new N(k)),O=new N(19),s=0;s<T;++s)O[W[s]]=Z(e,n+3*s,7);n+=3*T;for(var x=j(O),E=(1<<x)-1,R=X(O,x,1),s=0;s<k;){var i,C=R[Z(e,n,E)];if(n+=15&C,(i=C>>>4)<16)U[s++]=i;else{var L=0,w=0;for(16==i?(w=3+Z(e,n,3),n+=2,L=U[s-1]):17==i?(w=3+Z(e,n,7),n+=3):18==i&&(w=11+Z(e,n,127),n+=7);w--;)U[s++]=L}}var D=U.subarray(0,S),u=U.subarray(S),v=j(D),m=j(u),o=X(D,v,1),g=X(u,m,1)}else $(1);if(y<n){f&&$(0);break}}h&&c(a+131072);for(var I=(1<<v)-1,M=(1<<m)-1,G=n;;G=n){var l=(L=o[Q(e,n)&I])>>>4;if(y<(n+=15&L)){f&&$(0);break}if(L||$(2),l<256)r[a++]=l;else{if(256==l){G=n,o=null;break}var B,F=l-254,l=(264<l&&(B=H[s=l-257],F=Z(e,n,(1<<B)-1)+_[s],n+=B),g[Q(e,n)&M]),P=l>>>4,u=(l||$(3),n+=15&l,q[P]);if(3<P&&(B=z[P],u+=Q(e,n)&(1<<B)-1,n+=B),y<n){f&&$(0);break}h&&c(a+131072);for(var A=a+F;a<A;a+=4)r[a]=r[a-u],r[a+1]=r[a+1-u],r[a+2]=r[a+2-u],r[a+3]=r[a+3-u];a=A}}t.l=o,t.p=G,t.b=a,t.f=d,o&&(d=1,t.m=v,t.d=g,t.n=m)}while(!d);return a==r.length?r:J(r,0,a)}var V=X(l,9,1),Y=X(p,5,1),j=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Z=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Q=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},K=function(e){return(e+7)/8|0},J=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(2==e.BYTES_PER_ELEMENT?f:4==e.BYTES_PER_ELEMENT?s:N)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n},h=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],$=function(e,t,r){t=new Error(t||h[e]);if(t.code=e,Error.captureStackTrace&&Error.captureStackTrace(t,$),!r)throw t;return t},g=new N(0);var v="undefined"!=typeof TextDecoder&&new TextDecoder;try{v.decode(g,{stream:!0})}catch(e){}function y(e,t,r,n,a){return Math.pow(1-a,3)*e+3*Math.pow(1-a,2)*a*t+3*(1-a)*Math.pow(a,2)*r+Math.pow(a,3)*n}function m(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}function B(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}function b(e){throw new Error(e)}function x(e,t){e||b(t)}m.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},m.prototype.addPoint=function(e,t){"number"==typeof e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),"number"==typeof t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},m.prototype.addX=function(e){this.addPoint(e,null)},m.prototype.addY=function(e){this.addPoint(null,e)},m.prototype.addBezier=function(e,p,c,h,f,d,g,v){var t=[e,p],r=[c,h],n=[f,d],a=[g,v];this.addPoint(e,p),this.addPoint(g,v);for(var o=0;o<=1;o++){var s,i,u=6*t[o]-12*r[o]+6*n[o],l=-3*t[o]+9*r[o]-9*n[o]+3*a[o],m=3*r[o]-3*t[o];0!=l?(i=Math.pow(u,2)-4*m*l)<0||(0<(s=(-u+Math.sqrt(i))/(2*l))&&s<1&&(0===o&&this.addX(y(t[o],r[o],n[o],a[o],s)),1===o&&this.addY(y(t[o],r[o],n[o],a[o],s))),0<(s=(-u-Math.sqrt(i))/(2*l))&&s<1&&(0===o&&this.addX(y(t[o],r[o],n[o],a[o],s)),1===o&&this.addY(y(t[o],r[o],n[o],a[o],s)))):0==u||0<(i=-m/u)&&i<1&&(0===o&&this.addX(y(t[o],r[o],n[o],a[o],i)),1===o&&this.addY(y(t[o],r[o],n[o],a[o],i)))}},m.prototype.addQuad=function(e,t,r,n,a,o){r=e+2/3*(r-e),n=t+2/3*(n-t);this.addBezier(e,t,r,n,r+1/3*(a-e),n+1/3*(o-t),a,o)},B.prototype.moveTo=function(e,t){this.commands.push({type:"M",x:e,y:t})},B.prototype.lineTo=function(e,t){this.commands.push({type:"L",x:e,y:t})},B.prototype.curveTo=B.prototype.bezierCurveTo=function(e,t,r,n,a,o){this.commands.push({type:"C",x1:e,y1:t,x2:r,y2:n,x:a,y:o})},B.prototype.quadTo=B.prototype.quadraticCurveTo=function(e,t,r,n){this.commands.push({type:"Q",x1:e,y1:t,x:r,y:n})},B.prototype.close=B.prototype.closePath=function(){this.commands.push({type:"Z"})},B.prototype.extend=function(e){var t;if(e.commands)e=e.commands;else if(e instanceof m)return t=e,this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),void this.close();Array.prototype.push.apply(this.commands,e)},B.prototype.getBoundingBox=function(){for(var e=new m,t=0,r=0,n=0,a=0,o=0;o<this.commands.length;o++){var s=this.commands[o];switch(s.type){case"M":e.addPoint(s.x,s.y),t=n=s.x,r=a=s.y;break;case"L":e.addPoint(s.x,s.y),n=s.x,a=s.y;break;case"Q":e.addQuad(n,a,s.x1,s.y1,s.x,s.y),n=s.x,a=s.y;break;case"C":e.addBezier(n,a,s.x1,s.y1,s.x2,s.y2,s.x,s.y),n=s.x,a=s.y;break;case"Z":n=t,a=r;break;default:throw new Error("Unexpected path command "+s.type)}}return e.isEmpty()&&e.addPoint(0,0),e},B.prototype.draw=function(e){e.beginPath();for(var t=0;t<this.commands.length;t+=1){var r=this.commands[t];"M"===r.type?e.moveTo(r.x,r.y):"L"===r.type?e.lineTo(r.x,r.y):"C"===r.type?e.bezierCurveTo(r.x1,r.y1,r.x2,r.y2,r.x,r.y):"Q"===r.type?e.quadraticCurveTo(r.x1,r.y1,r.x,r.y):"Z"===r.type&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())},B.prototype.toPathData=function(a){function e(){for(var e=arguments,t="",r=0;r<arguments.length;r+=1){var n=e[r];0<=n&&0<r&&(t+=" "),t+=(n=n,Math.round(n)===n?""+Math.round(n):n.toFixed(a))}return t}a=void 0!==a?a:2;for(var t="",r=0;r<this.commands.length;r+=1){var n=this.commands[r];"M"===n.type?t+="M"+e(n.x,n.y):"L"===n.type?t+="L"+e(n.x,n.y):"C"===n.type?t+="C"+e(n.x1,n.y1,n.x2,n.y2,n.x,n.y):"Q"===n.type?t+="Q"+e(n.x1,n.y1,n.x,n.y):"Z"===n.type&&(t+="Z")}return t},B.prototype.toSVG=function(e){var t=(t='<path d="')+this.toPathData(e)+'"';return this.fill&&"black"!==this.fill&&(null===this.fill?t+=' fill="none"':t+=' fill="'+this.fill+'"'),this.stroke&&(t+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),t+="/>"},B.prototype.toDOMElement=function(e){var e=this.toPathData(e),t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",e),t};var M={fail:b,argument:x,assert:x},T=2147483648,E={},k={},i={};function R(e){return function(){return e}}k.BYTE=function(e){return M.argument(0<=e&&e<=255,"Byte value should be between 0 and 255."),[e]},i.BYTE=R(1),k.CHAR=function(e){return[e.charCodeAt(0)]},i.CHAR=R(1),k.CHARARRAY=function(e){void 0===e&&(e="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var t=[],r=0;r<e.length;r+=1)t[r]=e.charCodeAt(r);return t},i.CHARARRAY=function(e){return void 0===e?0:e.length},k.USHORT=function(e){return[e>>8&255,255&e]},i.USHORT=R(2),k.SHORT=function(e){return[(e=32768<=e?-(65536-e):e)>>8&255,255&e]},i.SHORT=R(2),k.UINT24=function(e){return[e>>16&255,e>>8&255,255&e]},i.UINT24=R(3),k.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},i.ULONG=R(4),k.LONG=function(e){return[(e=T<=e?-(2*T-e):e)>>24&255,e>>16&255,e>>8&255,255&e]},i.LONG=R(4),k.FIXED=k.ULONG,i.FIXED=i.ULONG,k.FWORD=k.SHORT,i.FWORD=i.SHORT,k.UFWORD=k.USHORT,i.UFWORD=i.USHORT,k.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,255&e]},i.LONGDATETIME=R(8),k.TAG=function(e){return M.argument(4===e.length,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},i.TAG=R(4),k.Card8=k.BYTE,i.Card8=i.BYTE,k.Card16=k.USHORT,i.Card16=i.USHORT,k.OffSize=k.BYTE,i.OffSize=i.BYTE,k.SID=k.USHORT,i.SID=i.USHORT,k.NUMBER=function(e){return-107<=e&&e<=107?[e+139]:108<=e&&e<=1131?[247+((e-=108)>>8),255&e]:-1131<=e&&e<=-108?[251+((e=-e-108)>>8),255&e]:-32768<=e&&e<=32767?k.NUMBER16(e):k.NUMBER32(e)},i.NUMBER=function(e){return k.NUMBER(e).length},k.NUMBER16=function(e){return[28,e>>8&255,255&e]},i.NUMBER16=R(3),k.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,255&e]},i.NUMBER32=R(5),k.REAL=function(e){for(var t=e.toString(),r=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t),n=(r&&(r=parseFloat("1e"+((r[2]?+r[2]:0)+r[1].length)),t=(Math.round(e*r)/r).toString()),""),a=0,o=t.length;a<o;a+=1){var s=t[a];n+="e"===s?"-"===t[++a]?"c":"b":"."===s?"a":"-"===s?"e":s}for(var i=[30],u=0,l=(n+=1&n.length?"f":"ff").length;u<l;u+=2)i.push(parseInt(n.substr(u,2),16));return i},i.REAL=function(e){return k.REAL(e).length},k.NAME=k.CHARARRAY,i.NAME=i.CHARARRAY,k.STRING=k.CHARARRAY,i.STRING=i.CHARARRAY,E.UTF8=function(e,t,r){for(var n=[],a=r,o=0;o<a;o++,t+=1)n[o]=e.getUint8(t);return String.fromCharCode.apply(null,n)},E.UTF16=function(e,t,r){for(var n=[],a=r/2,o=0;o<a;o++,t+=2)n[o]=e.getUint16(t);return String.fromCharCode.apply(null,n)},k.UTF16=function(e){for(var t=[],r=0;r<e.length;r+=1){var n=e.charCodeAt(r);t[t.length]=n>>8&255,t[t.length]=255&n}return t},i.UTF16=function(e){return 2*e.length};var C,L={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"},w=(E.MACSTRING=function(e,t,r,n){var a=L[n];if(void 0!==a){for(var o="",s=0;s<r;s++){var i=e.getUint8(t+s);o+=i<=127?String.fromCharCode(i):a[127&i]}return o}},"function"==typeof WeakMap&&new WeakMap);function D(e){return-128<=e&&e<=127}k.MACSTRING=function(e,t){var r=function(e){if(!C)for(var t in C={},L)C[t]=new String(t);var r=C[e];if(void 0!==r){if(w){var n=w.get(r);if(void 0!==n)return n}var a=L[e];if(void 0!==a){for(var o={},s=0;s<a.length;s++)o[a.charCodeAt(s)]=s+128;return w&&w.set(r,o),o}}}(t);if(void 0!==r){for(var n=[],a=0;a<e.length;a++){var o=e.charCodeAt(a);if(128<=o&&void 0===(o=r[o]))return;n[a]=o}return n}},i.MACSTRING=function(e,t){e=k.MACSTRING(e,t);return void 0!==e?e.length:0},k.VARDELTAS=function(e){for(var t=0,r=[];t<e.length;)var n=e[t],t=(0===n?function(e,t,r){for(var n=0,a=e.length;t<a&&n<64&&0===e[t];)++t,++n;return r.push(128|n-1),t}:-128<=n&&n<=127?function(e,t,r){for(var n=0,a=e.length,o=t;o<a&&n<64;){var s=e[o];if(!D(s))break;if(0===s&&o+1<a&&0===e[o+1])break;++o,++n}r.push(n-1);for(var i=t;i<o;++i)r.push(e[i]+256&255);return o}:function(e,t,r){for(var n=0,a=e.length,o=t;o<a&&n<64;){var s=e[o];if(0===s)break;if(D(s)&&o+1<a&&D(e[o+1]))break;++o,++n}r.push(64|n-1);for(var i=t;i<o;++i){var u=e[i];r.push(u+65536>>8&255,u+256&255)}return o})(e,t,r);return r},k.INDEX=function(e){for(var t=1,r=[t],n=[],a=0;a<e.length;a+=1){var o=k.OBJECT(e[a]);Array.prototype.push.apply(n,o),t+=o.length,r.push(t)}if(0===n.length)return[0,0];for(var s=[],i=1+Math.floor(Math.log(t)/Math.log(2))/8|0,u=[void 0,k.BYTE,k.USHORT,k.UINT24,k.ULONG][i],l=0;l<r.length;l+=1){var p=u(r[l]);Array.prototype.push.apply(s,p)}return Array.prototype.concat(k.Card16(e.length),k.OffSize(i),s,n)},i.INDEX=function(e){return k.INDEX(e).length},k.DICT=function(e){for(var t=[],r=Object.keys(e),n=r.length,a=0;a<n;a+=1){var o=parseInt(r[a],0),s=e[o];t=(t=t.concat(k.OPERAND(s.value,s.type))).concat(k.OPERATOR(o))}return t},i.DICT=function(e){return k.DICT(e).length},k.OPERATOR=function(e){return e<1200?[e]:[12,e-1200]},k.OPERAND=function(e,t){var r=[];if(Array.isArray(t))for(var n=0;n<t.length;n+=1)M.argument(e.length===t.length,"Not enough arguments given for type"+t),r=r.concat(k.OPERAND(e[n],t[n]));else if("SID"===t)r=r.concat(k.NUMBER(e));else if("offset"===t)r=r.concat(k.NUMBER32(e));else if("number"===t)r=r.concat(k.NUMBER(e));else{if("real"!==t)throw new Error("Unknown operand type "+t);r=r.concat(k.REAL(e))}return r},k.OP=k.BYTE,i.OP=i.BYTE;var I="function"==typeof WeakMap&&new WeakMap;function F(e,t,r){if(t.length&&("coverageFormat"!==t[0].name||1===t[0].value))for(var n=0;n<t.length;n+=1){var a=t[n];this[a.name]=a.value}if(this.tableName=e,this.fields=t,r)for(var o=Object.keys(r),s=0;s<o.length;s+=1){var i=o[s],u=r[i];void 0!==this[i]&&(this[i]=u)}}function P(e,t,r){void 0===r&&(r=t.length);var n=new Array(t.length+1);n[0]={name:e+"Count",type:"USHORT",value:r};for(var a=0;a<t.length;a++)n[a+1]={name:e+a,type:"USHORT",value:t[a]};return n}function A(e,t,r){var n=t.length,a=new Array(n+1);a[0]={name:e+"Count",type:"USHORT",value:n};for(var o=0;o<n;o++)a[o+1]={name:e+o,type:"TABLE",value:r(t[o],o)};return a}function ee(e,t,r){var n=t.length,a=[];a[0]={name:e+"Count",type:"USHORT",value:n};for(var o=0;o<n;o++)a=a.concat(r(t[o],o));return a}function te(e){1===e.format?F.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(P("glyph",e.glyphs))):2===e.format?F.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(ee("rangeRecord",e.ranges,function(e){return[{name:"startGlyphID",type:"USHORT",value:e.start},{name:"endGlyphID",type:"USHORT",value:e.end},{name:"startCoverageIndex",type:"USHORT",value:e.index}]}))):M.assert(!1,"Coverage format must be 1 or 2.")}function re(e){F.call(this,"scriptListTable",ee("scriptRecord",e,function(e,t){var r=e.script,n=r.defaultLangSys;return M.assert(!!n,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new F("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new F("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:n.reqFeatureIndex}].concat(P("featureIndex",n.featureIndexes)))}].concat(ee("langSys",r.langSysRecords,function(e,t){var r=e.langSys;return[{name:"langSysTag"+t,type:"TAG",value:e.tag},{name:"langSys"+t,type:"TABLE",value:new F("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:r.reqFeatureIndex}].concat(P("featureIndex",r.featureIndexes)))}]})))}]}))}function ne(e){F.call(this,"featureListTable",ee("featureRecord",e,function(e,t){var r=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new F("featureTable",[{name:"featureParams",type:"USHORT",value:r.featureParams}].concat(P("lookupListIndex",r.lookupListIndexes)))}]}))}function ae(e,r){F.call(this,"lookupListTable",A("lookup",e,function(e){var t=r[e.lookupType];return M.assert(!!t,"Unable to write GSUB lookup type "+e.lookupType+" tables."),new F("lookupTable",[{name:"lookupType",type:"USHORT",value:e.lookupType},{name:"lookupFlag",type:"USHORT",value:e.lookupFlag}].concat(A("subtable",e.subtables,t)))}))}k.CHARSTRING=function(e){if(I){var t=I.get(e);if(void 0!==t)return t}for(var r=[],n=e.length,a=0;a<n;a+=1)var o=e[a],r=r.concat(k[o.type](o.value));return I&&I.set(e,r),r},i.CHARSTRING=function(e){return k.CHARSTRING(e).length},k.OBJECT=function(e){var t=k[e.type];return M.argument(void 0!==t,"No encoding function for type "+e.type),t(e.value)},i.OBJECT=function(e){var t=i[e.type];return M.argument(void 0!==t,"No sizeOf function for type "+e.type),t(e.value)},k.TABLE=function(e){for(var t=[],p=e.fields.length,r=[],n=[],a=0;a<p;a+=1){var o=e.fields[a],s=k[o.type],i=(M.argument(void 0!==s,"No encoding function for field type "+o.type+" ("+o.name+")"),e[o.name]),s=s(i=void 0===i?o.value:i);"TABLE"===o.type?(n.push(t.length),t=t.concat([0,0]),r.push(s)):t=t.concat(s)}for(var u=0;u<r.length;u+=1){var c=n[u],l=t.length;M.argument(l<65536,"Table "+e.tableName+" too big."),t[c]=l>>8,t[c+1]=255&l,t=t.concat(r[u])}return t},i.TABLE=function(e){for(var t=0,r=e.fields.length,n=0;n<r;n+=1){var a=e.fields[n],o=i[a.type],s=(M.argument(void 0!==o,"No sizeOf function for field type "+a.type+" ("+a.name+")"),e[a.name]);t+=o(s=void 0===s?a.value:s),"TABLE"===a.type&&(t+=2)}return t},k.RECORD=k.TABLE,i.RECORD=i.TABLE,k.LITERAL=function(e){return e},i.LITERAL=function(e){return e.length},F.prototype.encode=function(){return k.TABLE(this)},F.prototype.sizeOf=function(){return i.TABLE(this)};var U={Table:F,Record:F,Coverage:(te.prototype=Object.create(F.prototype)).constructor=te,ScriptList:(re.prototype=Object.create(F.prototype)).constructor=re,FeatureList:(ne.prototype=Object.create(F.prototype)).constructor=ne,LookupList:(ae.prototype=Object.create(F.prototype)).constructor=ae,ushortList:P,tableList:A,recordList:ee};function oe(e,t){return e.getUint8(t)}function se(e,t){return e.getUint16(t,!1)}function ie(e,t){return e.getUint32(t,!1)}function ue(e,t){return e.getInt16(t,!1)+e.getUint16(t+2,!1)/65535}var le={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function u(e,t){this.data=e,this.offset=t,this.relativeOffset=0}u.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},u.prototype.parseChar=function(){var e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},u.prototype.parseCard8=u.prototype.parseByte,u.prototype.parseCard16=u.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},u.prototype.parseSID=u.prototype.parseUShort,u.prototype.parseOffset16=u.prototype.parseUShort,u.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},u.prototype.parseF2Dot14=function(){var e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e},u.prototype.parseOffset32=u.prototype.parseULong=function(){var e=ie(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},u.prototype.parseFixed=function(){var e=ue(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},u.prototype.parseString=function(e){var t=this.data,r=this.offset+this.relativeOffset,n="";this.relativeOffset+=e;for(var a=0;a<e;a++)n+=String.fromCharCode(t.getUint8(r+a));return n},u.prototype.parseTag=function(){return this.parseString(4)},u.prototype.parseLongDateTime=function(){var e=ie(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e},u.prototype.parseVersion=function(e){var t=se(this.data,this.offset+this.relativeOffset),r=se(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,t+r/(e=void 0===e?4096:e)/10},u.prototype.skip=function(e,t){this.relativeOffset+=le[e]*(t=void 0===t?1:t)},u.prototype.parseULongList=function(e){void 0===e&&(e=this.parseULong());for(var t=new Array(e),r=this.data,n=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getUint32(n),n+=4;return this.relativeOffset+=4*e,t},u.prototype.parseOffset16List=u.prototype.parseUShortList=function(e){void 0===e&&(e=this.parseUShort());for(var t=new Array(e),r=this.data,n=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getUint16(n),n+=2;return this.relativeOffset+=2*e,t},u.prototype.parseShortList=function(e){for(var t=new Array(e),r=this.data,n=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getInt16(n),n+=2;return this.relativeOffset+=2*e,t},u.prototype.parseByteList=function(e){for(var t=new Array(e),r=this.data,n=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getUint8(n++);return this.relativeOffset+=e,t},u.prototype.parseList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),n=0;n<e;n++)r[n]=t.call(this);return r},u.prototype.parseList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),n=0;n<e;n++)r[n]=t.call(this);return r},u.prototype.parseRecordList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),n=Object.keys(t),a=0;a<e;a++){for(var o={},s=0;s<n.length;s++){var i=n[s],u=t[i];o[i]=u.call(this)}r[a]=o}return r},u.prototype.parseRecordList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),n=Object.keys(t),a=0;a<e;a++){for(var o={},s=0;s<n.length;s++){var i=n[s],u=t[i];o[i]=u.call(this)}r[a]=o}return r},u.prototype.parseStruct=function(e){if("function"==typeof e)return e.call(this);for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var a=t[n],o=e[a];r[a]=o.call(this)}return r},u.prototype.parseValueRecord=function(e){var t;if(0!==(e=void 0===e?this.parseUShort():e))return t={},1&e&&(t.xPlacement=this.parseShort()),2&e&&(t.yPlacement=this.parseShort()),4&e&&(t.xAdvance=this.parseShort()),8&e&&(t.yAdvance=this.parseShort()),16&e&&(t.xPlaDevice=void 0,this.parseShort()),32&e&&(t.yPlaDevice=void 0,this.parseShort()),64&e&&(t.xAdvDevice=void 0,this.parseShort()),128&e&&(t.yAdvDevice=void 0,this.parseShort()),t},u.prototype.parseValueRecordList=function(){for(var e=this.parseUShort(),t=this.parseUShort(),r=new Array(t),n=0;n<t;n++)r[n]=this.parseValueRecord(e);return r},u.prototype.parsePointer=function(e){var t=this.parseOffset16();if(0<t)return new u(this.data,this.offset+t).parseStruct(e)},u.prototype.parsePointer32=function(e){var t=this.parseOffset32();if(0<t)return new u(this.data,this.offset+t).parseStruct(e)},u.prototype.parseListOfLists=function(e){for(var t=this.parseOffset16List(),r=t.length,n=this.relativeOffset,a=new Array(r),o=0;o<r;o++){var s=t[o];if(0!==s)if(this.relativeOffset=s,e){for(var i=this.parseOffset16List(),u=new Array(i.length),l=0;l<i.length;l++)this.relativeOffset=s+i[l],u[l]=e.call(this);a[o]=u}else a[o]=this.parseUShortList();else a[o]=void 0}return this.relativeOffset=n,a},u.prototype.parseCoverage=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort(),r=this.parseUShort();if(1===t)return{format:1,glyphs:this.parseUShortList(r)};if(2!==t)throw new Error("0x"+e.toString(16)+": Coverage format must be 1 or 2.");for(var n=new Array(r),a=0;a<r;a++)n[a]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:n}},u.prototype.parseClassDef=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(1===t)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(2===t)return{format:2,ranges:this.parseRecordList({start:u.uShort,end:u.uShort,classId:u.uShort})};throw new Error("0x"+e.toString(16)+": ClassDef format must be 1 or 2.")},u.list=function(e,t){return function(){return this.parseList(e,t)}},u.list32=function(e,t){return function(){return this.parseList32(e,t)}},u.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}},u.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}},u.pointer=function(e){return function(){return this.parsePointer(e)}},u.pointer32=function(e){return function(){return this.parsePointer32(e)}},u.tag=u.prototype.parseTag,u.byte=u.prototype.parseByte,u.uShort=u.offset16=u.prototype.parseUShort,u.uShortList=u.prototype.parseUShortList,u.uLong=u.offset32=u.prototype.parseULong,u.uLongList=u.prototype.parseULongList,u.struct=u.prototype.parseStruct,u.coverage=u.prototype.parseCoverage,u.classDef=u.prototype.parseClassDef;var pe={reserved:u.uShort,reqFeatureIndex:u.uShort,featureIndexes:u.uShortList},G=(u.prototype.parseScriptList=function(){return this.parsePointer(u.recordList({tag:u.tag,script:u.pointer({defaultLangSys:u.pointer(pe),langSysRecords:u.recordList({tag:u.tag,langSys:u.pointer(pe)})})}))||[]},u.prototype.parseFeatureList=function(){return this.parsePointer(u.recordList({tag:u.tag,feature:u.pointer({featureParams:u.offset16,lookupListIndexes:u.uShortList})}))||[]},u.prototype.parseLookupList=function(n){return this.parsePointer(u.list(u.pointer(function(){var e=this.parseUShort(),t=(M.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown."),this.parseUShort()),r=16&t;return{lookupType:e,lookupFlag:t,subtables:this.parseList(u.pointer(n[e])),markFilteringSet:r?this.parseUShort():void 0}})))||[]},u.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var e=this.parseUShort(),t=this.parseUShort();return M.argument(1===e&&t<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:u.offset32,featureTableSubstitutionOffset:u.offset32})})||[]},{getByte:oe,getCard8:oe,getUShort:se,getCard16:se,getShort:function(e,t){return e.getInt16(t,!1)},getULong:ie,getFixed:ue,getTag:function(e,t){for(var r="",n=t;n<t+4;n+=1)r+=String.fromCharCode(e.getInt8(n));return r},getOffset:function(e,t,r){for(var n=0,a=0;a<r;a+=1)n=(n<<=8)+e.getUint8(t+a);return n},getBytes:function(e,t,r){for(var n=[],a=t;a<r;a+=1)n.push(e.getUint8(a));return n},bytesToString:function(e){for(var t="",r=0;r<e.length;r+=1)t+=String.fromCharCode(e[r]);return t},Parser:u});var ce={parse:function(e,t){for(var r={},p=(r.version=G.getUShort(e,t),M.argument(0===r.version,"cmap table version should be 0."),r.numTables=G.getUShort(e,t+2),-1),n=r.numTables-1;0<=n;--n){var c=G.getUShort(e,t+4+8*n),a=G.getUShort(e,t+4+8*n+2);if(3===c&&(0===a||1===a||10===a)||0===c&&(0===a||1===a||2===a||3===a||4===a)){p=G.getULong(e,t+4+8*n+4);break}}if(-1===p)throw new Error("No valid cmap sub-tables found.");var o=new G.Parser(e,t+p);if(r.format=o.parseUShort(),12===r.format){var h,s=r,i=o;i.parseUShort(),s.length=i.parseULong(),s.language=i.parseULong(),s.groupCount=h=i.parseULong(),s.glyphIndexMap={};for(var f=0;f<h;f+=1)for(var d=i.parseULong(),g=i.parseULong(),v=i.parseULong(),m=d;m<=g;m+=1)s.glyphIndexMap[m]=v,v++}else{if(4!==r.format)throw new Error("Only format 4 and 12 cmap tables are supported (found format "+r.format+").");var u=r,y=e,b=t,S=p;u.length=o.parseUShort(),u.language=o.parseUShort(),u.segCount=l=o.parseUShort()>>1,o.skip("uShort",3),u.glyphIndexMap={};for(var l,x=new G.Parser(y,b+S+14),T=new G.Parser(y,b+S+16+2*l),k=new G.Parser(y,b+S+16+4*l),U=new G.Parser(y,b+S+16+6*l),O=b+S+16+8*l,E=0;E<l-1;E+=1)for(var R=void 0,C=x.parseUShort(),L=T.parseUShort(),w=k.parseShort(),D=U.parseUShort(),I=L;I<=C;I+=1)0!==D?(O=(O=U.offset+U.relativeOffset-2)+D+2*(I-L),0!==(R=G.getUShort(y,O))&&(R=R+w&65535)):R=I+w&65535,u.glyphIndexMap[I]=R}return r},make:function(e){for(var t=!0,r=e.length-1;0<r;--r)if(65535<e.get(r).unicode){console.log("Adding CMAP format 12 (needed!)"),t=!1;break}var n,p,a=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:t?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:t?12:20}],o=(a=(a=t?a:a.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])).concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]),new U.Table("cmap",a));for(o.segments=[],r=0;r<e.length;r+=1){for(var c=e.get(r),h=0;h<c.unicodes.length;h+=1)n=c.unicodes[h],p=r,o.segments.push({end:n,start:n,delta:-(n-p),offset:0,glyphIndex:p});o.segments=o.segments.sort(function(e,t){return e.start-t.start})}o.segments.push({end:65535,start:65535,delta:1,offset:0});var f=o.segments.length,d=0,s=[],i=[],g=[],v=[],m=[],u=[];for(r=0;r<f;r+=1){var l=o.segments[r];l.end<=65535&&l.start<=65535?(s=s.concat({name:"end_"+r,type:"USHORT",value:l.end}),i=i.concat({name:"start_"+r,type:"USHORT",value:l.start}),g=g.concat({name:"idDelta_"+r,type:"SHORT",value:l.delta}),v=v.concat({name:"idRangeOffset_"+r,type:"USHORT",value:l.offset}),void 0!==l.glyphId&&(m=m.concat({name:"glyph_"+r,type:"USHORT",value:l.glyphId}))):d+=1,t||void 0===l.glyphIndex||(u=(u=(u=u.concat({name:"cmap12Start_"+r,type:"ULONG",value:l.start})).concat({name:"cmap12End_"+r,type:"ULONG",value:l.end})).concat({name:"cmap12Glyph_"+r,type:"ULONG",value:l.glyphIndex}))}return o.segCountX2=2*(f-d),o.searchRange=2*Math.pow(2,Math.floor(Math.log(f-d)/Math.log(2))),o.entrySelector=Math.log(o.searchRange/2)/Math.log(2),o.rangeShift=o.segCountX2-o.searchRange,o.fields=o.fields.concat(s),o.fields.push({name:"reservedPad",type:"USHORT",value:0}),o.fields=o.fields.concat(i),o.fields=o.fields.concat(g),o.fields=o.fields.concat(v),o.fields=o.fields.concat(m),o.cmap4Length=14+2*s.length+2+2*i.length+2*g.length+2*v.length+2*m.length,t||(a=16+4*u.length,o.cmap12Offset=20+o.cmap4Length,o.fields=o.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:a},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:u.length/3}]),o.fields=o.fields.concat(u)),o}},he=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],fe=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],de=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ge=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function ve(e){this.font=e}function me(e){this.cmap=e}function ye(e,t){this.encoding=e,this.charset=t}function be(e){switch(e.version){case 1:this.names=ge.slice();break;case 2:this.names=new Array(e.numberOfGlyphs);for(var t=0;t<e.numberOfGlyphs;t++)e.glyphNameIndex[t]<ge.length?this.names[t]=ge[e.glyphNameIndex[t]]:this.names[t]=e.names[e.glyphNameIndex[t]-ge.length];break;case 2.5:this.names=new Array(e.numberOfGlyphs);for(var r=0;r<e.numberOfGlyphs;r++)this.names[r]=ge[r+e.glyphNameIndex[r]];break;default:this.names=[]}}function Se(e,p){if(p.lowMemory){var t=e;t._IndexToUnicodeMap={};for(var r=t.tables.cmap.glyphIndexMap,c=Object.keys(r),n=0;n<c.length;n+=1){var a=c[n],o=r[a];void 0===t._IndexToUnicodeMap[o]?t._IndexToUnicodeMap[o]={unicodes:[parseInt(a)]}:t._IndexToUnicodeMap[o].unicodes.push(parseInt(a))}}else{for(var s=e,h=s.tables.cmap.glyphIndexMap,f=Object.keys(h),i=0;i<f.length;i+=1){var u,d=f[i],g=h[d];(u=s.glyphs.get(g)).addUnicode(parseInt(d))}for(var l=0;l<s.glyphs.length;l+=1)u=s.glyphs.get(l),s.cffEncoding?s.isCIDFont?u.name="gid"+l:u.name=s.cffEncoding.charset[l]:s.glyphNames.names&&(u.name=s.glyphNames.glyphIndexToName(l))}}ve.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),r=this.font.glyphs;if(r)for(var n=0;n<r.length;n+=1)for(var a=r.get(n),o=0;o<a.unicodes.length;o+=1)if(a.unicodes[o]===t)return n;return null},me.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.codePointAt(0)]||0},ye.prototype.charToGlyphIndex=function(e){e=e.codePointAt(0),e=this.encoding[e];return this.charset.indexOf(e)},be.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},be.prototype.glyphIndexToName=function(e){return this.names[e]};var xe={line:function(e,t,r,n,a){e.beginPath(),e.moveTo(t,r),e.lineTo(n,a),e.stroke()}};function Te(e){this.bindConstructorValues(e)}function ke(t,e,r){Object.defineProperty(t,e,{get:function(){return t.path,t[r]},set:function(e){t[r]=e},enumerable:!0,configurable:!0})}function Ue(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(var r=0;r<t.length;r++){var n=t[r];n.path.unitsPerEm=e.unitsPerEm,this.glyphs[r]=n}this.length=t&&t.length||0}Te.prototype.bindConstructorValues=function(e){var t;this.index=e.index||0,this.name=e.name||null,this.unicode=e.unicode||void 0,this.unicodes=e.unicodes||void 0!==e.unicode?[e.unicode]:[],"xMin"in e&&(this.xMin=e.xMin),"yMin"in e&&(this.yMin=e.yMin),"xMax"in e&&(this.xMax=e.xMax),"yMax"in e&&(this.yMax=e.yMax),"advanceWidth"in e&&(this.advanceWidth=e.advanceWidth),Object.defineProperty(this,"path",(e=e.path,t=e||new B,{configurable:!0,get:function(){return t="function"==typeof t?t():t},set:function(e){t=e}}))},Te.prototype.addUnicode=function(e){0===this.unicodes.length&&(this.unicode=e),this.unicodes.push(e)},Te.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Te.prototype.getPath=function(e,t,r,n,a){e=void 0!==e?e:0,t=void 0!==t?t:0,r=void 0!==r?r:72;for(var p,o,s=(n=n||{}).xScale,i=n.yScale,u=((p=n.hinting&&a&&a.hinting?this.path&&a.hinting.exec(this,r):p)?(o=a.hinting.getCommands(p),e=Math.round(e),t=Math.round(t),s=i=1):(o=this.path.commands,n=1/(this.path.unitsPerEm||1e3)*r,void 0===s&&(s=n),void 0===i&&(i=n)),new B),c=0;c<o.length;c+=1){var l=o[c];"M"===l.type?u.moveTo(e+l.x*s,t+-l.y*i):"L"===l.type?u.lineTo(e+l.x*s,t+-l.y*i):"Q"===l.type?u.quadraticCurveTo(e+l.x1*s,t+-l.y1*i,e+l.x*s,t+-l.y*i):"C"===l.type?u.curveTo(e+l.x1*s,t+-l.y1*i,e+l.x2*s,t+-l.y2*i,e+l.x*s,t+-l.y*i):"Z"===l.type&&u.closePath()}return u},Te.prototype.getContours=function(){if(void 0===this.points)return[];for(var e=[],t=[],r=0;r<this.points.length;r+=1){var n=this.points[r];t.push(n),n.lastPointOfContour&&(e.push(t),t=[])}return M.argument(0===t.length,"There are still points left in the current contour."),e},Te.prototype.getMetrics=function(){for(var e=this.path.commands,t=[],r=[],n=0;n<e.length;n+=1){var a=e[n];"Z"!==a.type&&(t.push(a.x),r.push(a.y)),"Q"!==a.type&&"C"!==a.type||(t.push(a.x1),r.push(a.y1)),"C"===a.type&&(t.push(a.x2),r.push(a.y2))}var o={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,r),leftSideBearing:this.leftSideBearing};return isFinite(o.xMin)||(o.xMin=0),isFinite(o.xMax)||(o.xMax=this.advanceWidth),isFinite(o.yMin)||(o.yMin=0),isFinite(o.yMax)||(o.yMax=0),o.rightSideBearing=this.advanceWidth-o.leftSideBearing-(o.xMax-o.xMin),o},Te.prototype.draw=function(e,t,r,n,a){this.getPath(t,r,n,a).draw(e)},Te.prototype.drawPoints=function(o,e,t,r){function n(e,t,r,n){o.beginPath();for(var a=0;a<e.length;a+=1)o.moveTo(t+e[a].x*n,r+e[a].y*n),o.arc(t+e[a].x*n,r+e[a].y*n,2,0,2*Math.PI,!1);o.closePath(),o.fill()}e=void 0!==e?e:0,t=void 0!==t?t:0;for(var r=1/this.path.unitsPerEm*(r=void 0!==r?r:24),a=[],s=[],i=this.path,u=0;u<i.commands.length;u+=1){var l=i.commands[u];void 0!==l.x&&a.push({x:l.x,y:-l.y}),void 0!==l.x1&&s.push({x:l.x1,y:-l.y1}),void 0!==l.x2&&s.push({x:l.x2,y:-l.y2})}o.fillStyle="blue",n(a,e,t,r),o.fillStyle="red",n(s,e,t,r)},Te.prototype.drawMetrics=function(e,t,r,n){t=void 0!==t?t:0,r=void 0!==r?r:0,n=1/this.path.unitsPerEm*(n=void 0!==n?n:24),e.lineWidth=1,e.strokeStyle="black",xe.line(e,t,-1e4,t,1e4),xe.line(e,-1e4,r,1e4,r);var a=this.xMin||0,o=this.yMin||0,s=this.xMax||0,i=this.yMax||0,u=this.advanceWidth||0;e.strokeStyle="blue",xe.line(e,t+a*n,-1e4,t+a*n,1e4),xe.line(e,t+s*n,-1e4,t+s*n,1e4),xe.line(e,-1e4,r+-o*n,1e4,r+-o*n),xe.line(e,-1e4,r+-i*n,1e4,r+-i*n),e.strokeStyle="green",xe.line(e,t+u*n,-1e4,t+u*n,1e4)},Ue.prototype.get=function(e){if(void 0===this.glyphs[e]){this.font._push(e),"function"==typeof this.glyphs[e]&&(this.glyphs[e]=this.glyphs[e]());var t=this.glyphs[e],r=this.font._IndexToUnicodeMap[e];if(r)for(var n=0;n<r.unicodes.length;n++)t.addUnicode(r.unicodes[n]);this.font.cffEncoding?this.font.isCIDFont?t.name="gid"+e:t.name=this.font.cffEncoding.charset[e]:this.font.glyphNames.names&&(t.name=this.font.glyphNames.glyphIndexToName(e)),this.glyphs[e].advanceWidth=this.font._hmtxTableData[e].advanceWidth,this.glyphs[e].leftSideBearing=this.font._hmtxTableData[e].leftSideBearing}else"function"==typeof this.glyphs[e]&&(this.glyphs[e]=this.glyphs[e]());return this.glyphs[e]},Ue.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};var Oe={GlyphSet:Ue,glyphLoader:function(e,t){return new Te({index:t,font:e})},ttfGlyphLoader:function(r,e,n,a,o,s){return function(){var t=new Te({index:e,font:r});return t.path=function(){n(t,a,o);var e=s(r.glyphs,t);return e.unitsPerEm=r.unitsPerEm,e},ke(t,"xMin","_xMin"),ke(t,"xMax","_xMax"),ke(t,"yMin","_yMin"),ke(t,"yMax","_yMax"),t}},cffGlyphLoader:function(r,e,n,a){return function(){var t=new Te({index:e,font:r});return t.path=function(){var e=n(r,t,a);return e.unitsPerEm=r.unitsPerEm,e},t}}};function Ee(e){e=e.length<1240?107:e.length<33900?1131:32768;return e}function Re(e,t,r){var n,a=[],p=[],o=G.getCard16(e,t);if(0!==o){for(var s=G.getByte(e,t+2),i=t+(o+1)*s+2,c=t+3,h=0;h<o+1;h+=1)a.push(G.getOffset(e,c,s)),c+=s;n=i+a[o]}else n=t+2;for(var u=0;u<a.length-1;u+=1){var l=G.getBytes(e,i+a[u],i+a[u+1]);r&&(l=r(l)),p.push(l)}return{objects:p,startOffset:t,endOffset:n}}function Ce(e,t){if(28===t)return e.parseByte()<<8|e.parseByte();if(29===t)return e.parseByte()<<24|e.parseByte()<<16|e.parseByte()<<8|e.parseByte();if(30===t){for(var r=e,n="",a=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var o=r.parseByte(),s=o>>4,o=15&o;if(15==s)break;if(n+=a[s],15==o)break;n+=a[o]}return parseFloat(n)}if(32<=t&&t<=246)return t-139;if(247<=t&&t<=250)return 256*(t-247)+e.parseByte()+108;if(251<=t&&t<=254)return 256*-(t-251)-e.parseByte()-108;throw new Error("Invalid b0 "+t)}function Le(p,e,t){var