/** * Modules in this bundle * @license * * opentype.js: * license: MIT (http://opensource.org/licenses/MIT) * author: Frederik De Bleser * version: 0.6.5 * * tiny-inflate: * license: MIT (http://opensource.org/licenses/MIT) * author: Devon Govett * maintainers: devongovett * 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;os;++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<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++]<>>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++]<>>=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.destLen0,"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;){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=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;oa;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;ea;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;i0?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;pa;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=0&&e>0&&(t+=" "),t+=o(i)}return t}t=void 0!==t?t:2;for(var i="",s=0;sa;a++)if(t[a]!==e[a])return!1;return!0}function getSubstFormat(t,e,r){for(var a=t.subtables,s=0;si&&(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;cs;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"+t,type:"TABLE",value:new Table("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Table("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:r.reqFeatureIndex}].concat(ushortList("featureIndex",r.featureIndexes)))}].concat(recordList("langSys",a.langSysRecords,function(e,t){var a=e.langSys;return[{name:"langSysTag"+t,type:"TAG",value:e.tag},{name:"langSys"+t,type:"TABLE",value:new Table("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:a.reqFeatureIndex}].concat(ushortList("featureIndex",a.featureIndexes)))}]})))}]}))}function FeatureList(e){Table.call(this,"featureListTable",recordList("featureRecord",e,function(e,t){var a=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new Table("featureTable",[{name:"featureParams",type:"USHORT",value:a.featureParams}].concat(ushortList("lookupListIndex",a.lookupListIndexes)))}]}))}function LookupList(e,t){Table.call(this,"lookupListTable",tableList("lookup",e,function(e){var a=t[e.lookupType];return check.assert(!!a,"Unable to write GSUB lookup type "+e.lookupType+" tables."),new Table("lookupTable",[{name:"lookupType",type:"USHORT",value:e.lookupType},{name:"lookupFlag",type:"USHORT",value:e.lookupFlag}].concat(tableList("subtable",e.subtables,a)))}))}var check=require("./check"),encode=require("./types").encode,sizeOf=require("./types").sizeOf;Table.prototype.encode=function(){return encode.TABLE(this)},Table.prototype.sizeOf=function(){return sizeOf.TABLE(this)},Coverage.prototype=Object.create(Table.prototype),Coverage.prototype.constructor=Coverage,ScriptList.prototype=Object.create(Table.prototype),ScriptList.prototype.constructor=ScriptList,FeatureList.prototype=Object.create(Table.prototype),FeatureList.prototype.constructor=FeatureList,LookupList.prototype=Object.create(Table.prototype),LookupList.prototype.constructor=LookupList,exports.Record=exports.Table=Table,exports.Coverage=Coverage,exports.ScriptList=ScriptList,exports.FeatureList=FeatureList,exports.LookupList=LookupList,exports.ushortList=ushortList,exports.tableList=tableList,exports.recordList=recordList; },{"./check":2,"./types":32}],14:[function(require,module,exports){ "use strict";function equals(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var a=0;ar;r+=1)i.push(parse.getOffset(e,p,f)),p+=f;s=n+i[h]}else s=t+2;for(r=0;r>4,i=15&n;if(s===a)break;if(t+=r[s],i===a)break;t+=r[i]}return parseFloat(t)}function parseOperand(e,t){var a,r,n,s;if(28===t)return a=e.parseByte(),r=e.parseByte(),a<<8|r;if(29===t)return a=e.parseByte(),r=e.parseByte(),n=e.parseByte(),s=e.parseByte(),a<<24|r<<16|n<<8|s;if(30===t)return parseFloatOperand(e);if(t>=32&&246>=t)return t-139;if(t>=247&&250>=t)return a=e.parseByte(),256*(t-247)+a+108;if(t>=251&&254>=t)return a=e.parseByte(),256*-(t-251)-a-108;throw new Error("Invalid b0 "+t)}function entriesToObject(e){for(var t={},a=0;a=i?(12===i&&(i=1200+r.parseByte()),n.push([i,s]),s=[]):s.push(parseOperand(r,i))}return entriesToObject(n)}function getCFFString(e,t){return t=390>=t?encoding.cffStandardStrings[t]:e[t-391]}function interpretDict(e,t,a){for(var r={},n=0;nn;n+=1)s=o.parseSID(),h.push(getCFFString(r,s));else if(1===f)for(;h.length<=a;)for(s=o.parseSID(),i=o.parseCard8(),n=0;i>=n;n+=1)h.push(getCFFString(r,s)),s+=1;else{if(2!==f)throw new Error("Unknown charset format "+f);for(;h.length<=a;)for(s=o.parseSID(),i=o.parseCard16(),n=0;i>=n;n+=1)h.push(getCFFString(r,s)),s+=1}return h}function parseCFFEncoding(e,t,a){var r,n,s={},i=new parse.Parser(e,t),o=i.parseCard8();if(0===o){var h=i.parseCard8();for(r=0;h>r;r+=1)n=i.parseCard8(),s[n]=r}else{if(1!==o)throw new Error("Unknown encoding format "+o);var f=i.parseCard8();for(n=1,r=0;f>r;r+=1)for(var p=i.parseCard8(),u=i.parseCard8(),l=p;p+u>=l;l+=1)s[l]=n,n+=1}return new encoding.CffEncoding(s,a)}function parseCFFCharstring(e,t,a){function r(e,t){g&&p.closePath(),p.moveTo(e,t),g=!0}function n(){var t;t=u.length%2!==0,t&&!c&&(d=u.shift()+e.nominalWidthX),l+=u.length>>1,u.length=0,c=!0}function s(a){for(var y,b,C,T,F,I,D,x,k,S,E,O,R=0;R1&&!c&&(d=u.shift()+e.nominalWidthX,c=!0),m+=u.pop(),r(v,m);break;case 5:for(;u.length>0;)v+=u.shift(),m+=u.shift(),p.lineTo(v,m);break;case 6:for(;u.length>0&&(v+=u.shift(),p.lineTo(v,m),0!==u.length);)m+=u.shift(),p.lineTo(v,m);break;case 7:for(;u.length>0&&(m+=u.shift(),p.lineTo(v,m),0!==u.length);)v+=u.shift(),p.lineTo(v,m);break;case 8:for(;u.length>0;)i=v+u.shift(),o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),v=h+u.shift(),m=f+u.shift(),p.curveTo(i,o,h,f,v,m);break;case 10:F=u.pop()+e.subrsBias,I=e.subrs[F],I&&s(I);break;case 11:return;case 12:switch(M=a[R],R+=1,M){case 35:i=v+u.shift(),o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),D=h+u.shift(),x=f+u.shift(),k=D+u.shift(),S=x+u.shift(),E=k+u.shift(),O=S+u.shift(),v=E+u.shift(),m=O+u.shift(),u.shift(),p.curveTo(i,o,h,f,D,x),p.curveTo(k,S,E,O,v,m);break;case 34:i=v+u.shift(),o=m,h=i+u.shift(),f=o+u.shift(),D=h+u.shift(),x=f,k=D+u.shift(),S=f,E=k+u.shift(),O=m,v=E+u.shift(),p.curveTo(i,o,h,f,D,x),p.curveTo(k,S,E,O,v,m);break;case 36:i=v+u.shift(),o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),D=h+u.shift(),x=f,k=D+u.shift(),S=f,E=k+u.shift(),O=S+u.shift(),v=E+u.shift(),p.curveTo(i,o,h,f,D,x),p.curveTo(k,S,E,O,v,m);break;case 37:i=v+u.shift(),o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),D=h+u.shift(),x=f+u.shift(),k=D+u.shift(),S=x+u.shift(),E=k+u.shift(),O=S+u.shift(),Math.abs(E-v)>Math.abs(O-m)?v=E+u.shift():m=O+u.shift(),p.curveTo(i,o,h,f,D,x),p.curveTo(k,S,E,O,v,m);break;default:console.log("Glyph "+t.index+": unknown operator 1200"+M),u.length=0}break;case 14:u.length>0&&!c&&(d=u.shift()+e.nominalWidthX,c=!0),g&&(p.closePath(),g=!1);break;case 18:n();break;case 19:case 20:n(),R+=l+7>>3;break;case 21:u.length>2&&!c&&(d=u.shift()+e.nominalWidthX,c=!0),m+=u.pop(),v+=u.pop(),r(v,m);break;case 22:u.length>1&&!c&&(d=u.shift()+e.nominalWidthX,c=!0),v+=u.pop(),r(v,m);break;case 23:n();break;case 24:for(;u.length>2;)i=v+u.shift(),o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),v=h+u.shift(),m=f+u.shift(),p.curveTo(i,o,h,f,v,m);v+=u.shift(),m+=u.shift(),p.lineTo(v,m);break;case 25:for(;u.length>6;)v+=u.shift(),m+=u.shift(),p.lineTo(v,m);i=v+u.shift(),o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),v=h+u.shift(),m=f+u.shift(),p.curveTo(i,o,h,f,v,m);break;case 26:for(u.length%2&&(v+=u.shift());u.length>0;)i=v,o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),v=h,m=f+u.shift(),p.curveTo(i,o,h,f,v,m);break;case 27:for(u.length%2&&(m+=u.shift());u.length>0;)i=v+u.shift(),o=m,h=i+u.shift(),f=o+u.shift(),v=h+u.shift(),m=f,p.curveTo(i,o,h,f,v,m);break;case 28:y=a[R],b=a[R+1],u.push((y<<24|b<<16)>>16),R+=2;break;case 29:F=u.pop()+e.gsubrsBias,I=e.gsubrs[F],I&&s(I);break;case 30:for(;u.length>0&&(i=v,o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),v=h+u.shift(),m=f+(1===u.length?u.shift():0),p.curveTo(i,o,h,f,v,m),0!==u.length);)i=v+u.shift(),o=m,h=i+u.shift(),f=o+u.shift(),m=f+u.shift(),v=h+(1===u.length?u.shift():0),p.curveTo(i,o,h,f,v,m);break;case 31:for(;u.length>0&&(i=v+u.shift(),o=m,h=i+u.shift(),f=o+u.shift(),m=f+u.shift(),v=h+(1===u.length?u.shift():0),p.curveTo(i,o,h,f,v,m),0!==u.length);)i=v,o=m+u.shift(),h=i+u.shift(),f=o+u.shift(),v=h+u.shift(),m=f+(1===u.length?u.shift():0),p.curveTo(i,o,h,f,v,m);break;default:32>M?console.log("Glyph "+t.index+": unknown operator "+M):247>M?u.push(M-139):251>M?(y=a[R],R+=1,u.push(256*(M-247)+y+108)):255>M?(y=a[R],R+=1,u.push(256*-(M-251)-y-108)):(y=a[R],b=a[R+1],C=a[R+2],T=a[R+3],R+=4,u.push((y<<24|b<<16|C<<8|T)/65536))}}}var i,o,h,f,p=new path.Path,u=[],l=0,c=!1,d=e.defaultWidthX,g=!1,v=0,m=0;return s(a),t.advanceWidth=d,p}function calcCFFSubroutineBias(e){var t;return t=e.length<1240?107:e.length<33900?1131:32768}function parseCFFTable(e,t,a){a.tables.cff={};var r=parseCFFHeader(e,t),n=parseCFFIndex(e,r.endOffset,parse.bytesToString),s=parseCFFIndex(e,n.endOffset),i=parseCFFIndex(e,s.endOffset,parse.bytesToString),o=parseCFFIndex(e,i.endOffset);a.gsubrs=o.objects,a.gsubrsBias=calcCFFSubroutineBias(a.gsubrs);var h=new DataView(new Uint8Array(s.objects[0]).buffer),f=parseCFFTopDict(h,i.objects);a.tables.cff.topDict=f;var p=t+f["private"][1],u=parseCFFPrivateDict(e,p,f["private"][0],i.objects);if(a.defaultWidthX=u.defaultWidthX,a.nominalWidthX=u.nominalWidthX,0!==u.subrs){var l=p+u.subrs,c=parseCFFIndex(e,l);a.subrs=c.objects,a.subrsBias=calcCFFSubroutineBias(a.subrs)}else a.subrs=[],a.subrsBias=0;var d=parseCFFIndex(e,t+f.charStrings);a.nGlyphs=d.objects.length;var g=parseCFFCharset(e,t+f.charset,a.nGlyphs,i.objects);a.cffEncoding=0===f.encoding?new encoding.CffEncoding(encoding.cffStandardEncoding,g):1===f.encoding?new encoding.CffEncoding(encoding.cffExpertEncoding,g):parseCFFEncoding(e,t+f.encoding,g),a.encoding=a.encoding||a.cffEncoding,a.glyphs=new glyphset.GlyphSet(a);for(var v=0;v=0&&(a=r),r=t.indexOf(e),r>=0?a=r+encoding.cffStandardStrings.length:(a=encoding.cffStandardStrings.length+t.length,t.push(e)),a}function makeHeader(){return new table.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function makeNameIndex(e){var t=new table.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);t.names=[];for(var a=0;ar;r+=1)for(var n=a.parseULong(),s=a.parseULong(),o=a.parseULong(),l=n;s>=l;l+=1)e.glyphIndexMap[l]=o,o++}function parseCmapTableFormat4(e,a,r,t,n){var s;e.length=a.parseUShort(),e.language=a.parseUShort();var o;e.segCount=o=a.parseUShort()>>1,a.skip("uShort",3),e.glyphIndexMap={};var l=new parse.Parser(r,t+n+14),p=new parse.Parser(r,t+n+16+2*o),g=new parse.Parser(r,t+n+16+4*o),m=new parse.Parser(r,t+n+16+6*o),u=t+n+16+8*o;for(s=0;o-1>s;s+=1)for(var h,f=l.parseUShort(),c=p.parseUShort(),d=g.parseShort(),i=m.parseUShort(),v=c;f>=v;v+=1)0!==i?(u=m.offset+m.relativeOffset-2,u+=i,u+=2*(v-c),h=parse.getUShort(r,u),0!==h&&(h=h+d&65535)):h=v+d&65535,e.glyphIndexMap[v]=h}function parseCmapTable(e,a){var r,t={};t.version=parse.getUShort(e,a),check.argument(0===t.version,"cmap table version should be 0."),t.numTables=parse.getUShort(e,a+2);var n=-1;for(r=t.numTables-1;r>=0;r-=1){var s=parse.getUShort(e,a+4+8*r),o=parse.getUShort(e,a+4+8*r+2);if(3===s&&(0===o||1===o||10===o)){n=parse.getULong(e,a+4+8*r+4);break}}if(-1===n)return null;var l=new parse.Parser(e,a+n);if(t.format=l.parseUShort(),12===t.format)parseCmapTableFormat12(t,l);else{if(4!==t.format)throw new Error("Only format 4 and 12 cmap tables are supported.");parseCmapTableFormat4(t,l,e,a,n)}return t}function addSegment(e,a,r){e.segments.push({end:a,start:a,delta:-(a-r),offset:0})}function addTerminatorSegment(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function makeCmapTable(e){var a,r=new table.Table("cmap",[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:1},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:12},{name:"format",type:"USHORT",value:4},{name:"length",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}]);for(r.segments=[],a=0;aa;a+=1){var u=r.segments[a];o=o.concat({name:"end_"+a,type:"USHORT",value:u.end}),l=l.concat({name:"start_"+a,type:"USHORT",value:u.start}),p=p.concat({name:"idDelta_"+a,type:"SHORT",value:u.delta}),g=g.concat({name:"idRangeOffset_"+a,type:"USHORT",value:u.offset}),void 0!==u.glyphId&&(m=m.concat({name:"glyph_"+a,type:"USHORT",value:u.glyphId}))}return r.fields=r.fields.concat(o),r.fields.push({name:"reservedPad",type:"USHORT",value:0}),r.fields=r.fields.concat(l),r.fields=r.fields.concat(p),r.fields=r.fields.concat(g),r.fields=r.fields.concat(m),r.length=14+2*o.length+2+2*l.length+2*p.length+2*g.length+2*m.length,r}var check=require("../check"),parse=require("../parse"),table=require("../table");exports.parse=parseCmapTable,exports.make=makeCmapTable; },{"../check":2,"../parse":10,"../table":13}],16:[function(require,module,exports){ "use strict";function addName(e,a){var r=JSON.stringify(e),n=256;for(var t in a){var s=parseInt(t);if(s&&!(256>s)){if(JSON.stringify(a[t])===r)return s;s>=n&&(n=s+1)}}return a[n]=e,n}function makeFvarAxis(e,a,r){var n=addName(a.name,r);return[{name:"tag_"+e,type:"TAG",value:a.tag},{name:"minValue_"+e,type:"FIXED",value:a.minValue<<16},{name:"defaultValue_"+e,type:"FIXED",value:a.defaultValue<<16},{name:"maxValue_"+e,type:"FIXED",value:a.maxValue<<16},{name:"flags_"+e,type:"USHORT",value:0},{name:"nameID_"+e,type:"USHORT",value:n}]}function parseFvarAxis(e,a,r){var n={},t=new parse.Parser(e,a);return n.tag=t.parseTag(),n.minValue=t.parseFixed(),n.defaultValue=t.parseFixed(),n.maxValue=t.parseFixed(),t.skip("uShort",1),n.name=r[t.parseUShort()]||{},n}function makeFvarInstance(e,a,r,n){for(var t=addName(a.name,n),s=[{name:"nameID_"+e,type:"USHORT",value:t},{name:"flags_"+e,type:"USHORT",value:0}],u=0;uo;o++)v.push(parseFvarAxis(e,a+s+o*i,r));for(var m=[],f=a+s+u*i,c=0;p>c;c++)m.push(parseFvarInstance(e,f+c*l,v,r));return{axes:v,instances:m}}var check=require("../check"),parse=require("../parse"),table=require("../table");exports.make=makeFvarTable,exports.parse=parseFvarTable; },{"../check":2,"../parse":10,"../table":13}],17:[function(require,module,exports){ "use strict";function parseGlyphCoordinate(e,r,t,o,a){var n;return(r&o)>0?(n=e.parseByte(),0===(r&a)&&(n=-n),n=t+n):n=(r&a)>0?t:t+e.parseShort(),n}function parseGlyph(e,r,t){var o=new parse.Parser(r,t);e.numberOfContours=o.parseShort(),e._xMin=o.parseShort(),e._yMin=o.parseShort(),e._xMax=o.parseShort(),e._yMax=o.parseShort();var a,n;if(e.numberOfContours>0){var s,p=e.endPointIndices=[];for(s=0;ss;s+=1)if(n=o.parseByte(),a.push(n),(8&n)>0)for(var h=o.parseByte(),l=0;h>l;l+=1)a.push(n),s+=1;if(check.argument(a.length===i,"Bad flags."),p.length>0){var u,c=[];if(i>0){for(s=0;i>s;s+=1)n=a[s],u={},u.onCurve=!!(1&n),u.lastPointOfContour=p.indexOf(s)>=0,c.push(u);var y=0;for(s=0;i>s;s+=1)n=a[s],u=c[s],u.x=parseGlyphCoordinate(o,n,y,2,16),y=u.x;var f=0;for(s=0;i>s;s+=1)n=a[s],u=c[s],u.y=parseGlyphCoordinate(o,n,f,4,32),f=u.y}e.points=c}else e.points=[]}else if(0===e.numberOfContours)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];for(var v=!0;v;){a=o.parseUShort();var x={glyphIndex:o.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(1&a)>0?(2&a)>0?(x.dx=o.parseShort(),x.dy=o.parseShort()):x.matchedPoints=[o.parseUShort(),o.parseUShort()]:(2&a)>0?(x.dx=o.parseChar(),x.dy=o.parseChar()):x.matchedPoints=[o.parseByte(),o.parseByte()],(8&a)>0?x.xScale=x.yScale=o.parseF2Dot14():(64&a)>0?(x.xScale=o.parseF2Dot14(),x.yScale=o.parseF2Dot14()):(128&a)>0&&(x.xScale=o.parseF2Dot14(),x.scale01=o.parseF2Dot14(),x.scale10=o.parseF2Dot14(),x.yScale=o.parseF2Dot14()),e.components.push(x),v=!!(32&a)}}}function transformPoints(e,r){for(var t=[],o=0;or.points.length-1||o.matchedPoints[1]>a.points.length-1)throw Error("Matched points out of range in "+r.name);var s=r.points[o.matchedPoints[0]],p=a.points[o.matchedPoints[1]],i={xScale:o.xScale,scale01:o.scale01,scale10:o.scale10,yScale:o.yScale,dx:0,dy:0};p=transformPoints([p],i)[0],i.dx=s.x-p.x,i.dy=s.y-p.y,n=transformPoints(a.points,i)}r.points=r.points.concat(n)}}return getPath(r.points)}function parseGlyfTable(e,r,t,o){var a,n=new glyphset.GlyphSet(o);for(a=0;ao;o++)t[a.parseTag()]={offset:a.parseUShort()};return t}function parseCoverageTable(r,e){var a=new parse.Parser(r,e),s=a.parseUShort(),t=a.parseUShort();if(1===s)return a.parseUShortList(t);if(2===s){for(var o=[];t--;)for(var p=a.parseUShort(),n=a.parseUShort(),f=a.parseUShort(),i=p;n>=i;i++)o[f++]=i;return o}}function parseClassDefTable(r,e){var a=new parse.Parser(r,e),s=a.parseUShort();if(1===s){var t=a.parseUShort(),o=a.parseUShort(),p=a.parseUShortList(o);return function(r){return p[r-t]||0}}if(2===s){for(var n=a.parseUShort(),f=[],i=[],h=[],S=0;n>S;S++)f[S]=a.parseUShort(),i[S]=a.parseUShort(),h[S]=a.parseUShort();return function(r){for(var e=0,a=f.length-1;a>e;){var s=e+a+1>>1;rU;U++){var l=v[U],g=h[l];if(!g){g={},t.relativeOffset=l;for(var T=t.parseUShort();T--;){var c=t.parseUShort();f&&(a=t.parseShort()),i&&(s=t.parseShort()),g[c]=a}}u[n[U]]=g}return function(r,e){var a=u[r];return a?a[e]:void 0}}if(2===o){for(var b=t.parseUShort(),P=t.parseUShort(),L=t.parseUShort(),k=t.parseUShort(),d=parseClassDefTable(r,e+b),w=parseClassDefTable(r,e+P),O=[],C=0;L>C;C++)for(var G=O[C]=[],K=0;k>K;K++)f&&(a=t.parseShort()),i&&(s=t.parseShort()),G[K]=a;var V={};for(C=0;Ch;h++)i.push(parsePairPosSubTable(r,e+n[h]));f.getKerningValue=function(r,e){for(var a=i.length;a--;){var s=i[a](r,e);if(void 0!==s)return s}return 0}}return f}function parseGposTable(r,e,a){var s=new parse.Parser(r,e),t=s.parseFixed();check.argument(1===t,"Unsupported GPOS table version."),parseTaggedListTable(r,e+s.parseUShort()),parseTaggedListTable(r,e+s.parseUShort());var o=s.parseUShort();s.relativeOffset=o;for(var p=s.parseUShort(),n=s.parseOffset16List(p),f=e+o,i=0;p>i;i++){var h=parseLookupTable(r,f+n[i]);2!==h.lookupType||a.getGposKerningValue||(a.getGposKerningValue=h.getKerningValue)}}var check=require("../check"),parse=require("../parse");exports.parse=parseGposTable; },{"../check":2,"../parse":10}],19:[function(require,module,exports){ "use strict";function parseGsubTable(e,t){t=t||0;var s=new Parser(e,t),r=s.parseVersion();return check.argument(1===r,"Unsupported GSUB table version."),{version:r,scripts:s.parseScriptList(),features:s.parseFeatureList(),lookups:s.parseLookupList(subtableParsers)}}function makeGsubTable(e){return new table.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new table.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new table.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new table.LookupList(e.lookups,subtableMakers)}])}var check=require("../check"),Parser=require("../parse").Parser,subtableParsers=new Array(9),table=require("../table");subtableParsers[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{substFormat:1,coverage:this.parsePointer(Parser.coverage),deltaGlyphId:this.parseUShort()}:2===t?{substFormat:2,coverage:this.parsePointer(Parser.coverage),substitute:this.parseOffset16List()}:void check.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},subtableParsers[2]=function(){var e=this.parseUShort();return check.argument(1===e,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Parser.coverage),sequences:this.parseListOfLists()}},subtableParsers[3]=function(){var e=this.parseUShort();return check.argument(1===e,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Parser.coverage),alternateSets:this.parseListOfLists()}},subtableParsers[4]=function(){var e=this.parseUShort();return check.argument(1===e,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Parser.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var lookupRecordDesc={sequenceIndex:Parser.uShort,lookupListIndex:Parser.uShort};subtableParsers[5]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(1===t)return{substFormat:t,coverage:this.parsePointer(Parser.coverage),ruleSets:this.parseListOfLists(function(){var e=this.parseUShort(),t=this.parseUShort();return{input:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,lookupRecordDesc)}})};if(2===t)return{substFormat:t,coverage:this.parsePointer(Parser.coverage),classDef:this.parsePointer(Parser.classDef),classSets:this.parseListOfLists(function(){var e=this.parseUShort(),t=this.parseUShort();return{classes:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,lookupRecordDesc)}})};if(3===t){var s=this.parseUShort(),r=this.parseUShort();return{substFormat:t,coverages:this.parseList(s,Parser.pointer(Parser.coverage)),lookupRecords:this.parseRecordList(r,lookupRecordDesc)}}check.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},subtableParsers[6]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{substFormat:1,coverage:this.parsePointer(Parser.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(lookupRecordDesc)}})}:2===t?{substFormat:2,coverage:this.parsePointer(Parser.coverage),backtrackClassDef:this.parsePointer(Parser.classDef),inputClassDef:this.parsePointer(Parser.classDef),lookaheadClassDef:this.parsePointer(Parser.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(lookupRecordDesc)}})}:3===t?{substFormat:3,backtrackCoverage:this.parseList(Parser.pointer(Parser.coverage)),inputCoverage:this.parseList(Parser.pointer(Parser.coverage)),lookaheadCoverage:this.parseList(Parser.pointer(Parser.coverage)),lookupRecords:this.parseRecordList(lookupRecordDesc)}:void check.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},subtableParsers[7]=function(){var e=this.parseUShort();check.argument(1===e,"GSUB Extension Substitution subtable identifier-format must be 1");var t=this.parseUShort(),s=new Parser(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:subtableParsers[t].call(s)}},subtableParsers[8]=function(){var e=this.parseUShort();return check.argument(1===e,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(Parser.coverage),backtrackCoverage:this.parseList(Parser.pointer(Parser.coverage)),lookaheadCoverage:this.parseList(Parser.pointer(Parser.coverage)),substitutes:this.parseUShortList()}};var subtableMakers=new Array(9);subtableMakers[1]=function(e){return 1===e.substFormat?new table.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new table.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new table.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new table.Coverage(e.coverage)}].concat(table.ushortList("substitute",e.substitute)))},subtableMakers[3]=function(e){return check.assert(1===e.substFormat,"Lookup type 3 substFormat must be 1."),new table.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new table.Coverage(e.coverage)}].concat(table.tableList("altSet",e.alternateSets,function(e){return new table.Table("alternateSetTable",table.ushortList("alternate",e))})))},subtableMakers[4]=function(e){return check.assert(1===e.substFormat,"Lookup type 4 substFormat must be 1."),new table.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new table.Coverage(e.coverage)}].concat(table.tableList("ligSet",e.ligatureSets,function(e){return new table.Table("ligatureSetTable",table.tableList("ligature",e,function(e){return new table.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:e.ligGlyph}].concat(table.ushortList("component",e.components,e.components.length+1)))}))})))},exports.parse=parseGsubTable,exports.make=makeGsubTable; },{"../check":2,"../parse":10,"../table":13}],20:[function(require,module,exports){ "use strict";function parseHeadTable(e,a){var t={},r=new parse.Parser(e,a);return t.version=r.parseVersion(),t.fontRevision=Math.round(1e3*r.parseFixed())/1e3,t.checkSumAdjustment=r.parseULong(),t.magicNumber=r.parseULong(),check.argument(1594834165===t.magicNumber,"Font header has wrong magic number."),t.flags=r.parseUShort(),t.unitsPerEm=r.parseUShort(),t.created=r.parseLongDateTime(),t.modified=r.parseLongDateTime(),t.xMin=r.parseShort(),t.yMin=r.parseShort(),t.xMax=r.parseShort(),t.yMax=r.parseShort(),t.macStyle=r.parseUShort(),t.lowestRecPPEM=r.parseUShort(),t.fontDirectionHint=r.parseShort(),t.indexToLocFormat=r.parseShort(),t.glyphDataFormat=r.parseShort(),t}function makeHeadTable(e){var a=Math.round((new Date).getTime()/1e3)+2082844800,t=a;return e.createdTimestamp&&(t=e.createdTimestamp+2082844800),new table.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:t},{name:"modified",type:"LONGDATETIME",value:a},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],e)}var check=require("../check"),parse=require("../parse"),table=require("../table");exports.parse=parseHeadTable,exports.make=makeHeadTable; },{"../check":2,"../parse":10,"../table":13}],21:[function(require,module,exports){ "use strict";function parseHheaTable(e,a){var r={},t=new parse.Parser(e,a);return r.version=t.parseVersion(),r.ascender=t.parseShort(),r.descender=t.parseShort(),r.lineGap=t.parseShort(),r.advanceWidthMax=t.parseUShort(),r.minLeftSideBearing=t.parseShort(),r.minRightSideBearing=t.parseShort(),r.xMaxExtent=t.parseShort(),r.caretSlopeRise=t.parseShort(),r.caretSlopeRun=t.parseShort(),r.caretOffset=t.parseShort(),t.relativeOffset+=8,r.metricDataFormat=t.parseShort(),r.numberOfHMetrics=t.parseUShort(),r}function makeHheaTable(e){return new table.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],e)}var parse=require("../parse"),table=require("../table");exports.parse=parseHheaTable,exports.make=makeHheaTable; },{"../parse":10,"../table":13}],22:[function(require,module,exports){ "use strict";function parseHmtxTable(e,a,r,t,s){for(var i,l,n=new parse.Parser(e,a),p=0;t>p;p+=1){r>p&&(i=n.parseUShort(),l=n.parseShort());var d=s.get(p);d.advanceWidth=i,d.leftSideBearing=l}}function makeHmtxTable(e){for(var a=new table.Table("hmtx",[]),r=0;rn;n+=1){var h=s.parseUShort(),u=s.parseUShort(),c=s.parseShort();a[h+","+u]=c}return a}var check=require("../check"),parse=require("../parse");exports.parse=parseKernTable; },{"../check":2,"../parse":10}],24:[function(require,module,exports){ "use strict";function parseLocaTable(r,a,e,s){for(var p=new parse.Parser(r,a),o=s?p.parseUShort:p.parseULong,t=[],c=0;e+1>c;c+=1){var n=o.call(p);s&&(n*=2),t.push(n)}return t}var parse=require("../parse");exports.parse=parseLocaTable; },{"../parse":10}],25:[function(require,module,exports){ "use strict";function makeLtagTable(e){for(var a=new table.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:e.length}]),r="",t=12+4*e.length,n=0;ns&&(s=r.length,r+=e[n]),a.fields.push({name:"offset "+n,type:"USHORT",value:t+s}),a.fields.push({name:"length "+n,type:"USHORT",value:e[n].length})}return a.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),a}function parseLtagTable(e,a){var r=new parse.Parser(e,a),t=r.parseULong();check.argument(1===t,"Unsupported ltag table version."),r.skip("uLong",1);for(var n=r.parseULong(),s=[],l=0;n>l;l++){for(var p="",u=a+r.parseUShort(),g=r.parseUShort(),o=u;u+g>o;++o)p+=String.fromCharCode(e.getInt8(o));s.push(p)}return s}var check=require("../check"),parse=require("../parse"),table=require("../table");exports.make=makeLtagTable,exports.parse=parseLtagTable; },{"../check":2,"../parse":10,"../table":13}],26:[function(require,module,exports){ "use strict";function parseMaxpTable(e,a){var r={},s=new parse.Parser(e,a);return r.version=s.parseVersion(),r.numGlyphs=s.parseUShort(),1===r.version&&(r.maxPoints=s.parseUShort(),r.maxContours=s.parseUShort(),r.maxCompositePoints=s.parseUShort(),r.maxCompositeContours=s.parseUShort(),r.maxZones=s.parseUShort(),r.maxTwilightPoints=s.parseUShort(),r.maxStorage=s.parseUShort(),r.maxFunctionDefs=s.parseUShort(),r.maxInstructionDefs=s.parseUShort(),r.maxStackElements=s.parseUShort(),r.maxSizeOfInstructions=s.parseUShort(),r.maxComponentElements=s.parseUShort(),r.maxComponentDepth=s.parseUShort()),r}function makeMaxpTable(e){return new table.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:e}])}var parse=require("../parse"),table=require("../table");exports.parse=parseMaxpTable,exports.make=makeMaxpTable; },{"../parse":10,"../table":13}],27:[function(require,module,exports){ "use strict";function parseMetaTable(e,a){var r=new parse.Parser(e,a),t=r.parseULong();check.argument(1===t,"Unsupported META table version."),r.parseULong(),r.parseULong();for(var s=r.parseULong(),n={},p=0;s>p;p++){var l=r.parseTag(),u=r.parseULong(),o=r.parseULong(),v=decode.UTF8(e,a+u,o);n[l]=v}return n}function makeMetaTable(e){var a=Object.keys(e).length,r="",t=16+12*a,s=new table.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:t},{name:"numTags",type:"ULONG",value:a}]);for(var n in e){var p=r.length;r+=e[n],s.fields.push({name:"tag "+n,type:"TAG",value:n}),s.fields.push({name:"offset "+n,type:"ULONG",value:t+p}),s.fields.push({name:"length "+n,type:"ULONG",value:e[n].length})}return s.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),s}var types=require("../types"),decode=types.decode,check=require("../check"),parse=require("../parse"),table=require("../table");exports.parse=parseMetaTable,exports.make=makeMetaTable; },{"../check":2,"../parse":10,"../table":13,"../types":32}],28:[function(require,module,exports){ "use strict";function getLanguageCode(e,a,r){switch(e){case 0:if(65535===a)return"und";if(r)return r[a];break;case 1:return macLanguages[a];case 3:return windowsLanguages[a]}return void 0}function getEncoding(e,a,r){switch(e){case 0:return utf16;case 1:return macLanguageEncodings[r]||macScriptEncodings[a];case 3:if(1===a||10===a)return utf16}return void 0}function parseNameTable(e,a,r){for(var n={},t=new parse.Parser(e,a),s=t.parseUShort(),m=t.parseUShort(),i=t.offset+t.parseUShort(),c=0;m>c;c++){var o=t.parseUShort(),u=t.parseUShort(),l=t.parseUShort(),g=t.parseUShort(),d=nameTableNames[g]||g,f=t.parseUShort(),p=t.parseUShort(),h=getLanguageCode(o,l,r),v=getEncoding(o,u,l);if(void 0!==v&&void 0!==h){var x;if(x=v===utf16?decode.UTF16(e,i+p,f):decode.MACSTRING(e,i+p,f,v)){var y=n[d];void 0===y&&(y=n[d]={}),y[h]=x}}}var b=0;return 1===s&&(b=t.parseUShort()),n}function reverseDict(e){var a={};for(var r in e)a[e[r]]=parseInt(r);return a}function makeNameRecord(e,a,r,n,t,s){return new table.Record("NameRecord",[{name:"platformID",type:"USHORT",value:e},{name:"encodingID",type:"USHORT",value:a},{name:"languageID",type:"USHORT",value:r},{name:"nameID",type:"USHORT",value:n},{name:"length",type:"USHORT",value:t},{name:"offset",type:"USHORT",value:s}])}function findSubArray(e,a){var r=e.length,n=a.length-r+1;e:for(var t=0;n>t;t++)for(;n>t;t++){for(var s=0;r>s;s++)if(a[t+s]!==e[s])continue e;return t}return-1}function addStringToPool(e,a){var r=findSubArray(e,a);if(0>r){r=a.length;for(var n=0,t=e.length;t>n;++n)a.push(e[n])}return r}function makeNameTable(e,a){var r,n=[],t={},s=reverseDict(nameTableNames);for(var m in e){var i=s[m];if(void 0===i&&(i=m),r=parseInt(i),isNaN(r))throw new Error('Name table entry "'+m+'" does not exist, see nameTableNames for complete list.');t[r]=e[m],n.push(r)}for(var c=reverseDict(macLanguages),o=reverseDict(windowsLanguages),u=[],l=[],g=0;gv&&(v=a.length,a.push(f)),x=4,b=encode.UTF16(p));var k=addStringToPool(b,l);u.push(makeNameRecord(h,x,v,r,b.length,k));var S=o[f];if(void 0!==S){var T=encode.UTF16(p),N=addStringToPool(T,l);u.push(makeNameRecord(3,1,S,r,T.length,N))}}}u.sort(function(e,a){return e.platformID-a.platformID||e.encodingID-a.encodingID||e.languageID-a.languageID||e.nameID-a.nameID});for(var U=new table.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:u.length},{name:"stringOffset",type:"USHORT",value:6+12*u.length}]),I=0;I=a.begin&&et;t++)a.panose[t]=i.parseByte();return a.ulUnicodeRange1=i.parseULong(),a.ulUnicodeRange2=i.parseULong(),a.ulUnicodeRange3=i.parseULong(),a.ulUnicodeRange4=i.parseULong(),a.achVendID=String.fromCharCode(i.parseByte(),i.parseByte(),i.parseByte(),i.parseByte()),a.fsSelection=i.parseUShort(),a.usFirstCharIndex=i.parseUShort(),a.usLastCharIndex=i.parseUShort(),a.sTypoAscender=i.parseShort(),a.sTypoDescender=i.parseShort(),a.sTypoLineGap=i.parseShort(),a.usWinAscent=i.parseUShort(),a.usWinDescent=i.parseUShort(),a.version>=1&&(a.ulCodePageRange1=i.parseULong(),a.ulCodePageRange2=i.parseULong()),a.version>=2&&(a.sxHeight=i.parseShort(),a.sCapHeight=i.parseShort(),a.usDefaultChar=i.parseUShort(),a.usBreakChar=i.parseUShort(),a.usMaxContent=i.parseUShort()),a}function makeOS2Table(e){return new table.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],e)}var parse=require("../parse"),table=require("../table"),unicodeRanges=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];exports.unicodeRanges=unicodeRanges,exports.getUnicodeRange=getUnicodeRange,exports.parse=parseOS2Table,exports.make=makeOS2Table; },{"../parse":10,"../table":13}],30:[function(require,module,exports){ "use strict";function parsePostTable(e,a){var r,n={},s=new parse.Parser(e,a);switch(n.version=s.parseVersion(),n.italicAngle=s.parseFixed(),n.underlinePosition=s.parseShort(),n.underlineThickness=s.parseShort(),n.isFixedPitch=s.parseULong(),n.minMemType42=s.parseULong(),n.maxMemType42=s.parseULong(),n.minMemType1=s.parseULong(),n.maxMemType1=s.parseULong(),n.version){case 1:n.names=encoding.standardNames.slice();break;case 2:for(n.numberOfGlyphs=s.parseUShort(),n.glyphNameIndex=new Array(n.numberOfGlyphs),r=0;r=encoding.standardNames.length){var p=s.parseChar();n.names.push(s.parseString(p))}break;case 2.5:for(n.numberOfGlyphs=s.parseUShort(),n.offset=new Array(n.numberOfGlyphs),r=0;ra.value.tag?1:-1}),a.fields=a.fields.concat(t),a.fields=a.fields.concat(r),a}function metricsForChar(e,a,n){for(var t=0;t0){var i=e.glyphs.get(r);return i.getMetrics()}}return n}function average(e){for(var a=0,n=0;nf||void 0===a)&&f>0&&(a=f),f>m&&(m=f);var v=os2.getUnicodeRange(f);if(32>v)h|=1<v)o|=1<v)c|=1<v))throw new Error("Unicode ranges bits > 123 are reserved for internal usage");d|=1<0?ltag.make(w):void 0,L=post.make(),A=cff.make(e.glyphs,{version:e.getEnglishName("version"),fullName:E,familyName:C,weightName:N,postScriptName:O,unitsPerEm:e.unitsPerEm,fontBBox:[0,x.yMin,x.ascender,x.advanceWidthMax]}),F=e.metas&&Object.keys(e.metas).length>0?meta.make(e.metas):void 0,G=[b,M,S,T,B,R,L,A,k];U&&G.push(U),e.tables.gsub&&G.push(gsub.make(e.tables.gsub)),F&&G.push(F);var D=makeSfntTable(G),H=D.encode(),P=computeCheckSum(H),I=D.fields,j=!1;for(g=0;g=0&&255>=e,"Byte value should be between 0 and 255."),[e]},sizeOf.BYTE=constant(1),encode.CHAR=function(e){return[e.charCodeAt(0)]},sizeOf.CHAR=constant(1),encode.CHARARRAY=function(e){for(var n=[],t=0;t>8&255,255&e]},sizeOf.USHORT=constant(2),encode.SHORT=function(e){return e>=LIMIT16&&(e=-(2*LIMIT16-e)),[e>>8&255,255&e]},sizeOf.SHORT=constant(2),encode.UINT24=function(e){return[e>>16&255,e>>8&255,255&e]},sizeOf.UINT24=constant(3),encode.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},sizeOf.ULONG=constant(4),encode.LONG=function(e){return e>=LIMIT32&&(e=-(2*LIMIT32-e)),[e>>24&255,e>>16&255,e>>8&255,255&e]},sizeOf.LONG=constant(4),encode.FIXED=encode.ULONG,sizeOf.FIXED=sizeOf.ULONG,encode.FWORD=encode.SHORT,sizeOf.FWORD=sizeOf.SHORT,encode.UFWORD=encode.USHORT,sizeOf.UFWORD=sizeOf.USHORT,encode.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,255&e]},sizeOf.LONGDATETIME=constant(8),encode.TAG=function(e){return check.argument(4===e.length,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},sizeOf.TAG=constant(4),encode.Card8=encode.BYTE,sizeOf.Card8=sizeOf.BYTE,encode.Card16=encode.USHORT,sizeOf.Card16=sizeOf.USHORT,encode.OffSize=encode.BYTE,sizeOf.OffSize=sizeOf.BYTE,encode.SID=encode.USHORT,sizeOf.SID=sizeOf.USHORT,encode.NUMBER=function(e){return e>=-107&&107>=e?[e+139]:e>=108&&1131>=e?(e-=108,[(e>>8)+247,255&e]):e>=-1131&&-108>=e?(e=-e-108,[(e>>8)+251,255&e]):e>=-32768&&32767>=e?encode.NUMBER16(e):encode.NUMBER32(e)},sizeOf.NUMBER=function(e){return encode.NUMBER(e).length},encode.NUMBER16=function(e){return[28,e>>8&255,255&e]},sizeOf.NUMBER16=constant(3),encode.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,255&e]},sizeOf.NUMBER32=constant(5),encode.REAL=function(e){var n=e.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(n);if(t){var o=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));n=(Math.round(e*o)/o).toString()}var c,r,i="";for(c=0,r=n.length;r>c;c+=1){var a=n[c];i+="e"===a?"-"===n[++c]?"c":"b":"."===a?"a":"-"===a?"e":a}i+=1&i.length?"f":"ff";var f=[30];for(c=0,r=i.length;r>c;c+=2)f.push(parseInt(i.substr(c,2),16));return f},sizeOf.REAL=function(e){return encode.REAL(e).length},encode.NAME=encode.CHARARRAY,sizeOf.NAME=sizeOf.CHARARRAY,encode.STRING=encode.CHARARRAY,sizeOf.STRING=sizeOf.CHARARRAY,decode.UTF8=function(e,n,t){for(var o=[],c=t,r=0;c>r;r++,n+=1)o[r]=e.getUint8(n);return String.fromCharCode.apply(null,o)},decode.UTF16=function(e,n,t){for(var o=[],c=t/2,r=0;c>r;r++,n+=2)o[r]=e.getUint16(n);return String.fromCharCode.apply(null,o)},encode.UTF16=function(e){for(var n=[],t=0;t>8&255,n[n.length]=255&o}return n},sizeOf.UTF16=function(e){return 2*e.length};var eightBitMacEncodings={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};decode.MACSTRING=function(e,n,t,o){var c=eightBitMacEncodings[o];if(void 0===c)return void 0;for(var r="",i=0;t>i;i++){var a=e.getUint8(n+i);r+=127>=a?String.fromCharCode(a):c[127&a]}return r};var macEncodingTableCache="function"==typeof WeakMap&&new WeakMap,macEncodingCacheKeys,getMacEncodingTable=function(e){if(!macEncodingCacheKeys){macEncodingCacheKeys={};for(var n in eightBitMacEncodings)macEncodingCacheKeys[n]=new String(n)}var t=macEncodingCacheKeys[e];if(void 0===t)return void 0;if(macEncodingTableCache){var o=macEncodingTableCache.get(t);if(void 0!==o)return o}var c=eightBitMacEncodings[e];if(void 0===c)return void 0;for(var r={},i=0;i=128&&(r=t[r],void 0===r))return void 0;o[c]=r}return o},sizeOf.MACSTRING=function(e,n){var t=encode.MACSTRING(e,n);return void 0!==t?t.length:0},encode.INDEX=function(e){var n,t=1,o=[t],c=[];for(n=0;nc;c+=1){var r=parseInt(t[c],0),i=e[r];n=n.concat(encode.OPERAND(i.value,i.type)),n=n.concat(encode.OPERATOR(r))}return n},sizeOf.DICT=function(e){return encode.DICT(e).length},encode.OPERATOR=function(e){return 1200>e?[e]:[12,e-1200]},encode.OPERAND=function(e,n){var t=[];if(Array.isArray(n))for(var o=0;oc;c+=1){var r=e[c];t=t.concat(encode[r.type](r.value))}return wmm&&wmm.set(e,t),t},sizeOf.CHARSTRING=function(e){return encode.CHARSTRING(e).length},encode.OBJECT=function(e){var n=encode[e.type];return check.argument(void 0!==n,"No encoding function for type "+e.type),n(e.value)},sizeOf.OBJECT=function(e){var n=sizeOf[e.type];return check.argument(void 0!==n,"No sizeOf function for type "+e.type),n(e.value)},encode.TABLE=function(e){var n,t=[],o=e.fields.length,c=[],r=[];for(n=0;o>n;n+=1){var i=e.fields[n],a=encode[i.type];check.argument(void 0!==a,"No encoding function for field type "+i.type+" ("+i.name+")");var f=e[i.name];void 0===f&&(f=i.value);var d=a(f);"TABLE"===i.type?(r.push(t.length),t=t.concat([0,0]),c.push(d)):t=t.concat(d)}for(n=0;ns,"Table "+e.tableName+" too big."),t[u]=s>>8,t[u+1]=255&s,t=t.concat(c[n])}return t},sizeOf.TABLE=function(e){for(var n=0,t=e.fields.length,o=0;t>o;o+=1){var c=e.fields[o],r=sizeOf[c.type];check.argument(void 0!==r,"No sizeOf function for field type "+c.type+" ("+c.name+")");var i=e[c.name];void 0===i&&(i=c.value),n+=r(i),"TABLE"===c.type&&(n+=2)}return n},encode.RECORD=encode.TABLE,sizeOf.RECORD=sizeOf.TABLE,encode.LITERAL=function(e){return e},sizeOf.LITERAL=function(e){return e.length},exports.decode=decode,exports.encode=encode,exports.sizeOf=sizeOf; },{"./check":2}],33:[function(require,module,exports){ "use strict";exports.isBrowser=function(){return"undefined"!=typeof window},exports.isNode=function(){return"undefined"==typeof window},exports.nodeBufferToArrayBuffer=function(r){for(var e=new ArrayBuffer(r.length),n=new Uint8Array(e),t=0;t