/*! fontificate.js - v0.0.1 - 2012-09-28 * https://github.com/samlecuyer/fontificate * Copyright (c) 2012 Sam L'Ecuyer; Licensed MIT */ (function(e,t,n){"use strict";function s(e){var t=e.boundingBox,n='=0){var n=t.getUint16Array(this.numberOfContours),r=t.getUint16();this.instructions=t.getUint8Array(r);var i=n[n.length-1]+1;this.flags=[];for(var s=0;s\n'+h+"\n"}}catch(p){console.log('error rendering "'+e[u]+'": '+p)}i+=c,r+=a.advanceWidth+f}i+='\n';var d=this.font.hhea.ascender-this.font.hhea.descender,v='\n'+i+"\n",m='\n'+v+"\n";return m}};var i={},u=["Copyright notice","Font family","Font subfamily","Subfamily identifier","Full name","Version","Postscript name","Trademark notice","Manufacturer name","Designer","Description","Vendor Url","Designer Url","License"],a=["Unicode","Macintosh",n,"Microsoft"],f=["Roman","Japansese","Traditional Chinese","Korean","Arabic","Hebrew","Greek","Russian","RSymbol","Devanagari","Gurmukhi","Gujarati","Oriya","Bengali","Tamil","Telugu","Kannada","Malayalam","Sinhalese","Burmese","Khmer","Thai","Laotian","Georgian","Armenian","Simplified Chinese","Tibetan","Mongolian","Geez","Slavic","Vietnamese","Sindhi"],l=["Default semantics","Version 1.1 semantics","ISO 10646 1993 semantics (deprecated)","Unicode 2.0 or later semantics"],c=[".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"],d={head:function(e){var t=h(e,"head"),n=e.stream;n.goto(t.offset);var r={};r.version=n.get32Fixed(),r.revision=n.get32Fixed(),r.checkSumAdjustment=n.getUint32(),r.magic=n.getUint32();if(r.magic!==1594834165)throw"Font header has incorrect magic number";r.flags=n.getUint16(),r.unitsPerEm=n.getUint16(),r.created=n.getInt64(),r.modified=n.getInt64(),r.xMin=n.getInt16(),r.yMin=n.getInt16(),r.xMax=n.getInt16(),r.yMax=n.getInt16(),r.macStyle=n.getUint16(),r.lowestRecPPEM=n.getUint16(),r.fontDirectionHint=n.getInt16(),r.indexToLocFormat=n.getInt16(),r.glyphDataFormat=n.getInt16(),e.head=Object.freeze(r)},name:function(e){var t=h(e,"name"),n=e.stream;n.goto(t.offset);var r={records:[]};r.version=n.getUint16();var i=n.getUint16(),s=n.getUint16();for(var o=0;o=258)for(s=0;s=258&&f<=32767))throw"Unknow glyph name: "+f;i[s]=l[f-258]}}}r.glyphNames=i,e.post=Object.freeze(r)},loca:function(e){var t=h(e,"loca"),n=e.stream;n.goto(t.offset);var r={},i=e.head.indexToLocFormat,s=e.maxp.numGlyphs;r.offsets=new Array(s+1);for(var o=0;o=0)return this.flags.length;var e=this;return this.components.reduce(function(t,n){var r=e.glyphs[n.glyphIndex];return t+n.glyph.getPointCount()},0)},getContourCount:function(){if(this.numberOfContours>=0)return this.numberOfContours;var e=this;return this.components.reduce(function(t,n){var r=e.glyphs[n.glyphIndex];return t+r.getContourCount()},0)},getSegmentedPoints:function(){var e=[],t=[],n=[];if(this.numberOfContours===1)e.push(this.xCoords),t.push(this.yCoords),n.push(this.flags);else if(this.numberOfContours>1){var r=0;for(var i in this.endPtsOfContours)e.push(this.xCoords.slice(r,this.endPtsOfContours[i]+1)),t.push(this.yCoords.slice(r,this.endPtsOfContours[i]+1)),n.push(this.flags.slice(r,this.endPtsOfContours[i]+1)),r=this.endPtsOfContours[i]+1}else if(this.numberOfContours===-1){var s=this;this.components.forEach(function(r){var i=s.glyphs[r.glyphIndex],o=i.getSegmentedPoints();for(var u=0;u=s.leftOffsetTable.firstGlyph&&(u=s.leftOffsetTable.offsets[e-s.leftOffsetTable.firstGlyph]);var a=0;t>=s.rightOffsetTable.firstGlyph&&(a=s.rightOffsetTable.offsets[t-s.rightOffsetTable.firstGlyph]);var f=u+a;return this.stream.goto(s.start+f),this.stream.getInt16();case 4:}}}return 0},stringToSVG:function(e,t){var n=new r("svg",this);return n.render(e,t)},getTextAsGlyphIds:function(e){var t=new Array(e.length);for(var n=0;n