three
Version:
JavaScript 3D library
55 lines (44 loc) • 127 kB
JavaScript
/**
* Modules in this bundle
* @license
*
* opentype.js:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Frederik De Bleser <frederik@debleser.be>
* version: 0.6.5
*
* tiny-inflate:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Devon Govett <devongovett@gmail.com>
* maintainers: devongovett <devongovett@gmail.com>
* homepage: https://github.com/devongovett/tiny-inflate
* version: 1.0.2
*
* This header is generated by licensify (https://github.com/twada/licensify)
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.opentype = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function Tree(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Data(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new Tree,this.dtree=new Tree}function tinf_build_bits_base(e,t,n,r){var s,i;for(s=0;n>s;++s)e[s]=0;for(s=0;30-n>s;++s)e[s+n]=s/n|0;for(i=r,s=0;30>s;++s)t[s]=i,i+=1<<e[s]}function tinf_build_fixed_trees(e,t){var n;for(n=0;7>n;++n)e.table[n]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,n=0;24>n;++n)e.trans[n]=256+n;for(n=0;144>n;++n)e.trans[24+n]=n;for(n=0;8>n;++n)e.trans[168+n]=280+n;for(n=0;112>n;++n)e.trans[176+n]=144+n;for(n=0;5>n;++n)t.table[n]=0;for(t.table[5]=32,n=0;32>n;++n)t.trans[n]=n}function tinf_build_tree(e,t,n,r){var s,i;for(s=0;16>s;++s)e.table[s]=0;for(s=0;r>s;++s)e.table[t[n+s]]++;for(e.table[0]=0,i=0,s=0;16>s;++s)offs[s]=i,i+=e.table[s];for(s=0;r>s;++s)t[n+s]&&(e.trans[offs[t[n+s]]++]=s)}function tinf_getbit(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function tinf_read_bits(e,t,n){if(!t)return n;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,r+n}function tinf_decode_symbol(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=0,r=0,s=0,i=e.tag;do r=2*r+(1&i),i>>>=1,++s,n+=t.table[s],r-=t.table[s];while(r>=0);return e.tag=i,e.bitcount-=s,t.trans[n+r]}function tinf_decode_trees(e,t,n){var r,s,i,a,o,_;for(r=tinf_read_bits(e,5,257),s=tinf_read_bits(e,5,1),i=tinf_read_bits(e,4,4),a=0;19>a;++a)lengths[a]=0;for(a=0;i>a;++a){var f=tinf_read_bits(e,3,0);lengths[clcidx[a]]=f}for(tinf_build_tree(code_tree,lengths,0,19),o=0;r+s>o;){var d=tinf_decode_symbol(e,code_tree);switch(d){case 16:var b=lengths[o-1];for(_=tinf_read_bits(e,2,3);_;--_)lengths[o++]=b;break;case 17:for(_=tinf_read_bits(e,3,3);_;--_)lengths[o++]=0;break;case 18:for(_=tinf_read_bits(e,7,11);_;--_)lengths[o++]=0;break;default:lengths[o++]=d}}tinf_build_tree(t,lengths,0,r),tinf_build_tree(n,lengths,r,s)}function tinf_inflate_block_data(e,t,n){for(;;){var r=tinf_decode_symbol(e,t);if(256===r)return TINF_OK;if(256>r)e.dest[e.destLen++]=r;else{var s,i,a,o;for(r-=257,s=tinf_read_bits(e,length_bits[r],length_base[r]),i=tinf_decode_symbol(e,n),a=e.destLen-tinf_read_bits(e,dist_bits[i],dist_base[i]),o=a;a+s>o;++o)e.dest[e.destLen++]=e.dest[o]}}}function tinf_inflate_uncompressed_block(e){for(var t,n,r;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if(t=e.source[e.sourceIndex+1],t=256*t+e.source[e.sourceIndex],n=e.source[e.sourceIndex+3],n=256*n+e.source[e.sourceIndex+2],t!==(65535&~n))return TINF_DATA_ERROR;for(e.sourceIndex+=4,r=t;r;--r)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,TINF_OK}function tinf_uncompress(e,t){var n,r,s,i=new Data(e,t);do{switch(n=tinf_getbit(i),r=tinf_read_bits(i,2,0)){case 0:s=tinf_inflate_uncompressed_block(i);break;case 1:s=tinf_inflate_block_data(i,sltree,sdtree);break;case 2:tinf_decode_trees(i,i.ltree,i.dtree),s=tinf_inflate_block_data(i,i.ltree,i.dtree);break;default:s=TINF_DATA_ERROR}if(s!==TINF_OK)throw new Error("Data error")}while(!n);return i.destLen<i.dest.length?"function"==typeof i.dest.slice?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest}var TINF_OK=0,TINF_DATA_ERROR=-3,sltree=new Tree,sdtree=new Tree,length_bits=new Uint8Array(30),length_base=new Uint16Array(30),dist_bits=new Uint8Array(30),dist_base=new Uint16Array(30),clcidx=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),code_tree=new Tree,lengths=new Uint8Array(320),offs=new Uint16Array(16);tinf_build_fixed_trees(sltree,sdtree),tinf_build_bits_base(length_bits,length_base,4,3),tinf_build_bits_base(dist_bits,dist_base,2,1),length_bits[28]=0,length_base[28]=258,module.exports=tinf_uncompress;
},{}],2:[function(require,module,exports){
"use strict";exports.fail=function(r){throw new Error(r)},exports.argument=function(r,t){r||exports.fail(t)},exports.assert=exports.argument;
},{}],3:[function(require,module,exports){
"use strict";function line(e,i,n,o,t){e.beginPath(),e.moveTo(i,n),e.lineTo(o,t),e.stroke()}exports.line=line;
},{}],4:[function(require,module,exports){
"use strict";function DefaultEncoding(e){this.font=e}function CmapEncoding(e){this.cmap=e}function CffEncoding(e,l){this.encoding=e,this.charset=l}function GlyphNames(e){var l;switch(e.version){case 1:this.names=exports.standardNames.slice();break;case 2:for(this.names=new Array(e.numberOfGlyphs),l=0;l<e.numberOfGlyphs;l++)this.names[l]=e.glyphNameIndex[l]<exports.standardNames.length?exports.standardNames[e.glyphNameIndex[l]]:e.names[e.glyphNameIndex[l]-exports.standardNames.length];break;case 2.5:for(this.names=new Array(e.numberOfGlyphs),l=0;l<e.numberOfGlyphs;l++)this.names[l]=exports.standardNames[l+e.glyphNameIndex[l]];break;case 3:this.names=[]}}function addGlyphNames(e){for(var l,r=e.tables.cmap.glyphIndexMap,a=Object.keys(r),s=0;s<a.length;s+=1){var i=a[s],o=r[i];l=e.glyphs.get(o),l.addUnicode(parseInt(i))}for(s=0;s<e.glyphs.length;s+=1)l=e.glyphs.get(s),e.cffEncoding?l.name=e.cffEncoding.charset[s]:e.glyphNames.names&&(l.name=e.glyphNames.glyphIndexToName(s))}var cffStandardStrings=[".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"],cffStandardEncoding=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],cffExpertEncoding=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],standardNames=[".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"];DefaultEncoding.prototype.charToGlyphIndex=function(e){var l=e.charCodeAt(0),r=this.font.glyphs;if(!r)return null;for(var a=0;a<r.length;a+=1)for(var s=r.get(a),i=0;i<s.unicodes.length;i+=1)if(s.unicodes[i]===l)return a},CmapEncoding.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.charCodeAt(0)]||0},CffEncoding.prototype.charToGlyphIndex=function(e){var l=e.charCodeAt(0),r=this.encoding[l];return this.charset.indexOf(r)},GlyphNames.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},GlyphNames.prototype.glyphIndexToName=function(e){return this.names[e]},exports.cffStandardStrings=cffStandardStrings,exports.cffStandardEncoding=cffStandardEncoding,exports.cffExpertEncoding=cffExpertEncoding,exports.standardNames=standardNames,exports.DefaultEncoding=DefaultEncoding,exports.CmapEncoding=CmapEncoding,exports.CffEncoding=CffEncoding,exports.GlyphNames=GlyphNames,exports.addGlyphNames=addGlyphNames;
},{}],5:[function(require,module,exports){
"use strict";function Font(e){e=e||{},e.empty||(util.checkArgument(e.familyName,"When creating a new Font object, familyName is required."),util.checkArgument(e.styleName,"When creating a new Font object, styleName is required."),util.checkArgument(e.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),util.checkArgument(e.ascender,"When creating a new Font object, ascender is required."),util.checkArgument(e.descender,"When creating a new Font object, descender is required."),util.checkArgument(e.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:e.familyName||" "},fontSubfamily:{en:e.styleName||" "},fullName:{en:e.fullName||e.familyName+" "+e.styleName},postScriptName:{en:e.postScriptName||e.familyName+e.styleName},designer:{en:e.designer||" "},designerURL:{en:e.designerURL||" "},manufacturer:{en:e.manufacturer||" "},manufacturerURL:{en:e.manufacturerURL||" "},license:{en:e.license||" "},licenseURL:{en:e.licenseURL||" "},version:{en:e.version||"Version 0.1"},description:{en:e.description||" "},copyright:{en:e.copyright||" "},trademark:{en:e.trademark||" "}},this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.tables={os2:{usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,fsSelection:e.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new glyphset.GlyphSet(this,e.glyphs||[]),this.encoding=new encoding.DefaultEncoding(this),this.substitution=new Substitution(this),this.tables=this.tables||{}}var path=require("./path"),sfnt=require("./tables/sfnt"),encoding=require("./encoding"),glyphset=require("./glyphset"),Substitution=require("./substitution"),util=require("./util");Font.prototype.hasChar=function(e){return null!==this.encoding.charToGlyphIndex(e)},Font.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},Font.prototype.charToGlyph=function(e){var t=this.charToGlyphIndex(e),n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n},Font.prototype.stringToGlyphs=function(e){for(var t=[],n=0;n<e.length;n+=1){var i=e[n];t.push(this.charToGlyph(i))}return t},Font.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)},Font.prototype.nameToGlyph=function(e){var t=this.nametoGlyphIndex(e),n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n},Font.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):""},Font.prototype.getKerningValue=function(e,t){e=e.index||e,t=t.index||t;var n=this.getGposKerningValue;return n?n(e,t):this.kerningPairs[e+","+t]||0},Font.prototype.forEachGlyph=function(e,t,n,i,r,o){t=void 0!==t?t:0,n=void 0!==n?n:0,i=void 0!==i?i:72,r=r||{};for(var s=void 0===r.kerning?!0:r.kerning,a=1/this.unitsPerEm*i,h=this.stringToGlyphs(e),u=0;u<h.length;u+=1){var c=h[u];if(o(c,t,n,i,r),c.advanceWidth&&(t+=c.advanceWidth*a),s&&u<h.length-1){var l=this.getKerningValue(c,h[u+1]);t+=l*a}}},Font.prototype.getPath=function(e,t,n,i,r){var o=new path.Path;return this.forEachGlyph(e,t,n,i,r,function(e,t,n,i){var r=e.getPath(t,n,i);o.extend(r)}),o},Font.prototype.getPaths=function(e,t,n,i,r){var o=[];return this.forEachGlyph(e,t,n,i,r,function(e,t,n,i){var r=e.getPath(t,n,i);o.push(r)}),o},Font.prototype.draw=function(e,t,n,i,r,o){this.getPath(t,n,i,r,o).draw(e)},Font.prototype.drawPoints=function(e,t,n,i,r,o){this.forEachGlyph(t,n,i,r,o,function(t,n,i,r){t.drawPoints(e,n,i,r)})},Font.prototype.drawMetrics=function(e,t,n,i,r,o){this.forEachGlyph(t,n,i,r,o,function(t,n,i,r){t.drawMetrics(e,n,i,r)})},Font.prototype.getEnglishName=function(e){var t=this.names[e];return t?t.en:void 0},Font.prototype.validate=function(){function e(e,t){e||n.push(t)}function t(t){var n=i.getEnglishName(t);e(n&&n.trim().length>0,"No English "+t+" specified.")}var n=[],i=this;t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),e(this.unitsPerEm>0,"No unitsPerEm specified.")},Font.prototype.toTables=function(){return sfnt.fontToTable(this)},Font.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Font.prototype.toArrayBuffer=function(){for(var e=this.toTables(),t=e.encode(),n=new ArrayBuffer(t.length),i=new Uint8Array(n),r=0;r<t.length;r++)i[r]=t[r];return n},Font.prototype.download=function(){var e=this.getEnglishName("fontFamily"),t=this.getEnglishName("fontSubfamily"),n=e.replace(/\s/g,"")+"-"+t+".otf",i=this.toArrayBuffer();if(util.isBrowser())window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem,window.requestFileSystem(window.TEMPORARY,i.byteLength,function(e){e.root.getFile(n,{create:!0},function(e){e.createWriter(function(t){var n=new DataView(i),r=new Blob([n],{type:"font/opentype"});t.write(r),t.addEventListener("writeend",function(){location.href=e.toURL()},!1)})})},function(e){throw new Error(e.name+": "+e.message)});else{var r=require("fs"),o=util.arrayBufferToNodeBuffer(i);r.writeFileSync(n,o)}},Font.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Font.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Font.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900},exports.Font=Font;
},{"./encoding":4,"./glyphset":7,"./path":11,"./substitution":12,"./tables/sfnt":31,"./util":33,"fs":undefined}],6:[function(require,module,exports){
"use strict";function getPathDefinition(t,i){var e=i||{commands:[]};return{configurable:!0,get:function(){return"function"==typeof e&&(e=e()),e},set:function(t){e=t}}}function Glyph(t){this.bindConstructorValues(t)}var check=require("./check"),draw=require("./draw"),path=require("./path");Glyph.prototype.bindConstructorValues=function(t){this.index=t.index||0,this.name=t.name||null,this.unicode=t.unicode||void 0,this.unicodes=t.unicodes||void 0!==t.unicode?[t.unicode]:[],t.xMin&&(this.xMin=t.xMin),t.yMin&&(this.yMin=t.yMin),t.xMax&&(this.xMax=t.xMax),t.yMax&&(this.yMax=t.yMax),t.advanceWidth&&(this.advanceWidth=t.advanceWidth),Object.defineProperty(this,"path",getPathDefinition(this,t.path))},Glyph.prototype.addUnicode=function(t){0===this.unicodes.length&&(this.unicode=t),this.unicodes.push(t)},Glyph.prototype.getPath=function(t,i,e,n){t=void 0!==t?t:0,i=void 0!==i?i:0,n=void 0!==n?n:{xScale:1,yScale:1},e=void 0!==e?e:72;for(var a=1/this.path.unitsPerEm*e,h=n.xScale*a,o=n.yScale*a,r=new path.Path,s=this.path.commands,p=0;p<s.length;p+=1){var y=s[p];"M"===y.type?r.moveTo(t+y.x*h,i+-y.y*o):"L"===y.type?r.lineTo(t+y.x*h,i+-y.y*o):"Q"===y.type?r.quadraticCurveTo(t+y.x1*h,i+-y.y1*o,t+y.x*h,i+-y.y*o):"C"===y.type?r.curveTo(t+y.x1*h,i+-y.y1*o,t+y.x2*h,i+-y.y2*o,t+y.x*h,i+-y.y*o):"Z"===y.type&&r.closePath()}return r},Glyph.prototype.getContours=function(){if(void 0===this.points)return[];for(var t=[],i=[],e=0;e<this.points.length;e+=1){var n=this.points[e];i.push(n),n.lastPointOfContour&&(t.push(i),i=[])}return check.argument(0===i.length,"There are still points left in the current contour."),t},Glyph.prototype.getMetrics=function(){for(var t=this.path.commands,i=[],e=[],n=0;n<t.length;n+=1){var a=t[n];"Z"!==a.type&&(i.push(a.x),e.push(a.y)),("Q"===a.type||"C"===a.type)&&(i.push(a.x1),e.push(a.y1)),"C"===a.type&&(i.push(a.x2),e.push(a.y2))}var h={xMin:Math.min.apply(null,i),yMin:Math.min.apply(null,e),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,e),leftSideBearing:this.leftSideBearing};return isFinite(h.xMin)||(h.xMin=0),isFinite(h.xMax)||(h.xMax=this.advanceWidth),isFinite(h.yMin)||(h.yMin=0),isFinite(h.yMax)||(h.yMax=0),h.rightSideBearing=this.advanceWidth-h.leftSideBearing-(h.xMax-h.xMin),h},Glyph.prototype.draw=function(t,i,e,n,a){this.getPath(i,e,n,a).draw(t)},Glyph.prototype.drawPoints=function(t,i,e,n){function a(i,e,n,a){var h=2*Math.PI;t.beginPath();for(var o=0;o<i.length;o+=1)t.moveTo(e+i[o].x*a,n+i[o].y*a),t.arc(e+i[o].x*a,n+i[o].y*a,2,0,h,!1);t.closePath(),t.fill()}i=void 0!==i?i:0,e=void 0!==e?e:0,n=void 0!==n?n:24;for(var h=1/this.path.unitsPerEm*n,o=[],r=[],s=this.path,p=0;p<s.commands.length;p+=1){var y=s.commands[p];void 0!==y.x&&o.push({x:y.x,y:-y.y}),void 0!==y.x1&&r.push({x:y.x1,y:-y.y1}),void 0!==y.x2&&r.push({x:y.x2,y:-y.y2})}t.fillStyle="blue",a(o,i,e,h),t.fillStyle="red",a(r,i,e,h)},Glyph.prototype.drawMetrics=function(t,i,e,n){var a;i=void 0!==i?i:0,e=void 0!==e?e:0,n=void 0!==n?n:24,a=1/this.path.unitsPerEm*n,t.lineWidth=1,t.strokeStyle="black",draw.line(t,i,-1e4,i,1e4),draw.line(t,-1e4,e,1e4,e);var h=this.xMin||0,o=this.yMin||0,r=this.xMax||0,s=this.yMax||0,p=this.advanceWidth||0;t.strokeStyle="blue",draw.line(t,i+h*a,-1e4,i+h*a,1e4),draw.line(t,i+r*a,-1e4,i+r*a,1e4),draw.line(t,-1e4,e+-o*a,1e4,e+-o*a),draw.line(t,-1e4,e+-s*a,1e4,e+-s*a),t.strokeStyle="green",draw.line(t,i+p*a,-1e4,i+p*a,1e4)},exports.Glyph=Glyph;
},{"./check":2,"./draw":3,"./path":11}],7:[function(require,module,exports){
"use strict";function defineDependentProperty(e,t,n){Object.defineProperty(e,t,{get:function(){return e.path,e[n]},set:function(t){e[n]=t},enumerable:!0,configurable:!0})}function GlyphSet(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(var n=0;n<t.length;n++)this.glyphs[n]=t[n];this.length=t&&t.length||0}function glyphLoader(e,t){return new _glyph.Glyph({index:t,font:e})}function ttfGlyphLoader(e,t,n,r,p,h){return function(){var i=new _glyph.Glyph({index:t,font:e});return i.path=function(){n(i,r,p);var t=h(e.glyphs,i);return t.unitsPerEm=e.unitsPerEm,t},defineDependentProperty(i,"xMin","_xMin"),defineDependentProperty(i,"xMax","_xMax"),defineDependentProperty(i,"yMin","_yMin"),defineDependentProperty(i,"yMax","_yMax"),i}}function cffGlyphLoader(e,t,n,r){return function(){var p=new _glyph.Glyph({index:t,font:e});return p.path=function(){var t=n(e,p,r);return t.unitsPerEm=e.unitsPerEm,t},p}}var _glyph=require("./glyph");GlyphSet.prototype.get=function(e){return"function"==typeof this.glyphs[e]&&(this.glyphs[e]=this.glyphs[e]()),this.glyphs[e]},GlyphSet.prototype.push=function(e,t){this.glyphs[e]=t,this.length++},exports.GlyphSet=GlyphSet,exports.glyphLoader=glyphLoader,exports.ttfGlyphLoader=ttfGlyphLoader,exports.cffGlyphLoader=cffGlyphLoader;
},{"./glyph":6}],8:[function(require,module,exports){
"use strict";function searchTag(e,r){for(var t=0,a=e.length-1;a>=t;){var s=t+a>>>1,n=e[s].tag;if(n===r)return s;r>n?t=s+1:a=s-1}return-t-1}function binSearch(e,r){for(var t=0,a=e.length-1;a>=t;){var s=t+a>>>1,n=e[s];if(n===r)return s;r>n?t=s+1:a=s-1}return-t-1}var check=require("./check"),Layout={searchTag:searchTag,binSearch:binSearch,getScriptNames:function(){var e=this.getGsubTable();return e?e.scripts.map(function(e){return e.tag}):[]},getScriptTable:function(e,r){var t=this.getGsubTable(r);if(t){var a=t.scripts,s=searchTag(t.scripts,e);if(s>=0)return a[s].script;var n={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return a.splice(-1-s,0,n.script),n}},getLangSysTable:function(e,r,t){var a=this.getScriptTable(e,t);if(a){if("DFLT"===r)return a.defaultLangSys;var s=searchTag(a.langSysRecords,r);if(s>=0)return a.langSysRecords[s].langSys;if(t){var n={tag:r,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return a.langSysRecords.splice(-1-s,0,n),n.langSys}}},getFeatureTable:function(e,r,t,a){var s=this.getLangSysTable(e,r,a);if(s){for(var n,u=s.featureIndexes,i=this.font.tables.gsub.features,g=0;g<u.length;g++)if(n=i[u[g]],n.tag===t)return n.feature;if(a){var o=i.length;return check.assert(0===o||t>=i[o-1].tag,"Features must be added in alphabetical order."),n={tag:t,feature:{params:0,lookupListIndexes:[]}},i.push(n),u.push(o),n.feature}}},getLookupTable:function(e,r,t,a,s){var n=this.getFeatureTable(e,r,t,s);if(n){for(var u,i=n.lookupListIndexes,g=this.font.tables.gsub.lookups,o=0;o<i.length;o++)if(u=g[i[o]],u.lookupType===a)return u;if(s){u={lookupType:a,lookupFlag:0,subtables:[],markFilteringSet:void 0};var f=g.length;return g.push(u),i.push(f),u}}},expandCoverage:function(e){if(1===e.format)return e.glyphs;for(var r=[],t=e.ranges,a=0;t>a;a++)for(var s=t[a],n=s.start,u=s.end,i=n;u>=i;i++)r.push(i);return r}};module.exports=Layout;
},{"./check":2}],9:[function(require,module,exports){
"use strict";function loadFromFile(e,a){var r=require("fs");r.readFile(e,function(e,r){return e?a(e.message):void a(null,util.nodeBufferToArrayBuffer(r))})}function loadFromUrl(e,a){var r=new XMLHttpRequest;r.open("get",e,!0),r.responseType="arraybuffer",r.onload=function(){return 200!==r.status?a("Font could not be loaded: "+r.statusText):a(null,r.response)},r.send()}function parseOpenTypeTableEntries(e,a){for(var r=[],s=12,t=0;a>t;t+=1){var n=parse.getTag(e,s),o=parse.getULong(e,s+4),p=parse.getULong(e,s+8),l=parse.getULong(e,s+12);r.push({tag:n,checksum:o,offset:p,length:l,compression:!1}),s+=16}return r}function parseWOFFTableEntries(e,a){for(var r=[],s=44,t=0;a>t;t+=1){var n,o=parse.getTag(e,s),p=parse.getULong(e,s+4),l=parse.getULong(e,s+8),f=parse.getULong(e,s+12);n=f>l?"WOFF":!1,r.push({tag:o,offset:p,compression:n,compressedLength:l,originalLength:f}),s+=20}return r}function uncompressTable(e,a){if("WOFF"===a.compression){var r=new Uint8Array(e.buffer,a.offset+2,a.compressedLength-2),s=new Uint8Array(a.originalLength);if(inflate(r,s),s.byteLength!==a.originalLength)throw new Error("Decompression error: "+a.tag+" decompressed length doesn't match recorded length");var t=new DataView(s.buffer,0);return{data:t,offset:0}}return{data:e,offset:a.offset}}function parseBuffer(e){var a,r,s,t=new _font.Font({empty:!0}),n=new DataView(e,0),o=[],p=parse.getTag(n,0);if(p===String.fromCharCode(0,1,0,0))t.outlinesFormat="truetype",s=parse.getUShort(n,4),o=parseOpenTypeTableEntries(n,s);else if("OTTO"===p)t.outlinesFormat="cff",s=parse.getUShort(n,4),o=parseOpenTypeTableEntries(n,s);else{if("wOFF"!==p)throw new Error("Unsupported OpenType signature "+p);var l=parse.getTag(n,4);if(l===String.fromCharCode(0,1,0,0))t.outlinesFormat="truetype";else{if("OTTO"!==l)throw new Error("Unsupported OpenType flavor "+p);t.outlinesFormat="cff"}s=parse.getUShort(n,12),o=parseWOFFTableEntries(n,s)}for(var f,u,i,c,b,m,d,g,h,T,y=0;s>y;y+=1){var v,F=o[y];switch(F.tag){case"cmap":v=uncompressTable(n,F),t.tables.cmap=cmap.parse(v.data,v.offset),t.encoding=new encoding.CmapEncoding(t.tables.cmap);break;case"fvar":u=F;break;case"head":v=uncompressTable(n,F),t.tables.head=head.parse(v.data,v.offset),t.unitsPerEm=t.tables.head.unitsPerEm,a=t.tables.head.indexToLocFormat;break;case"hhea":v=uncompressTable(n,F),t.tables.hhea=hhea.parse(v.data,v.offset),t.ascender=t.tables.hhea.ascender,t.descender=t.tables.hhea.descender,t.numberOfHMetrics=t.tables.hhea.numberOfHMetrics;break;case"hmtx":m=F;break;case"ltag":v=uncompressTable(n,F),r=ltag.parse(v.data,v.offset);break;case"maxp":v=uncompressTable(n,F),t.tables.maxp=maxp.parse(v.data,v.offset),t.numGlyphs=t.tables.maxp.numGlyphs;break;case"name":h=F;break;case"OS/2":v=uncompressTable(n,F),t.tables.os2=os2.parse(v.data,v.offset);break;case"post":v=uncompressTable(n,F),t.tables.post=post.parse(v.data,v.offset),t.glyphNames=new encoding.GlyphNames(t.tables.post);break;case"glyf":i=F;break;case"loca":g=F;break;case"CFF ":f=F;break;case"kern":d=F;break;case"GPOS":c=F;break;case"GSUB":b=F;break;case"meta":T=F}}var q=uncompressTable(n,h);if(t.tables.name=_name.parse(q.data,q.offset,r),t.names=t.tables.name,i&&g){var k=0===a,w=uncompressTable(n,g),x=loca.parse(w.data,w.offset,t.numGlyphs,k),O=uncompressTable(n,i);t.glyphs=glyf.parse(O.data,O.offset,x,t)}else{if(!f)throw new Error("Font doesn't contain TrueType or CFF outlines.");var U=uncompressTable(n,f);cff.parse(U.data,U.offset,t)}var L=uncompressTable(n,m);if(hmtx.parse(L.data,L.offset,t.numberOfHMetrics,t.numGlyphs,t.glyphs),encoding.addGlyphNames(t),d){var E=uncompressTable(n,d);t.kerningPairs=kern.parse(E.data,E.offset)}else t.kerningPairs={};if(c){var S=uncompressTable(n,c);gpos.parse(S.data,S.offset,t)}if(b){var G=uncompressTable(n,b);t.tables.gsub=gsub.parse(G.data,G.offset)}if(u){var B=uncompressTable(n,u);t.tables.fvar=fvar.parse(B.data,B.offset,t.names)}if(T){var C=uncompressTable(n,T);t.tables.meta=meta.parse(C.data,C.offset),t.metas=t.tables.meta}return t}function load(e,a){var r="undefined"==typeof window,s=r?loadFromFile:loadFromUrl;s(e,function(e,r){if(e)return a(e);var s;try{s=parseBuffer(r)}catch(t){return a(t,null)}return a(null,s)})}function loadSync(e){var a=require("fs"),r=a.readFileSync(e);return parseBuffer(util.nodeBufferToArrayBuffer(r))}var inflate=require("tiny-inflate"),encoding=require("./encoding"),_font=require("./font"),glyph=require("./glyph"),parse=require("./parse"),path=require("./path"),util=require("./util"),cmap=require("./tables/cmap"),cff=require("./tables/cff"),fvar=require("./tables/fvar"),glyf=require("./tables/glyf"),gpos=require("./tables/gpos"),gsub=require("./tables/gsub"),head=require("./tables/head"),hhea=require("./tables/hhea"),hmtx=require("./tables/hmtx"),kern=require("./tables/kern"),ltag=require("./tables/ltag"),loca=require("./tables/loca"),maxp=require("./tables/maxp"),_name=require("./tables/name"),os2=require("./tables/os2"),post=require("./tables/post"),meta=require("./tables/meta");exports._parse=parse,exports.Font=_font.Font,exports.Glyph=glyph.Glyph,exports.Path=path.Path,exports.parse=parseBuffer,exports.load=load,exports.loadSync=loadSync;
},{"./encoding":4,"./font":5,"./glyph":6,"./parse":10,"./path":11,"./tables/cff":14,"./tables/cmap":15,"./tables/fvar":16,"./tables/glyf":17,"./tables/gpos":18,"./tables/gsub":19,"./tables/head":20,"./tables/hhea":21,"./tables/hmtx":22,"./tables/kern":23,"./tables/loca":24,"./tables/ltag":25,"./tables/maxp":26,"./tables/meta":27,"./tables/name":28,"./tables/os2":29,"./tables/post":30,"./util":33,"fs":undefined,"tiny-inflate":1}],10:[function(require,module,exports){
"use strict";function getUShort(t,r){return t.getUint16(r,!1)}function Parser(t,r){this.data=t,this.offset=r,this.relativeOffset=0}var check=require("./check");exports.getByte=function(t,r){return t.getUint8(r)},exports.getCard8=exports.getByte,exports.getUShort=exports.getCard16=getUShort,exports.getShort=function(t,r){return t.getInt16(r,!1)},exports.getULong=function(t,r){return t.getUint32(r,!1)},exports.getFixed=function(t,r){var e=t.getInt16(r,!1),s=t.getUint16(r+2,!1);return e+s/65535},exports.getTag=function(t,r){for(var e="",s=r;r+4>s;s+=1)e+=String.fromCharCode(t.getInt8(s));return e},exports.getOffset=function(t,r,e){for(var s=0,a=0;e>a;a+=1)s<<=8,s+=t.getUint8(r+a);return s},exports.getBytes=function(t,r,e){for(var s=[],a=r;e>a;a+=1)s.push(t.getUint8(a));return s},exports.bytesToString=function(t){for(var r="",e=0;e<t.length;e+=1)r+=String.fromCharCode(t[e]);return r};var typeOffsets={"byte":1,uShort:2,"short":2,uLong:4,fixed:4,longDateTime:8,tag:4};Parser.prototype.parseByte=function(){var t=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,t},Parser.prototype.parseChar=function(){var t=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,t},Parser.prototype.parseCard8=Parser.prototype.parseByte,Parser.prototype.parseUShort=function(){var t=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,t},Parser.prototype.parseCard16=Parser.prototype.parseUShort,Parser.prototype.parseSID=Parser.prototype.parseUShort,Parser.prototype.parseOffset16=Parser.prototype.parseUShort,Parser.prototype.parseShort=function(){var t=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,t},Parser.prototype.parseF2Dot14=function(){var t=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,t},Parser.prototype.parseULong=function(){var t=exports.getULong(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,t},Parser.prototype.parseFixed=function(){var t=exports.getFixed(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,t},Parser.prototype.parseString=function(t){var r=this.data,e=this.offset+this.relativeOffset,s="";this.relativeOffset+=t;for(var a=0;t>a;a++)s+=String.fromCharCode(r.getUint8(e+a));return s},Parser.prototype.parseTag=function(){return this.parseString(4)},Parser.prototype.parseLongDateTime=function(){var t=exports.getULong(this.data,this.offset+this.relativeOffset+4);return t-=2082844800,this.relativeOffset+=8,t},Parser.prototype.parseVersion=function(){var t=getUShort(this.data,this.offset+this.relativeOffset),r=getUShort(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,t+r/4096/10},Parser.prototype.skip=function(t,r){void 0===r&&(r=1),this.relativeOffset+=typeOffsets[t]*r},Parser.prototype.parseOffset16List=Parser.prototype.parseUShortList=function(t){void 0===t&&(t=this.parseUShort());for(var r=new Array(t),e=this.data,s=this.offset+this.relativeOffset,a=0;t>a;a++)r[a]=e.getUint16(s),s+=2;return this.relativeOffset+=2*t,r},Parser.prototype.parseList=function(t,r){r||(r=t,t=this.parseUShort());for(var e=new Array(t),s=0;t>s;s++)e[s]=r.call(this);return e},Parser.prototype.parseRecordList=function(t,r){r||(r=t,t=this.parseUShort());for(var e=new Array(t),s=Object.keys(r),a=0;t>a;a++){for(var o={},i=0;i<s.length;i++){var n=s[i],f=r[n];o[n]=f.call(this)}e[a]=o}return e},Parser.prototype.parseStruct=function(t){if("function"==typeof t)return t.call(this);for(var r=Object.keys(t),e={},s=0;s<r.length;s++){var a=r[s],o=t[a];e[a]=o.call(this)}return e},Parser.prototype.parsePointer=function(t){var r=this.parseOffset16();return r>0?new Parser(this.data,this.offset+r).parseStruct(t):void 0},Parser.prototype.parseListOfLists=function(t){for(var r=this.parseOffset16List(),e=r.length,s=this.relativeOffset,a=new Array(e),o=0;e>o;o++){var i=r[o];if(0!==i)if(this.relativeOffset=i,t){for(var n=this.parseOffset16List(),f=new Array(n.length),p=0;p<n.length;p++)this.relativeOffset=i+n[p],f[p]=t.call(this);a[o]=f}else a[o]=this.parseUShortList();else a[o]=void 0}return this.relativeOffset=s,a},Parser.prototype.parseCoverage=function(){var t=this.offset+this.relativeOffset,r=this.parseUShort(),e=this.parseUShort();if(1===r)return{format:1,glyphs:this.parseUShortList(e)};if(2===r){for(var s=new Array(e),a=0;e>a;a++)s[a]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:s}}check.assert(!1,"0x"+t.toString(16)+": Coverage format must be 1 or 2.")},Parser.prototype.parseClassDef=function(){var t=this.offset+this.relativeOffset,r=this.parseUShort();return 1===r?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===r?{format:2,ranges:this.parseRecordList({start:Parser.uShort,end:Parser.uShort,classId:Parser.uShort})}:void check.assert(!1,"0x"+t.toString(16)+": ClassDef format must be 1 or 2.")},Parser.list=function(t,r){return function(){return this.parseList(t,r)}},Parser.recordList=function(t,r){return function(){return this.parseRecordList(t,r)}},Parser.pointer=function(t){return function(){return this.parsePointer(t)}},Parser.tag=Parser.prototype.parseTag,Parser.byte=Parser.prototype.parseByte,Parser.uShort=Parser.offset16=Parser.prototype.parseUShort,Parser.uShortList=Parser.prototype.parseUShortList,Parser.struct=Parser.prototype.parseStruct,Parser.coverage=Parser.prototype.parseCoverage,Parser.classDef=Parser.prototype.parseClassDef;var langSysTable={reserved:Parser.uShort,reqFeatureIndex:Parser.uShort,featureIndexes:Parser.uShortList};Parser.prototype.parseScriptList=function(){return this.parsePointer(Parser.recordList({tag:Parser.tag,script:Parser.pointer({defaultLangSys:Parser.pointer(langSysTable),langSysRecords:Parser.recordList({tag:Parser.tag,langSys:Parser.pointer(langSysTable)})})}))},Parser.prototype.parseFeatureList=function(){return this.parsePointer(Parser.recordList({tag:Parser.tag,feature:Parser.pointer({featureParams:Parser.offset16,lookupListIndexes:Parser.uShortList})}))},Parser.prototype.parseLookupList=function(t){return this.parsePointer(Parser.list(Parser.pointer(function(){var r=this.parseUShort();check.argument(r>=1&&8>=r,"GSUB lookup type "+r+" unknown.");var e=this.parseUShort(),s=16&e;return{lookupType:r,lookupFlag:e,subtables:this.parseList(Parser.pointer(t[r])),markFilteringSet:s?this.parseUShort():void 0}})))},exports.Parser=Parser;
},{"./check":2}],11:[function(require,module,exports){
"use strict";function Path(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}Path.prototype.moveTo=function(t,o){this.commands.push({type:"M",x:t,y:o})},Path.prototype.lineTo=function(t,o){this.commands.push({type:"L",x:t,y:o})},Path.prototype.curveTo=Path.prototype.bezierCurveTo=function(t,o,e,i,s,h){this.commands.push({type:"C",x1:t,y1:o,x2:e,y2:i,x:s,y:h})},Path.prototype.quadTo=Path.prototype.quadraticCurveTo=function(t,o,e,i){this.commands.push({type:"Q",x1:t,y1:o,x:e,y:i})},Path.prototype.close=Path.prototype.closePath=function(){this.commands.push({type:"Z"})},Path.prototype.extend=function(t){t.commands&&(t=t.commands),Array.prototype.push.apply(this.commands,t)},Path.prototype.draw=function(t){t.beginPath();for(var o=0;o<this.commands.length;o+=1){var e=this.commands[o];"M"===e.type?t.moveTo(e.x,e.y):"L"===e.type?t.lineTo(e.x,e.y):"C"===e.type?t.bezierCurveTo(e.x1,e.y1,e.x2,e.y2,e.x,e.y):"Q"===e.type?t.quadraticCurveTo(e.x1,e.y1,e.x,e.y):"Z"===e.type&&t.closePath()}this.fill&&(t.fillStyle=this.fill,t.fill()),this.stroke&&(t.strokeStyle=this.stroke,t.lineWidth=this.strokeWidth,t.stroke())},Path.prototype.toPathData=function(t){function o(o){return Math.round(o)===o?""+Math.round(o):o.toFixed(t)}function e(){for(var t="",e=0;e<arguments.length;e+=1){var i=arguments[e];i>=0&&e>0&&(t+=" "),t+=o(i)}return t}t=void 0!==t?t:2;for(var i="",s=0;s<this.commands.length;s+=1){var h=this.commands[s];"M"===h.type?i+="M"+e(h.x,h.y):"L"===h.type?i+="L"+e(h.x,h.y):"C"===h.type?i+="C"+e(h.x1,h.y1,h.x2,h.y2,h.x,h.y):"Q"===h.type?i+="Q"+e(h.x1,h.y1,h.x,h.y):"Z"===h.type&&(i+="Z")}return i},Path.prototype.toSVG=function(t){var o='<path d="';return o+=this.toPathData(t),o+='"',this.fill&&"black"!==this.fill&&(o+=null===this.fill?' fill="none"':' fill="'+this.fill+'"'),this.stroke&&(o+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),o+="/>"},exports.Path=Path;
},{}],12:[function(require,module,exports){
"use strict";function arraysEqual(t,e){var r=t.length;if(r!==e.length)return!1;for(var a=0;r>a;a++)if(t[a]!==e[a])return!1;return!0}function getSubstFormat(t,e,r){for(var a=t.subtables,s=0;s<a.length;s++){var o=a[s];if(o.substFormat===e)return o}return r?(a.push(r),r):void 0}var check=require("./check"),Layout=require("./layout"),Substitution=function(t){this.font=t};Substitution.prototype=Layout,Substitution.prototype.getGsubTable=function(t){var e=this.font.tables.gsub;return!e&&t&&(this.font.tables.gsub=e={version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}),e},Substitution.prototype.getSingle=function(t,e,r){var a=[],s=this.getLookupTable(e,r,t,1);if(!s)return a;for(var o=s.subtables,u=0;u<o.length;u++){var i,n=o[u],g=this.expandCoverage(n.coverage);if(1===n.substFormat){var l=n.deltaGlyphId;for(i=0;i<g.length;i++){var c=g[i];a.push({sub:c,by:c+l})}}else{var b=n.substitute;for(i=0;i<g.length;i++)a.push({sub:g[i],by:b[i]})}}return a},Substitution.prototype.getAlternates=function(t,e,r){var a=[],s=this.getLookupTable(e,r,t,3);if(!s)return a;for(var o=s.subtables,u=0;u<o.length;u++)for(var i=o[u],n=this.expandCoverage(i.coverage),g=i.alternateSets,l=0;l<n.length;l++)a.push({sub:n[l],by:g[l]});return a},Substitution.prototype.getLigatures=function(t,e,r){var a=[],s=this.getLookupTable(e,r,t,4);if(!s)return[];for(var o=s.subtables,u=0;u<o.length;u++)for(var i=o[u],n=this.expandCoverage(i.coverage),g=i.ligatureSets,l=0;l<n.length;l++)for(var c=n[l],b=g[l],h=0;h<b.length;h++){var p=b[h];a.push({sub:[c].concat(p.components),by:p.ligGlyph})}return a},Substitution.prototype.addSingle=function(t,e,r,a){var s=this.getLookupTable(r,a,t,1,!0),o=getSubstFormat(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});check.assert(1===o.coverage.format,"Ligature: unable to modify coverage table format "+o.coverage.format);var u=e.sub,i=this.binSearch(o.coverage.glyphs,u);0>i&&(i=-1-i,o.coverage.glyphs.splice(i,0,u),o.substitute.splice(i,0,0)),o.substitute[i]=e.by},Substitution.prototype.addAlternate=function(t,e,r,a){var s=this.getLookupTable(r,a,t,3,!0),o=getSubstFormat(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});check.assert(1===o.coverage.format,"Ligature: unable to modify coverage table format "+o.coverage.format);var u=e.sub,i=this.binSearch(o.coverage.glyphs,u);0>i&&(i=-1-i,o.coverage.glyphs.splice(i,0,u),o.alternateSets.splice(i,0,0)),o.alternateSets[i]=e.by},Substitution.prototype.addLigature=function(t,e,r,a){r=r||"DFLT",a=a||"DFLT";var s=this.getLookupTable(r,a,t,4,!0),o=s.subtables[0];o||(o={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},s.subtables[0]=o),check.assert(1===o.coverage.format,"Ligature: unable to modify coverage table format "+o.coverage.format);var u=e.sub[0],i=e.sub.slice(1),n={ligGlyph:e.by,components:i},g=this.binSearch(o.coverage.glyphs,u);if(g>=0){for(var l=o.ligatureSets[g],c=0;c<l.length;c++)if(arraysEqual(l[c].components,i))return;l.push(n)}else g=-1-g,o.coverage.glyphs.splice(g,0,u),o.ligatureSets.splice(g,0,[n])},Substitution.prototype.getFeature=function(t,e,r){if(e=e||"DFLT",r=r||"DFLT",/ss\d\d/.test(t))return this.getSingle(t,e,r);switch(t){case"aalt":case"salt":return this.getSingle(t,e,r).concat(this.getAlternates(t,e,r));case"dlig":case"liga":case"rlig":return this.getLigatures(t,e,r)}},Substitution.prototype.add=function(t,e,r,a){if(r=r||"DFLT",a=a||"DFLT",/ss\d\d/.test(t))return this.addSingle(t,e,r,a);switch(t){case"aalt":case"salt":return"number"==typeof e.by?this.addSingle(t,e,r,a):this.addAlternate(t,e,r,a);case"dlig":case"liga":case"rlig":return this.addLigature(t,e,r,a)}},module.exports=Substitution;
},{"./check":2,"./layout":8}],13:[function(require,module,exports){
"use strict";function Table(e,t,a){var r;for(r=0;r<t.length;r+=1){var o=t[r];this[o.name]=o.value}if(this.tableName=e,this.fields=t,a){var s=Object.keys(a);for(r=0;r<s.length;r+=1){var n=s[r],u=a[n];void 0!==this[n]&&(this[n]=u)}}}function ushortList(e,t,a){void 0===a&&(a=t.length);var r=new Array(t.length+1);r[0]={name:e+"Count",type:"USHORT",value:a};for(var o=0;o<t.length;o++)r[o+1]={name:e+o,type:"USHORT",value:t[o]};return r}function tableList(e,t,a){var r=t.length,o=new Array(r+1);o[0]={name:e+"Count",type:"USHORT",value:r};for(var s=0;r>s;s++)o[s+1]={name:e+s,type:"TABLE",value:a(t[s],s)};return o}function recordList(e,t,a){var r=t.length,o=[];o[0]={name:e+"Count",type:"USHORT",value:r};for(var s=0;r>s;s++)o=o.concat(a(t[s],s));return o}function Coverage(e){1===e.format?Table.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(ushortList("glyph",e.glyphs))):check.assert(!1,"Can't create coverage table format 2 yet.")}function ScriptList(e){Table.call(this,"scriptListTable",recordList("scriptRecord",e,function(e,t){var a=e.script,r=a.defaultLangSys;return check.assert(!!r,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script