ext/asciimo/lib/asciimo.js in asciimo-0.1.0 vs ext/asciimo/lib/asciimo.js in asciimo-0.2.0

- old
+ new

@@ -1,1685 +1,104 @@ -/* - asciimo.js - written by Marak Squires - saved from the internet @ http://patorjk.com/software/taag/ - - i had to do unholy things to make the original code work, seriously. - check the commit logs on github and you'll see how much "code" i had to delete and refactor. - what's left isnt really acceptable, but it does work. - - let's clean this up and get a more comprehensive font database! - - -- Marak -*/ - - -if(typeof exports != 'undefined'){ - - var fs = require('fs'); - var sys = require('sys'); - - exports.text = function(fontName, text, callback){ - fs.readFile('./fonts/' + fontName, function(err, contents){ - if(err){ - //sys.puts(err); - } - try{ - loadFont(contents.toString()); - } - catch(err){ - sys.puts(('couldnt load font file ' + fontName + ' not going to render your text')); - } - var font = createLargeText(text); - callback(font); - }); - }; -} - -/**** DRAGONS START HERE, be warned ******/ - -// MARAK SAYS : ughhh i think we have to setup the base state for this big fontChars array to work. -// i haven't figured out if we can just have the loadFont method handle this... -var fontChars = new Array(95); - -// char height -var charHeight = 7; - -// basic font info -var fontPointSize = 10; -var fontFace = "monospace"; - -// author's initials -var initials = ""; - -// font file type extension -var fontFileExt = "flf"; - -for (var i = 0; i < 95; i++) -{ - fontChars[i] = new Array(charHeight); -} - -// the first font gets hardcoded for some reason, the rest of the fonts are loaded async -// and loaded into memory with loadFont() -fontChars[0][0] = "$ $"; -fontChars[0][1] = "$ $"; -fontChars[0][2] = "$ $"; -fontChars[0][3] = "$ $"; -fontChars[0][4] = "$ $"; -fontChars[0][5] = "$ $"; -fontChars[0][6] = "$ $"; -fontChars[1][0] = " _ "; -fontChars[1][1] = "U|\"|u "; -fontChars[1][2] = "\\| |/ "; -fontChars[1][3] = " |_| "; -fontChars[1][4] = " (_) "; -fontChars[1][5] = " |||_ "; -fontChars[1][6] = "(__)_) "; -fontChars[2][0] = "\""; -fontChars[2][1] = " "; -fontChars[2][2] = " "; -fontChars[2][3] = " "; -fontChars[2][4] = " "; -fontChars[2][5] = " "; -fontChars[2][6] = " "; -fontChars[3][0] = ""; -fontChars[3][1] = " "; -fontChars[3][2] = " "; -fontChars[3][3] = " "; -fontChars[3][4] = " "; -fontChars[3][5] = " "; -fontChars[3][6] = " "; -fontChars[4][0] = "$"; -fontChars[4][1] = " "; -fontChars[4][2] = " "; -fontChars[4][3] = " "; -fontChars[4][4] = " "; -fontChars[4][5] = " "; -fontChars[4][6] = " "; -fontChars[5][0] = "%"; -fontChars[5][1] = " "; -fontChars[5][2] = " "; -fontChars[5][3] = " "; -fontChars[5][4] = " "; -fontChars[5][5] = " "; -fontChars[5][6] = " "; -fontChars[6][0] = "&"; -fontChars[6][1] = " "; -fontChars[6][2] = " "; -fontChars[6][3] = " "; -fontChars[6][4] = " "; -fontChars[6][5] = " "; -fontChars[6][6] = " "; -fontChars[7][0] = " _ "; -fontChars[7][1] = "|\"| "; -fontChars[7][2] = "|_| "; -fontChars[7][3] = " "; -fontChars[7][4] = " "; -fontChars[7][5] = " "; -fontChars[7][6] = " "; -fontChars[8][0] = "("; -fontChars[8][1] = " "; -fontChars[8][2] = " "; -fontChars[8][3] = " "; -fontChars[8][4] = " "; -fontChars[8][5] = " "; -fontChars[8][6] = " "; -fontChars[9][0] = ")"; -fontChars[9][1] = " "; -fontChars[9][2] = " "; -fontChars[9][3] = " "; -fontChars[9][4] = " "; -fontChars[9][5] = " "; -fontChars[9][6] = " "; -fontChars[10][0] = "*"; -fontChars[10][1] = " "; -fontChars[10][2] = " "; -fontChars[10][3] = " "; -fontChars[10][4] = " "; -fontChars[10][5] = " "; -fontChars[10][6] = " "; -fontChars[11][0] = "+"; -fontChars[11][1] = " "; -fontChars[11][2] = " "; -fontChars[11][3] = " "; -fontChars[11][4] = " "; -fontChars[11][5] = " "; -fontChars[11][6] = " "; -fontChars[12][0] = " "; -fontChars[12][1] = " "; -fontChars[12][2] = " "; -fontChars[12][3] = " "; -fontChars[12][4] = " _ "; -fontChars[12][5] = "(\") "; -fontChars[12][6] = " \\| "; -fontChars[13][0] = " "; -fontChars[13][1] = " "; -fontChars[13][2] = " U u "; -fontChars[13][3] = " /___\\ "; -fontChars[13][4] = "|__\"__| "; -fontChars[13][5] = " "; -fontChars[13][6] = " "; -fontChars[14][0] = " "; -fontChars[14][1] = " "; -fontChars[14][2] = " "; -fontChars[14][3] = " "; -fontChars[14][4] = " _ "; -fontChars[14][5] = "(\") "; -fontChars[14][6] = " \" "; -fontChars[15][0] = "/"; -fontChars[15][1] = " "; -fontChars[15][2] = " "; -fontChars[15][3] = " "; -fontChars[15][4] = " "; -fontChars[15][5] = " "; -fontChars[15][6] = " "; -fontChars[16][0] = " ___ "; -fontChars[16][1] = " / _\"\\ u "; -fontChars[16][2] = "| / U |/ "; -fontChars[16][3] = "| \\// |,-. "; -fontChars[16][4] = " \\___/(_/ "; -fontChars[16][5] = " // "; -fontChars[16][6] = " (__) "; -fontChars[17][0] = " _ "; -fontChars[17][1] = " /\"| "; -fontChars[17][2] = " u | |u "; -fontChars[17][3] = " \\| |/ "; -fontChars[17][4] = " |_| "; -fontChars[17][5] = " _//<,-, "; -fontChars[17][6] = "(__)(_/ "; -fontChars[18][0] = " ____ "; -fontChars[18][1] = " |___\"\\ "; -fontChars[18][2] = " U __) | "; -fontChars[18][3] = " \\/ __/ \\ "; -fontChars[18][4] = " |_____|u "; -fontChars[18][5] = " << // "; -fontChars[18][6] = "(__)(__) "; -fontChars[19][0] = " _____ "; -fontChars[19][1] = "|___\"/u "; -fontChars[19][2] = "U_|_ \\/ "; -fontChars[19][3] = " ___) | "; -fontChars[19][4] = "|____/ "; -fontChars[19][5] = " _// \\\\ "; -fontChars[19][6] = "(__)(__) "; -fontChars[20][0] = " _ _ "; -fontChars[20][1] = "| ||\"| "; -fontChars[20][2] = "| || |_ "; -fontChars[20][3] = "|__ _| "; -fontChars[20][4] = " /|_|\\ "; -fontChars[20][5] = " u_|||_u "; -fontChars[20][6] = " (__)__) "; -fontChars[21][0] = " ____ "; -fontChars[21][1] = "U|\"___|u "; -fontChars[21][2] = "\\|___ \\/ "; -fontChars[21][3] = " ___) | "; -fontChars[21][4] = " |____/ "; -fontChars[21][5] = ",-,>>\\,-. "; -fontChars[21][6] = " \\ ) (_/ "; -fontChars[22][0] = " __ "; -fontChars[22][1] = "U /\"/_ u "; -fontChars[22][2] = "\\| '_ \\/ "; -fontChars[22][3] = " | (_) | "; -fontChars[22][4] = " \\___/ "; -fontChars[22][5] = " _// \\\\_ "; -fontChars[22][6] = "(__) (__) "; -fontChars[23][0] = " _____ "; -fontChars[23][1] = " |___ \"| "; -fontChars[23][2] = " / / "; -fontChars[23][3] = " u// /\\ "; -fontChars[23][4] = " /_/ U "; -fontChars[23][5] = " <<>>_ "; -fontChars[23][6] = "(__)__) "; -fontChars[24][0] = " ___ "; -fontChars[24][1] = "U( \" ) u "; -fontChars[24][2] = "\\/ \\/ "; -fontChars[24][3] = "| ( ) | "; -fontChars[24][4] = " \\___/>> "; -fontChars[24][5] = " )( (__) "; -fontChars[24][6] = " (__) "; -fontChars[25][0] = " ___ "; -fontChars[25][1] = " / _\"\\ "; -fontChars[25][2] = " | (_) | "; -fontChars[25][3] = " /\\__, |\\ "; -fontChars[25][4] = "U<< |_/ u "; -fontChars[25][5] = "(__) )( "; -fontChars[25][6] = " (__) "; -fontChars[26][0] = " "; -fontChars[26][1] = " _ "; -fontChars[26][2] = "(\") "; -fontChars[26][3] = " "; -fontChars[26][4] = " _ "; -fontChars[26][5] = "(\") "; -fontChars[26][6] = " "; -fontChars[27][0] = ";"; -fontChars[27][1] = " "; -fontChars[27][2] = " "; -fontChars[27][3] = " "; -fontChars[27][4] = " "; -fontChars[27][5] = " "; -fontChars[27][6] = " "; -fontChars[28][0] = "<"; -fontChars[28][1] = " "; -fontChars[28][2] = " "; -fontChars[28][3] = " "; -fontChars[28][4] = " "; -fontChars[28][5] = " "; -fontChars[28][6] = " "; -fontChars[29][0] = "="; -fontChars[29][1] = " "; -fontChars[29][2] = " "; -fontChars[29][3] = " "; -fontChars[29][4] = " "; -fontChars[29][5] = " "; -fontChars[29][6] = " "; -fontChars[30][0] = ">"; -fontChars[30][1] = " "; -fontChars[30][2] = " "; -fontChars[30][3] = " "; -fontChars[30][4] = " "; -fontChars[30][5] = " "; -fontChars[30][6] = " "; -fontChars[31][0] = " ___ "; -fontChars[31][1] = " |__\"\\ "; -fontChars[31][2] = "U / /u "; -fontChars[31][3] = " \\|_|/ "; -fontChars[31][4] = " (_) "; -fontChars[31][5] = " _//\\,-. "; -fontChars[31][6] = "(__)( / "; -fontChars[32][0] = "@"; -fontChars[32][1] = " "; -fontChars[32][2] = " "; -fontChars[32][3] = " "; -fontChars[32][4] = " "; -fontChars[32][5] = " "; -fontChars[32][6] = " "; -fontChars[33][0] = " _ "; -fontChars[33][1] = "U /\"\\ u "; -fontChars[33][2] = " \\/ _ \\/ "; -fontChars[33][3] = " / ___ \\ "; -fontChars[33][4] = "/_/ \\_\\ "; -fontChars[33][5] = " \\\\ >> "; -fontChars[33][6] = "(__) (__) "; -fontChars[34][0] = " ____ "; -fontChars[34][1] = "U | __\")u "; -fontChars[34][2] = " \\| _ \\/ "; -fontChars[34][3] = " | |_) | "; -fontChars[34][4] = " |____/ "; -fontChars[34][5] = " _|| \\\\_ "; -fontChars[34][6] = "(__) (__) "; -fontChars[35][0] = " ____ "; -fontChars[35][1] = "U /\"___| "; -fontChars[35][2] = "\\| | u "; -fontChars[35][3] = " | |/__ "; -fontChars[35][4] = " \\____| "; -fontChars[35][5] = " _// \\\\ "; -fontChars[35][6] = "(__)(__) "; -fontChars[36][0] = " ____ "; -fontChars[36][1] = " | _\"\\ "; -fontChars[36][2] = "/| | | | "; -fontChars[36][3] = "U| |_| |\\ "; -fontChars[36][4] = " |____/ u "; -fontChars[36][5] = " |||_ "; -fontChars[36][6] = " (__)_) "; -fontChars[37][0] = "U _____ u "; -fontChars[37][1] = "\\| ___\"|/ "; -fontChars[37][2] = " | _|\" "; -fontChars[37][3] = " | |___ "; -fontChars[37][4] = " |_____| "; -fontChars[37][5] = " << >> "; -fontChars[37][6] = "(__) (__) "; -fontChars[38][0] = " _____ "; -fontChars[38][1] = " |\" ___| "; -fontChars[38][2] = "U| |_ u "; -fontChars[38][3] = "\\| _|/ "; -fontChars[38][4] = " |_| "; -fontChars[38][5] = " )(\\\\,- "; -fontChars[38][6] = "(__)(_/ "; -fontChars[39][0] = " ____ "; -fontChars[39][1] = "U /\"___|u "; -fontChars[39][2] = "\\| | _ / "; -fontChars[39][3] = " | |_| | "; -fontChars[39][4] = " \\____| "; -fontChars[39][5] = " _)(|_ "; -fontChars[39][6] = " (__)__) "; -fontChars[40][0] = " _ _ "; -fontChars[40][1] = " |'| |'| "; -fontChars[40][2] = "/| |_| |\\ "; -fontChars[40][3] = "U| _ |u "; -fontChars[40][4] = " |_| |_| "; -fontChars[40][5] = " // \\\\ "; -fontChars[40][6] = "(_\") (\"_) "; -fontChars[41][0] = " "; -fontChars[41][1] = " ___ "; -fontChars[41][2] = " |_\"_| "; -fontChars[41][3] = " | | "; -fontChars[41][4] = " U/| |\\u "; -fontChars[41][5] = ".-,_|___|_,-. "; -fontChars[41][6] = " \\_)-' '-(_/ "; -fontChars[42][0] = " _ "; -fontChars[42][1] = " U |\"| u "; -fontChars[42][2] = " _ \\| |/ "; -fontChars[42][3] = "| |_| |_,-. "; -fontChars[42][4] = " \\___/-(_/ "; -fontChars[42][5] = " _// "; -fontChars[42][6] = " (__) "; -fontChars[43][0] = " _ __ "; -fontChars[43][1] = " |\"|/ / "; -fontChars[43][2] = " | ' / "; -fontChars[43][3] = "U/| . \\\\u "; -fontChars[43][4] = " |_|\\_\\ "; -fontChars[43][5] = ",-,>> \\\\,-. "; -fontChars[43][6] = " \\.) (_/ "; -fontChars[44][0] = " _ "; -fontChars[44][1] = " |\"| "; -fontChars[44][2] = "U | | u "; -fontChars[44][3] = " \\| |/__ "; -fontChars[44][4] = " |_____| "; -fontChars[44][5] = " // \\\\ "; -fontChars[44][6] = " (_\")(\"_) "; -fontChars[45][0] = " __ __ "; -fontChars[45][1] = "U|' \\/ '|u "; -fontChars[45][2] = "\\| |\\/| |/ "; -fontChars[45][3] = " | | | | "; -fontChars[45][4] = " |_| |_| "; -fontChars[45][5] = "<<,-,,-. "; -fontChars[45][6] = " (./ \\.) "; -fontChars[46][0] = " _ _ "; -fontChars[46][1] = " | \\ |\"| "; -fontChars[46][2] = "<| \\| |> "; -fontChars[46][3] = "U| |\\ |u "; -fontChars[46][4] = " |_| \\_| "; -fontChars[46][5] = " || \\\\,-. "; -fontChars[46][6] = " (_\") (_/ "; -fontChars[47][0] = " U ___ u "; -fontChars[47][1] = " \\/\"_ \\/ "; -fontChars[47][2] = " | | | | "; -fontChars[47][3] = ".-,_| |_| | "; -fontChars[47][4] = " \\_)-\\___/ "; -fontChars[47][5] = " \\\\ "; -fontChars[47][6] = " (__) "; -fontChars[48][0] = " ____ "; -fontChars[48][1] = "U| _\"\\ u "; -fontChars[48][2] = "\\| |_) |/ "; -fontChars[48][3] = " | __/ "; -fontChars[48][4] = " |_| "; -fontChars[48][5] = " ||>>_ "; -fontChars[48][6] = "(__)__) "; -fontChars[49][0] = " ___ "; -fontChars[49][1] = " / \" \\ "; -fontChars[49][2] = " | |\"| | "; -fontChars[49][3] = "/| |_| |\\ "; -fontChars[49][4] = "U \\__\\_\\u "; -fontChars[49][5] = " \\\\// "; -fontChars[49][6] = " (_(__) "; -fontChars[50][0] = " ____ "; -fontChars[50][1] = "U | _\"\\ u "; -fontChars[50][2] = " \\| |_) |/ "; -fontChars[50][3] = " | _ < "; -fontChars[50][4] = " |_| \\_\\ "; -fontChars[50][5] = " // \\\\_ "; -fontChars[50][6] = " (__) (__) "; -fontChars[51][0] = " ____ "; -fontChars[51][1] = " / __\"| u "; -fontChars[51][2] = "<\\___ \\/ "; -fontChars[51][3] = " u___) | "; -fontChars[51][4] = " |____/>> "; -fontChars[51][5] = " )( (__) "; -fontChars[51][6] = " (__) "; -fontChars[52][0] = " _____ "; -fontChars[52][1] = " |_ \" _| "; -fontChars[52][2] = " | | "; -fontChars[52][3] = " /| |\\ "; -fontChars[52][4] = " u |_|U "; -fontChars[52][5] = " _// \\\\_ "; -fontChars[52][6] = "(__) (__) "; -fontChars[53][0] = " _ _ "; -fontChars[53][1] = "U |\"|u| | "; -fontChars[53][2] = " \\| |\\| | "; -fontChars[53][3] = " | |_| | "; -fontChars[53][4] = " <<\\___/ "; -fontChars[53][5] = "(__) )( "; -fontChars[53][6] = " (__) "; -fontChars[54][0] = " __ __ "; -fontChars[54][1] = " \\ \\ /\"/u "; -fontChars[54][2] = " \\ \\ / // "; -fontChars[54][3] = " /\\ V /_,-. "; -fontChars[54][4] = " U \\_/-(_/ "; -fontChars[54][5] = " // "; -fontChars[54][6] = " (__) "; -fontChars[55][0] = " "; -fontChars[55][1] = " __ __ "; -fontChars[55][2] = " \\\"\\ /\"/ "; -fontChars[55][3] = " /\\ \\ /\\ / /\\ "; -fontChars[55][4] = "U \\ V V / U"; -fontChars[55][5] = ".-,_\\ /\\ /_,-."; -fontChars[55][6] = " \\_)-' '-(_/ "; -fontChars[56][0] = " __ __ "; -fontChars[56][1] = " \\ \\/\"/ "; -fontChars[56][2] = " /\\ /\\ "; -fontChars[56][3] = " U / \\ u "; -fontChars[56][4] = " /_/\\_\\ "; -fontChars[56][5] = ",-,>> \\\\_ "; -fontChars[56][6] = " \\_) (__) "; -fontChars[57][0] = " __ __ "; -fontChars[57][1] = " \\ \\ / / "; -fontChars[57][2] = " \\ V / "; -fontChars[57][3] = " U_|\"|_u "; -fontChars[57][4] = " |_| "; -fontChars[57][5] = ".-,//|(_ "; -fontChars[57][6] = " \\_) (__) "; -fontChars[58][0] = " _____ "; -fontChars[58][1] = " |\"_ /u "; -fontChars[58][2] = " U / // "; -fontChars[58][3] = " \\/ /_ "; -fontChars[58][4] = " /____| "; -fontChars[58][5] = " _//<<,- "; -fontChars[58][6] = "(__) (_/ "; -fontChars[59][0] = "["; -fontChars[59][1] = " "; -fontChars[59][2] = " "; -fontChars[59][3] = " "; -fontChars[59][4] = " "; -fontChars[59][5] = " "; -fontChars[59][6] = " "; -fontChars[60][0] = "\\"; -fontChars[60][1] = " "; -fontChars[60][2] = " "; -fontChars[60][3] = " "; -fontChars[60][4] = " "; -fontChars[60][5] = " "; -fontChars[60][6] = " "; -fontChars[61][0] = "]"; -fontChars[61][1] = " "; -fontChars[61][2] = " "; -fontChars[61][3] = " "; -fontChars[61][4] = " "; -fontChars[61][5] = " "; -fontChars[61][6] = " "; -fontChars[62][0] = "U _ u "; -fontChars[62][1] = "\\/\"\\/ "; -fontChars[62][2] = "|/`\\| "; -fontChars[62][3] = " "; -fontChars[62][4] = " "; -fontChars[62][5] = " "; -fontChars[62][6] = " "; -fontChars[63][0] = "_"; -fontChars[63][1] = " "; -fontChars[63][2] = " "; -fontChars[63][3] = " "; -fontChars[63][4] = " "; -fontChars[63][5] = " "; -fontChars[63][6] = " "; -fontChars[64][0] = " ___ "; -fontChars[64][1] = "(\" / "; -fontChars[64][2] = " )/ "; -fontChars[64][3] = " "; -fontChars[64][4] = " "; -fontChars[64][5] = " "; -fontChars[64][6] = " "; -fontChars[65][0] = " _ "; -fontChars[65][1] = "U /\"\\ u "; -fontChars[65][2] = " \\/ _ \\/ "; -fontChars[65][3] = " / ___ \\ "; -fontChars[65][4] = "/_/ \\_\\ "; -fontChars[65][5] = " \\\\ >> "; -fontChars[65][6] = "(__) (__) "; -fontChars[66][0] = " ____ "; -fontChars[66][1] = "U | __\")u "; -fontChars[66][2] = " \\| _ \\/ "; -fontChars[66][3] = " | |_) | "; -fontChars[66][4] = " |____/ "; -fontChars[66][5] = " _|| \\\\_ "; -fontChars[66][6] = "(__) (__) "; -fontChars[67][0] = " ____ "; -fontChars[67][1] = "U /\"___| "; -fontChars[67][2] = "\\| | u "; -fontChars[67][3] = " | |/__ "; -fontChars[67][4] = " \\____| "; -fontChars[67][5] = " _// \\\\ "; -fontChars[67][6] = "(__)(__) "; -fontChars[68][0] = " ____ "; -fontChars[68][1] = " | _\"\\ "; -fontChars[68][2] = "/| | | | "; -fontChars[68][3] = "U| |_| |\\ "; -fontChars[68][4] = " |____/ u "; -fontChars[68][5] = " |||_ "; -fontChars[68][6] = " (__)_) "; -fontChars[69][0] = "U _____ u "; -fontChars[69][1] = "\\| ___\"|/ "; -fontChars[69][2] = " | _|\" "; -fontChars[69][3] = " | |___ "; -fontChars[69][4] = " |_____| "; -fontChars[69][5] = " << >> "; -fontChars[69][6] = "(__) (__) "; -fontChars[70][0] = " _____ "; -fontChars[70][1] = " |\" ___| "; -fontChars[70][2] = "U| |_ u "; -fontChars[70][3] = "\\| _|/ "; -fontChars[70][4] = " |_| "; -fontChars[70][5] = " )(\\\\,- "; -fontChars[70][6] = "(__)(_/ "; -fontChars[71][0] = " ____ "; -fontChars[71][1] = "U /\"___|u "; -fontChars[71][2] = "\\| | _ / "; -fontChars[71][3] = " | |_| | "; -fontChars[71][4] = " \\____| "; -fontChars[71][5] = " _)(|_ "; -fontChars[71][6] = " (__)__) "; -fontChars[72][0] = " _ _ "; -fontChars[72][1] = " |'| |'| "; -fontChars[72][2] = "/| |_| |\\ "; -fontChars[72][3] = "U| _ |u "; -fontChars[72][4] = " |_| |_| "; -fontChars[72][5] = " // \\\\ "; -fontChars[72][6] = "(_\") (\"_) "; -fontChars[73][0] = " "; -fontChars[73][1] = " ___ "; -fontChars[73][2] = " |_\"_| "; -fontChars[73][3] = " | | "; -fontChars[73][4] = " U/| |\\u "; -fontChars[73][5] = ".-,_|___|_,-. "; -fontChars[73][6] = " \\_)-' '-(_/ "; -fontChars[74][0] = " _ "; -fontChars[74][1] = " U |\"| u "; -fontChars[74][2] = " _ \\| |/ "; -fontChars[74][3] = "| |_| |_,-. "; -fontChars[74][4] = " \\___/-(_/ "; -fontChars[74][5] = " _// "; -fontChars[74][6] = " (__) "; -fontChars[75][0] = " _ __ "; -fontChars[75][1] = " |\"|/ / "; -fontChars[75][2] = " | ' / "; -fontChars[75][3] = "U/| . \\\\u "; -fontChars[75][4] = " |_|\\_\\ "; -fontChars[75][5] = ",-,>> \\\\,-. "; -fontChars[75][6] = " \\.) (_/ "; -fontChars[76][0] = " _ "; -fontChars[76][1] = " |\"| "; -fontChars[76][2] = "U | | u "; -fontChars[76][3] = " \\| |/__ "; -fontChars[76][4] = " |_____| "; -fontChars[76][5] = " // \\\\ "; -fontChars[76][6] = " (_\")(\"_) "; -fontChars[77][0] = " __ __ "; -fontChars[77][1] = "U|' \\/ '|u "; -fontChars[77][2] = "\\| |\\/| |/ "; -fontChars[77][3] = " | | | | "; -fontChars[77][4] = " |_| |_| "; -fontChars[77][5] = "<<,-,,-. "; -fontChars[77][6] = " (./ \\.) "; -fontChars[78][0] = " _ _ "; -fontChars[78][1] = " | \\ |\"| "; -fontChars[78][2] = "<| \\| |> "; -fontChars[78][3] = "U| |\\ |u "; -fontChars[78][4] = " |_| \\_| "; -fontChars[78][5] = " || \\\\,-. "; -fontChars[78][6] = " (_\") (_/ "; -fontChars[79][0] = " U ___ u "; -fontChars[79][1] = " \\/\"_ \\/ "; -fontChars[79][2] = " | | | | "; -fontChars[79][3] = ".-,_| |_| | "; -fontChars[79][4] = " \\_)-\\___/ "; -fontChars[79][5] = " \\\\ "; -fontChars[79][6] = " (__) "; -fontChars[80][0] = " ____ "; -fontChars[80][1] = "U| _\"\\ u "; -fontChars[80][2] = "\\| |_) |/ "; -fontChars[80][3] = " | __/ "; -fontChars[80][4] = " |_| "; -fontChars[80][5] = " ||>>_ "; -fontChars[80][6] = "(__)__) "; -fontChars[81][0] = " ___ "; -fontChars[81][1] = " / \" \\ "; -fontChars[81][2] = " | |\"| | "; -fontChars[81][3] = "/| |_| |\\ "; -fontChars[81][4] = "U \\__\\_\\u "; -fontChars[81][5] = " \\\\// "; -fontChars[81][6] = " (_(__) "; -fontChars[82][0] = " ____ "; -fontChars[82][1] = "U | _\"\\ u "; -fontChars[82][2] = " \\| |_) |/ "; -fontChars[82][3] = " | _ < "; -fontChars[82][4] = " |_| \\_\\ "; -fontChars[82][5] = " // \\\\_ "; -fontChars[82][6] = " (__) (__) "; -fontChars[83][0] = " ____ "; -fontChars[83][1] = " / __\"| u "; -fontChars[83][2] = "<\\___ \\/ "; -fontChars[83][3] = " u___) | "; -fontChars[83][4] = " |____/>> "; -fontChars[83][5] = " )( (__) "; -fontChars[83][6] = " (__) "; -fontChars[84][0] = " _____ "; -fontChars[84][1] = " |_ \" _| "; -fontChars[84][2] = " | | "; -fontChars[84][3] = " /| |\\ "; -fontChars[84][4] = " u |_|U "; -fontChars[84][5] = " _// \\\\_ "; -fontChars[84][6] = "(__) (__) "; -fontChars[85][0] = " _ _ "; -fontChars[85][1] = "U |\"|u| | "; -fontChars[85][2] = " \\| |\\| | "; -fontChars[85][3] = " | |_| | "; -fontChars[85][4] = " <<\\___/ "; -fontChars[85][5] = "(__) )( "; -fontChars[85][6] = " (__) "; -fontChars[86][0] = " __ __ "; -fontChars[86][1] = " \\ \\ /\"/u "; -fontChars[86][2] = " \\ \\ / // "; -fontChars[86][3] = " /\\ V /_,-. "; -fontChars[86][4] = " U \\_/-(_/ "; -fontChars[86][5] = " // "; -fontChars[86][6] = " (__) "; -fontChars[87][0] = " "; -fontChars[87][1] = " __ __ "; -fontChars[87][2] = " \\\"\\ /\"/ "; -fontChars[87][3] = " /\\ \\ /\\ / /\\ "; -fontChars[87][4] = "U \\ V V / U"; -fontChars[87][5] = ".-,_\\ /\\ /_,-."; -fontChars[87][6] = " \\_)-' '-(_/ "; -fontChars[88][0] = " __ __ "; -fontChars[88][1] = " \\ \\/\"/ "; -fontChars[88][2] = " /\\ /\\ "; -fontChars[88][3] = " U / \\ u "; -fontChars[88][4] = " /_/\\_\\ "; -fontChars[88][5] = ",-,>> \\\\_ "; -fontChars[88][6] = " \\_) (__) "; -fontChars[89][0] = " __ __ "; -fontChars[89][1] = " \\ \\ / / "; -fontChars[89][2] = " \\ V / "; -fontChars[89][3] = " U_|\"|_u "; -fontChars[89][4] = " |_| "; -fontChars[89][5] = ".-,//|(_ "; -fontChars[89][6] = " \\_) (__) "; -fontChars[90][0] = " _____ "; -fontChars[90][1] = " |\"_ /u "; -fontChars[90][2] = " U / // "; -fontChars[90][3] = " \\/ /_ "; -fontChars[90][4] = " /____| "; -fontChars[90][5] = " _//<<,- "; -fontChars[90][6] = "(__) (_/ "; -fontChars[91][0] = " __ "; -fontChars[91][1] = "u /\"/U "; -fontChars[91][2] = " \\| |/ "; -fontChars[91][3] = " < < "; -fontChars[91][4] = " | | "; -fontChars[91][5] = " <<\\_\\ "; -fontChars[91][6] = "(__)_) "; -fontChars[92][0] = "|"; -fontChars[92][1] = " "; -fontChars[92][2] = " "; -fontChars[92][3] = " "; -fontChars[92][4] = " "; -fontChars[92][5] = " "; -fontChars[92][6] = " "; -fontChars[93][0] = "__ "; -fontChars[93][1] = "\\\"\\ u "; -fontChars[93][2] = " | |/ "; -fontChars[93][3] = "/ > > "; -fontChars[93][4] = "U| | "; -fontChars[93][5] = "/_/>>_ "; -fontChars[93][6] = " (_(__) "; -fontChars[94][0] = "~"; -fontChars[94][1] = " "; -fontChars[94][2] = " "; -fontChars[94][3] = " "; -fontChars[94][4] = " "; -fontChars[94][5] = " "; -fontChars[94][6] = " "; - -// this variable lets us know the last page the user clicked -// this is useful when changing colors of the display (background / text color) - -// 0 = output page -// 1 = author page -// 2 = test all page - - -function convert_to_boolean(str) -{ - var ret = false; - if (str == "true") - { - ret = true; - } - return ret; -} - - -function loadFont(fontText) -{ - - var retData =fontText; - var retArray = retData.split("\n"); - - var retIndex = 0; - - theFontName = retArray[retIndex++]; - - fontFileExt = retArray[retIndex++]; - fontPointSize = retArray[retIndex++]; - fontFace = retArray[retIndex++]; - initials = retArray[retIndex++]; - hardblank = retArray[retIndex++]; - printDirection = retArray[retIndex++]; - hFullWidth = convert_to_boolean(retArray[retIndex++]); - hFitting = convert_to_boolean(retArray[retIndex++]); - hSmush1 = convert_to_boolean(retArray[retIndex++]); - hSmush2 = convert_to_boolean(retArray[retIndex++]); - hSmush3 = convert_to_boolean(retArray[retIndex++]); - hSmush4 = convert_to_boolean(retArray[retIndex++]); - hSmush5 = convert_to_boolean(retArray[retIndex++]); - hSmush6 = convert_to_boolean(retArray[retIndex++]); - var numChars = retArray[retIndex++]; - charHeight = retArray[retIndex++]; - - //alert(hFitting + "," + hFullWidth + "," + hSmush1 + "," + hSmush2 + "," + hSmush3); - //alert(fontFileExt + "," + fontPointSize + "," +fontFace + "," + initials + "," + hardblank); - - fontChars = null; - fontChars = new Array(numChars); - - for (var i = 0; i < numChars; i++) - { - fontChars[i] = new Array(charHeight); - } - - var inLoop = 0; - - for (i = 0; i < numChars; i++) - { - for (var i2 = 0; i2 < charHeight; i2++) - { - if ( fontFileExt == "aol" ) - { - fontChars[i][i2] = text_decode(retArray[retIndex]); - } - else - { - fontChars[i][i2] = retArray[retIndex]; - } - - // replace escape sequences - fontChars[i][i2] = fontChars[i][i2].replace(/</g, "<"); - fontChars[i][i2] = fontChars[i][i2].replace(/>/g, ">"); - fontChars[i][i2] = fontChars[i][i2].replace(/\\"/g, "\""); - fontChars[i][i2] = fontChars[i][i2].replace(/\\\\/g, "\\"); - retIndex++; - - inLoop++; - } - } - - // the author's comments - authorComments = ""; - for (var i2 = retIndex; i2 < retArray.length; i2++) - { - authorComments = authorComments + retArray[i2] + "\n"; - } - authorComments = authorComments.replace(/\\"/g, "\""); - authorComments = authorComments.replace(/\\\\/g, "\\"); - - // MARAK SAYS : this should be moot now that we have some real seperation of concerns and control flow, fucking legacy code - //generateText(document.fontSettings.inputText.value); - - curFontName = theFontName; -} - - - - - - -var defaultHorizontalSmush = true; - -var hFullWidth = false; -var hUnivSmush = false; -var hFitting = false; -var hSmush1 = true; -var hSmush2 = false; -var hSmush3 = false; -var hSmush4 = false; -var hSmush5 = false; -var hSmush6 = false; - -var vFullWidth = true; -var vUnivSmush = false; -var vFitting = false; -var vSmush1 = false; -var vSmush2 = false; -var vSmush3 = false; -var vSmush4 = false; -var vSmush5 = false; -var hardblank = "$"; - -var printDirection = 0; - -var authorComments = "Author : Myflix<br/>Date : 2003/10/18 21:37:14<br/>Version: 1.0<br/>-------------------------------------------------<br/><br/>-------------------------------------------------<br/>This font has been created using JavE's FIGlet font export assistant.<br/>Have a look at: http://www.jave.de<br/><br/>Permission is hereby given to modify this font, as long as the<br/>modifier's name is placed on a comment line.<br/><br/>---<br/><br/>Font modified June 17, 2007 by patorjk <br/>This was to widen the space character.<br/>"; - - - -// trims the whites spaces in front and in back of the string -String.prototype.trim = function() -{ - return this.replace(/^\s+|\s+$/g, ''); -} - -String.prototype.urlsToHyperlinks = function() -{ - return this.replace(/\bhttp:[^ \)\n\<,]+/g, "<a href='$&' target='_new'>$&</a>"); -} - -// reverses a string -String.prototype.reverse = function() -{ - var ret = ""; - for (var i = 0; i <= this.length; i++) - { - ret = this.charAt(i) + ret; - } - return ret; -} - -var fL = []; -var ii = 0; - -// font count: 318 - -fL[ii++] = "1Row.flf"; -fL[ii++] = "3-D.flf"; -fL[ii++] = "3D Diagonal.flf"; -fL[ii++] = "3x5.flf"; -fL[ii++] = "4Max.flf"; -fL[ii++] = "5 Line Oblique.flf"; - -fL[ii++] = "AMC 3 Line.flf"; -fL[ii++] = "AMC 3 Liv1.flf"; -fL[ii++] = "AMC AAA01.flf"; -fL[ii++] = "AMC Neko.flf"; -fL[ii++] = "AMC Razor.flf"; -fL[ii++] = "AMC Razor2.flf"; -fL[ii++] = "AMC Slash.flf"; -fL[ii++] = "AMC Slider.flf"; -fL[ii++] = "AMC Thin.flf"; -fL[ii++] = "AMC Tubes.flf"; -fL[ii++] = "AMC Untitled.flf"; -fL[ii++] = "ASCII New Roman.flf"; -fL[ii++] = "Abraxis-Big.aol"; -fL[ii++] = "Abraxis-Small.aol"; -fL[ii++] = "Acrobatic.flf"; -fL[ii++] = "Alligator.flf"; -fL[ii++] = "Alligator2.flf"; -fL[ii++] = "Alpha.flf"; -fL[ii++] = "Alphabet.flf"; -fL[ii++] = "Arrows.flf"; -fL[ii++] = "Avatar.flf"; - -fL[ii++] = "B1FF.flf"; -fL[ii++] = "Banner.flf"; -fL[ii++] = "Banner3-D.flf"; -fL[ii++] = "Banner3.flf"; -fL[ii++] = "Banner4.flf"; -fL[ii++] = "Barbwire.flf"; -fL[ii++] = "Basic.flf"; -fL[ii++] = "Bear.flf"; -fL[ii++] = "Bell.flf"; -fL[ii++] = "Benjamin.flf"; -fL[ii++] = "Bent.aol"; -fL[ii++] = "Big Chief.flf"; -fL[ii++] = "Big Money-ne.flf"; -fL[ii++] = "Big Money-nw.flf"; -fL[ii++] = "Big Money-se.flf"; -fL[ii++] = "Big Money-sw.flf"; -fL[ii++] = "Big.flf"; -fL[ii++] = "Bigfig.flf"; -fL[ii++] = "Binary.flf"; -fL[ii++] = "Blest.aol"; -fL[ii++] = "Block.flf"; -fL[ii++] = "Blocks.flf"; -fL[ii++] = "Boie.aol"; -fL[ii++] = "Boie2.aol"; -fL[ii++] = "Bolger.flf"; -fL[ii++] = "Bone's Font.aol"; -fL[ii++] = "Braced.flf"; -fL[ii++] = "Bright.flf"; -fL[ii++] = "Broadway KB.flf"; -fL[ii++] = "Broadway.flf"; -fL[ii++] = "Bubble.flf"; -fL[ii++] = "Bulbhead.flf"; - -fL[ii++] = "CaMiZ.aol"; -fL[ii++] = "Caligraphy.flf"; -fL[ii++] = "Caligraphy2.flf"; -fL[ii++] = "Cards.flf"; -fL[ii++] = "Catwalk.flf"; -fL[ii++] = "CeA.aol"; -fL[ii++] = "CeA2.aol"; -fL[ii++] = "Cheese.aol"; -fL[ii++] = "Chiseled.flf"; -fL[ii++] = "Chunky.flf"; -fL[ii++] = "Coinstak.flf"; -fL[ii++] = "Cola.flf"; -fL[ii++] = "Colossal.flf"; -fL[ii++] = "Computer.flf"; -fL[ii++] = "Contessa.flf"; -fL[ii++] = "Contrast.flf"; -fL[ii++] = "Cosmike.flf"; -fL[ii++] = "Crawford.flf"; -fL[ii++] = "Crawford2.flf"; -fL[ii++] = "Crazy.flf"; -fL[ii++] = "Cricket.flf"; -fL[ii++] = "Cursive.flf"; -fL[ii++] = "Cyberlarge.flf"; -fL[ii++] = "Cybermedium.flf"; -fL[ii++] = "Cybersmall.flf"; -fL[ii++] = "Cygnet.flf"; - -fL[ii++] = "DANC4.flf"; -fL[ii++] = "DWhistled.flf"; -fL[ii++] = "DaiR.aol"; -fL[ii++] = "Dancing Font.flf"; -fL[ii++] = "Decimal.flf"; -fL[ii++] = "Def Leppard.flf"; -fL[ii++] = "Diamond.flf"; -fL[ii++] = "Diet Cola.flf"; -fL[ii++] = "Digital.flf"; -fL[ii++] = "Doh.flf"; -fL[ii++] = "Doom.flf"; -fL[ii++] = "Dot Matrix.flf"; -fL[ii++] = "Double Shorts.flf"; -fL[ii++] = "Double.flf"; -fL[ii++] = "Dr Pepper.flf"; - -fL[ii++] = "Efti Chess.flf"; -fL[ii++] = "Efti Font.flf"; -fL[ii++] = "Efti Italic.flf"; -fL[ii++] = "Efti Piti.flf"; -fL[ii++] = "Efti Robot.flf"; -fL[ii++] = "Efti Wall.flf"; -fL[ii++] = "Efti Water.flf"; -fL[ii++] = "Epic.flf"; - -fL[ii++] = "Fender.flf"; - -fL[ii++] = "Filter.flf"; -fL[ii++] = "Filth.aol"; -fL[ii++] = "Fire Font-k.flf"; -fL[ii++] = "Fire Font-s.flf"; -fL[ii++] = "Flipped.flf"; -fL[ii++] = "Flower Power.flf"; -fL[ii++] = "FoGG.aol"; -fL[ii++] = "Four Tops.flf"; -fL[ii++] = "Fraktur.flf"; -fL[ii++] = "Fun Face.flf"; -fL[ii++] = "Fun Faces.flf"; -fL[ii++] = "Fuzzy.flf"; - -fL[ii++] = "Galactus.aol"; -fL[ii++] = "Georgi16.flf"; -fL[ii++] = "Georgia11.flf"; -fL[ii++] = "Ghost.flf"; -fL[ii++] = "Ghoulish.flf"; -fL[ii++] = "Glenyn.flf"; -fL[ii++] = "Glue.aol"; -fL[ii++] = "Goofy.flf"; -fL[ii++] = "Gothic.flf"; -fL[ii++] = "Graceful.flf"; -fL[ii++] = "Gradient.flf"; -fL[ii++] = "Graffiti.flf"; -fL[ii++] = "Greek.flf"; - -fL[ii++] = "HeX's Font.aol"; -fL[ii++] = "Heart Left.flf"; -fL[ii++] = "Heart Right.flf"; -fL[ii++] = "Hellfire.aol"; -fL[ii++] = "Henry 3D.flf"; -fL[ii++] = "Hex.flf"; -fL[ii++] = "Hieroglyphs.flf"; -fL[ii++] = "Hollywood.flf"; -fL[ii++] = "Horizontal Left.flf"; -fL[ii++] = "Horizontal Right.flf"; - -fL[ii++] = "ICL-1900.flf"; -fL[ii++] = "Impossible.flf"; -fL[ii++] = "Invita.flf"; -fL[ii++] = "Isometric1.flf"; -fL[ii++] = "Isometric2.flf"; -fL[ii++] = "Isometric3.flf"; -fL[ii++] = "Isometric4.flf"; -fL[ii++] = "Italic.flf"; -fL[ii++] = "Ivrit.flf"; -fL[ii++] = "JS Block Letters.flf"; -fL[ii++] = "JS Bracket Letters.flf"; -fL[ii++] = "JS Capital Curves.flf"; -fL[ii++] = "JS Cursive.flf"; -fL[ii++] = "JS Stick Letters.flf"; -fL[ii++] = "Jacky.flf"; -fL[ii++] = "Jazmine.flf"; -fL[ii++] = "Jerusalem.flf"; - -fL[ii++] = "Katakana.flf"; -fL[ii++] = "Kban.flf"; -fL[ii++] = "Keyboard.flf"; -fL[ii++] = "Knob.flf"; -fL[ii++] = "Konto Slant.flf"; -fL[ii++] = "Konto.flf"; -fL[ii++] = "LCD.flf"; -fL[ii++] = "Larry 3D.flf"; -fL[ii++] = "Lean.flf"; -fL[ii++] = "Letters.flf"; -fL[ii++] = "Lil Devil.flf"; -fL[ii++] = "Line Blocks.flf"; -fL[ii++] = "Linux.flf"; -fL[ii++] = "Lockergnome.flf"; - -fL[ii++] = "Madrid.flf"; -fL[ii++] = "Marquee.flf"; -fL[ii++] = "Maxfour.flf"; -fL[ii++] = "MeDi.aol"; -fL[ii++] = "Mer.aol"; -fL[ii++] = "Merlin1.flf"; -fL[ii++] = "Merlin2.flf"; -fL[ii++] = "Mike.flf"; -fL[ii++] = "Mini.flf"; -fL[ii++] = "Mirror.flf"; -fL[ii++] = "Mnemonic.flf"; -fL[ii++] = "Modular.flf"; -fL[ii++] = "Morse.flf"; -fL[ii++] = "Morse2.flf"; -fL[ii++] = "Moscow.flf"; -fL[ii++] = "Mshebrew210.flf"; -fL[ii++] = "Muzzle.flf"; - -fL[ii++] = "NScript.flf"; -fL[ii++] = "NT Greek.flf"; -fL[ii++] = "NV Script.flf"; -fL[ii++] = "Nancyj-Fancy.flf"; -fL[ii++] = "Nancyj-Improved.flf"; -fL[ii++] = "Nancyj-Underlined.flf"; -fL[ii++] = "Nancyj.flf"; -fL[ii++] = "Nipples.flf"; - -fL[ii++] = "O8.flf"; -fL[ii++] = "OS2.flf"; -fL[ii++] = "Octal.flf"; -fL[ii++] = "Ogre.flf"; -fL[ii++] = "Old Banner.flf"; - -fL[ii++] = "Pawp.flf"; -fL[ii++] = "Peaks Slant.flf"; -fL[ii++] = "Peaks.flf"; -fL[ii++] = "Pebbles.flf"; -fL[ii++] = "Pepper.flf"; -fL[ii++] = "Poison.flf"; -fL[ii++] = "PsY.aol"; -fL[ii++] = "PsY2.aol"; -fL[ii++] = "Puffy.flf"; -fL[ii++] = "Puzzle.flf"; -fL[ii++] = "Pyramid.flf"; - -fL[ii++] = "Rammstein.flf"; -fL[ii++] = "Rectangles.flf"; -fL[ii++] = "Red Phoenix.flf"; -fL[ii++] = "Reeko Font 1.aol"; -fL[ii++] = "Relief.flf"; -fL[ii++] = "Relief2.flf"; -fL[ii++] = "Reverse.flf"; -fL[ii++] = "Ribbit.aol"; -fL[ii++] = "Ribbit2.aol"; -fL[ii++] = "Ribbit3.aol"; -fL[ii++] = "Roman.flf"; -fL[ii++] = "Rot13.flf"; -fL[ii++] = "Rotated.flf"; -fL[ii++] = "Rounded.flf"; -fL[ii++] = "Rowan Cap.flf"; -fL[ii++] = "Rozzo.flf"; -fL[ii++] = "Runic.flf"; -fL[ii++] = "Runyc.flf"; - -fL[ii++] = "S Blood.flf"; -fL[ii++] = "SL Script.flf"; -fL[ii++] = "Santa Clara.flf"; -fL[ii++] = "Script.flf"; -fL[ii++] = "Serifcap.flf"; -fL[ii++] = "Shadow.flf"; -fL[ii++] = "Shimrod.flf"; -fL[ii++] = "Short.flf"; -fL[ii++] = "Slant Relief.flf"; -fL[ii++] = "Slant.flf"; -fL[ii++] = "Slide.flf"; -fL[ii++] = "Small Caps.flf"; -fL[ii++] = "Small Isometric1.flf"; -fL[ii++] = "Small Keyboard.flf"; -fL[ii++] = "Small Poison.flf"; -fL[ii++] = "Small Script.flf"; -fL[ii++] = "Small Shadow.flf"; -fL[ii++] = "Small Slant.flf"; -fL[ii++] = "Small Tengwar.flf"; -fL[ii++] = "Small.flf"; -fL[ii++] = "Soft.flf"; -fL[ii++] = "Sony.aol"; -fL[ii++] = "Speed.flf"; -fL[ii++] = "Spliff.flf"; -fL[ii++] = "Stacey.flf"; -fL[ii++] = "Stampate.flf"; -fL[ii++] = "Stampatello.flf"; -fL[ii++] = "Standard.flf"; -fL[ii++] = "Star Strips.flf"; -fL[ii++] = "Star Wars.flf"; -fL[ii++] = "Stellar.flf"; -fL[ii++] = "Stforek.flf"; -fL[ii++] = "Stick Letters.flf"; -fL[ii++] = "Stop.flf"; -fL[ii++] = "Straight.flf"; -fL[ii++] = "Sub-Zero.flf"; -fL[ii++] = "Swamp Land.flf"; -fL[ii++] = "Swan.flf"; -fL[ii++] = "Sweet.flf"; - -fL[ii++] = "TRaC Mini.aol"; -fL[ii++] = "TRaC Tiny.aol"; -fL[ii++] = "TRaC's Old School Font.aol"; -fL[ii++] = "TRaC.aol"; -fL[ii++] = "Tanja.flf"; -fL[ii++] = "Tengwar.flf"; -fL[ii++] = "Term.flf"; -fL[ii++] = "Test1.flf"; -fL[ii++] = "Thick.flf"; -fL[ii++] = "Thin.flf"; -fL[ii++] = "Thorned.flf"; -fL[ii++] = "Three Point.flf"; -fL[ii++] = "Ticks Slant.flf"; -fL[ii++] = "Ticks.flf"; -fL[ii++] = "Tiles.flf"; -fL[ii++] = "Tinker-Toy.flf"; -fL[ii++] = "Tombstone.flf"; -fL[ii++] = "Train.flf"; -fL[ii++] = "Trek.flf"; -fL[ii++] = "Tsalagi.flf"; -fL[ii++] = "Tubular.flf"; -fL[ii++] = "Twiggy.aol"; -fL[ii++] = "Twisted.flf"; -fL[ii++] = "Two Point.flf"; - -fL[ii++] = "USA Flag.flf"; -fL[ii++] = "Univers.flf"; - -fL[ii++] = "Varsity.flf"; - -fL[ii++] = "Wavy.flf"; -fL[ii++] = "Weird.flf"; -fL[ii++] = "Wet Letter.flf"; -fL[ii++] = "Whimsy.flf"; -fL[ii++] = "Wow.flf"; - -fL[ii++] = "X-Pose.aol"; -fL[ii++] = "X99.aol"; -fL[ii++] = "X992.aol"; - -fL[ii++] = "Zodi.aol"; - -/** - * Function: overlapCompare(str1, str2) +/* + * asciimo.js + * + * Copyright (c) 2010 Marak Squires + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. * - * About: This function compares two lines from a the text array to see at what point they differ - * when the two letters are placed next to each other. - * - **/ -function overlapCompare(inputTxt1, inputTxt2) -{ - var str1 = inputTxt1.reverse(); // the character that comes before - var str2 = inputTxt2; // the character that comes after - var theOverlap = 0; - var shouldBreak = false; + * Figlet JS + * + * Copyright (c) 2010 Scott González + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://github.com/scottgonzalez/figlet-js + */ - if (hFullWidth == true) - { - return 0; - } - var str1CompIndex = 0; - var shouldSmush = true; - for (var i = 0; i < str1.length; i++) - { - if (str1.substr(i, 1) == " ") - { - str1CompIndex++; - theOverlap++; - } - else - { - // for control smushing, see if this character can be smushed - if (smushChar_GetClassVal(str1.substr(i, 1)) == -1) - { - shouldSmush = false; - } - break; - } - } +(function() { - //alert("start overlap: " + str1CompIndex + "," + "'" + str1 + "'"); - - if (str1CompIndex == str1.length) - { - return Math.min(str1.length, str2.length); - } - - for (var i = 0; i < Math.min(str1.length, str2.length); i++) - { - if (str2.substr(i, 1) == hardblank) - { - // smush rule 6 + hFitting fix - if ((hSmush6 == true && str1.substr(str1CompIndex, 1) == hardblank) ) - { - theOverlap++; - } - break; +var Figlet = (typeof exports !== "undefined" ? exports : window).Figlet = { + fonts: {}, + + parseFont: function(name, fn) { // debug.log('parseFont', name); + if (name in Figlet.fonts) { + fn(); } - else if (str2.substr(i, 1) != " " && str1.substr(str1CompIndex, 1) == hardblank) - { - break; - } - else if (str2.substr(i, 1) != " ") - { - if ( smushChar_GetClassVal(str2.substr(i, 1)) == -1 ) - { - shouldSmush = false; - } - - if (shouldSmush == true && (hFitting == false && defaultHorizontalSmush == true)) - { - theOverlap++; - } - break; - } - - theOverlap++; - } - - return theOverlap; -} - -/** - * Function: smushAmount(s1, currPos) - * - * About: This function looks at two letters and seeing how much they should be "smushed". - * - **/ -function smushAmount(prevPos, currPos) -{ - if (prevPos == -1) - { - return 0; - } - - var smushed = false; - var smushedAmount = 10000; // a value so big, it will be replaced with the first return of overlapCompare - - for (var i = 0; i < charHeight; i++) - { - val = overlapCompare(fontChars[prevPos][i], fontChars[currPos][i]); - - if (val < smushedAmount) - { - smushedAmount = val; - } - } - - return smushedAmount; -} - - -/** - * Function: smushChar_GetClassVal(inputVal) - * - * About: Gets class of given char. - * - **/ -function smushChar_GetClassVal(inputVal) -{ - var ret = -1; - - switch( inputVal ) - { - case ("|"): - ret = 1; - break; - case (String.fromCharCode(92)): - ret = 2; - break; - case ("/"): - ret = 2; - break; - case ("["): - ret = 3; - break; - case ("]"): - ret = 3; - break; - case ("{"): - ret = 4; - break; - case ("}"): - ret = 4; - break; - case ("("): - ret = 5; - break; - case (")"): - ret = 5; - break; - case ("<"): - ret = 6; - break; - case (">"): - ret = 6; - break; - } - return ret; -} - -/** - * Function: smushTxt(txt1, txt2) - * - * About: This function "smushes" two strings together - * - **/ -function smushTxt(txt1, txt2, theSmushAmount) -{ - var txt1Offset = txt1.length - theSmushAmount; - var ret = txt1.substr(0, txt1Offset); - - for (var i = 0; i < theSmushAmount; i++) - { - - var txt1_char = txt1.substr(txt1Offset + i, 1); - var txt2_char = txt2.substr(i, 1); - var txt1_smushClass = smushChar_GetClassVal(txt1_char); - var txt2_smushClass = smushChar_GetClassVal(txt2_char); - - if (hSmush1 == true && txt2_char == txt1_char) - { - ret = ret + txt1_char; - } - else if (hSmush2 == true && txt1_char == "_" && txt2_smushClass != -1) - { - ret = ret + txt2_char; - } - else if (hSmush2 == true && txt2_char == "_" && txt1_smushClass != -1) - { - ret = ret + txt1_char; - } - else if (hSmush3 == true && txt1_smushClass != -1 && txt2_smushClass != -1 && txt2_smushClass != txt1_smushClass) - { - if (txt1_smushClass > txt2_smushClass) - { - ret = ret + txt1_char; - } - else - { - ret = ret + txt2_char; - } - } - - // rule 5 needs to come before rule 4, because of how rule 4 is written here - - else if (hSmush5 == true && txt2_char == String.fromCharCode(92) && txt1_char == "/" ) - { - ret = ret + "|"; - } - else if (hSmush5 == true && txt2_char == "/" && txt1_char == String.fromCharCode(92) ) - { - ret = ret + "Y"; - } - else if (hSmush5 == true && txt2_char == "<" && txt1_char == ">") - { - ret = ret + "X"; - } - else if (hSmush4 == true && txt2_smushClass != -1 && txt2_smushClass == txt1_smushClass && txt2_char != txt1_char) - { - ret = ret + "|"; - } - - // for smush rule 6, see the overlapCompare function - - else if (txt1_char == " ") - { - ret = ret + txt2_char; - } - else - { - ret = ret + txt1_char; - } - } - - ret = ret + txt2.substr(theSmushAmount); + Figlet.loadFont(name, function(defn) { + Figlet._parseFont(name, defn, fn); + }); + }, - return ret; -} - -function simpleEncrypt(txt) -{ - var encryptedText="", charSet1, charSet2, i, pos, encryptedChar; - - charSet1 = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - charSet2 = " nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"; - - for(i = 0; i < txt.length; i++) - { - pos = charSet1.indexOf(txt.substring(i, i+1), 0); - - if (pos >= 0) - { - encryptedChar = charSet2.substring(pos, pos+1); - encryptedText = encryptedText + encryptedChar; - } else { - encryptedText = encryptedText + txt.substring(i, i+1); - } - } - return encryptedText -} - - - -function createLargeText(txt) -{ - var largeText = ""; - - // now lets handle creating the ascii art text - var filteredTxt = txt; // filterText( txt ); - - // direction is important for fonts like Mirror - if (printDirection == 1) - { - filteredTxt = filteredTxt.reverse(); - } - var filteredTxtLines = filteredTxt.split("\n"); // ß - - for (lines = 0; lines < filteredTxtLines.length; lines++) - { - var alphabet = null; - if (fontFileExt == "aol" || fontFileExt == "txt") - { - alphabet = " abcdefghijklmnopqrstuvwxyz"; - filteredTxtLines[lines] = filteredTxtLines[lines].toLowerCase(); + _parseFont: function(name, defn, fn) { + var lines = defn.split("\n"), + header = lines[0].split(" "), + hardblank = header[0].charAt(header[0].length - 1), + height = +header[1], + comments = +header[5]; + + Figlet.fonts[name] = { + defn: lines.slice(comments + 1), + hardblank: hardblank, + height: height, + char: {} + }; + fn(); + }, + + parseChar: function(char, font) { // debug.log('parseChar'); + var fontDefn = Figlet.fonts[font]; + if (char in fontDefn.char) { + return fontDefn.char[char]; } - else if (fontFileExt == "flf") - { - alphabet = " !" + String.fromCharCode(34) + "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[" + String.fromCharCode(92) + "]^_`abcdefghijklmnopqrstuvwxyz{|}~"; + + var height = fontDefn.height, + start = (char - 32) * height, + charDefn = [], + i; + for (i = 0; i < height; i++) { + charDefn[i] = fontDefn.defn[start + i] + .replace(/@/g, "") + .replace(RegExp("\\" + fontDefn.hardblank, "g"), " "); } + return fontDefn.char[char] = charDefn; + }, - var outputString = ""; - var finalText = ""; - var prevPos = -1; - - var smushAmountArray; - if (fontFileExt == "flf") - { - // find the smush amount for each character in the line - smushAmountArray = new Array(); - for (var i = 0; i < filteredTxtLines[lines].length; i++) - { - var pos = alphabet.indexOf(filteredTxtLines[lines].substr(i,1)); - if (pos != -1) - { - var theSmushAmount = smushAmount(prevPos, pos); - smushAmountArray[i] = theSmushAmount; - } - prevPos = pos; + write: function(str, font, fn) { + Figlet.parseFont(font, function() { // debug.log('parseFont'); + var chars = [], + result = ""; + for (var i = 0, len = str.length; i < len; i++) { + chars[i] = Figlet.parseChar(str.charCodeAt(i), font); } - } - - prePos = -1; - - for (var height = 0; height < charHeight; height++) - { - for (var i = 0; i < filteredTxtLines[lines].length; i++) - { - var pos = alphabet.indexOf(filteredTxtLines[lines].substr(i,1)); - if (pos != -1) - { - - if (fontFileExt == "aol" || fontFileExt == "txt") - { - outputString = outputString + fontChars[pos][height]; - } - else if (fontFileExt == "flf") - { - var theSmushAmount = smushAmountArray[i]; //smushAmount(prevPos, pos); - outputString = smushTxt(outputString, fontChars[pos][height], theSmushAmount); - } + for (i = 0, height = chars[0].length; i < height; i++) { + for (var j = 0; j < len; j++) { + result += chars[j][i]; } - prevPos = pos; + result += "\n"; } - if ((lines < (filteredTxtLines.length-1)) || (height < (charHeight-1))) - { - finalText = finalText + outputString + "\n"; - } - else - { - finalText = finalText + outputString; - } - - prevPos = -1; - outputString = ""; - } - - if (fontFileExt == "flf") - { - // remove the hardblanks - finalText = finalText.split(hardblank).join(" "); // replace all, we have to do it this way since hardblank could be a special character (for reg expressions) - } - - // print the final text - largeText = largeText + finalText; - - if (lines != (filteredTxtLines.length-1)) - { - largeText = largeText + "\n"; - } - } - return largeText; -} - -// ---------------------------------------------------------- Above is code for generation - -/** - * Function: displayAuthorInfo() - * - * About: This function displays the comments inside of the flf font file. - * - **/ -function displayAuthorInfo() -{ - // if we're on the "test all" page, just return - if (userLastClicked == 2) - { - return; - } - - noteThatFooterIsNotVisible(); - - // the last thing the user did was click for info on the author - userLastClicked = 1; - - var hyperlinkedComments = authorComments.urlsToHyperlinks(); + fn(result); + }); + }, - // figure out how to align the text - var aIndex = 0; - for (var i = 0; i < 3; i++) - { - if (document.fontSettings.tAlignment[i].checked == true) - { - aIndex = i; - } + loadFont: function(name, fn) { + if(typeof exports != 'undefined'){ + var sys = require('sys'); + require("fs").readFile("./fonts/" + name + ".flf", "utf-8", function(err, contents) { + if (err) { + sys.puts(err); + } + else { + fn(contents); + } + }); + } + else{ + $.get('./fonts/' + name+ '.flf',function(contents){ + fn(contents); + }); + } } - var textAlignment = document.fontSettings.tAlignment[aIndex].value; +}; -} +})(); -function text_decode(str) -{ - var strChars = str.split("%"); - var retStr = ""; - var decNum = ""; - - // first index in the array will be blank since input strings have the format: - // "%XX%XX%XX" - for (var i = 1; i < strChars.length; i++) - { - if (strChars[i] == "GG") - { - retStr = retStr + "‘"; - } - else if (strChars[i] == "II") - { - retStr = retStr + "‚"; - } - else if (strChars[i] == "JJ") - { - retStr = retStr + "˜"; - } - else if (strChars[i] == "LL") - { - retStr = retStr + "—"; - } - else if (strChars[i] == "MM") - { - retStr = retStr + "–"; - } - else if (strChars[i] == "NN") - { - retStr = retStr + "“"; - } - else if (strChars[i] == "PP") - { - retStr = retStr + "™"; - } - else if (strChars[i] == "QQ") - { - retStr = retStr + "›"; - } - else if (strChars[i] == "RR") - { - retStr = retStr + "‹"; - } - else if (strChars[i] == "SS") - { - retStr = retStr + "’"; - } - else if (strChars[i] == "TT") - { - retStr = retStr + "”"; - } - else if (strChars[i] == "UU") - { - retStr = retStr + "”"; - } - else - { - decNum = parseInt(strChars[i], 16); - retStr = retStr + String.fromCharCode(decNum); - } - } - - return retStr; -}