-
Notifications
You must be signed in to change notification settings - Fork 0
/
font.min.js
1 lines (1 loc) · 997 Bytes
/
font.min.js
1
/* font.js - v1.0.0 */var Font=function(){function e(e,t){return function(){e.apply(t,arguments)}}function t(e,t){var s=new Image;s.onload=function(){t(i(r(n(this))))},s.src=e}function n(e){var t=document.createElement("canvas");t.height=256,t.width=256;var n=t.getContext("2d");return n.drawImage(e,0,0),n.getImageData(0,0,256,256).data}function r(e){var t=[];for(var n=0;n<e.length;n+=4)t[n/4]=e[n]/e[n];return t}function i(e){var t=[];for(var n=0;n<16;n++)for(var r=0;r<16;r++){var i=[];for(var s=0;s<12;s++){i.push([]);for(var o=0;o<6;o++)i[s].push(e[(n*16+s)*256+(r*16+o)])}t.push(i)}return t}return function(n,r){this.height=12,this.width=6,this.load=function(n,r){this.url=n,this.loaded=!1,t(n,e(function(e){this.loaded=!0,this._data=e,r&&typeof r=="function"&&r(this)},this))},this.get=function(e){if(!this.loaded)return!1;if(typeof e=="string")e=parseInt(e,16);else if(typeof e!="number")throw new Error("Invalid character id");return this._data[e]},this.loaded=!1,n&&this.load(n,r)}}();