fonts.js

2.1.2 • Public • Published

fonts.js

fonts.js is an ascii art font framework written in coffeescript.

npm version npm downloads travis build status

How to use

Install with npm i fonts.js

You can use this library in both coffeescript, and javascript:

convert = require 'fonts.js'

str = 'HELLO\nWORLD'
console.log convert str, {font: 'lines'} # Lines is the default font.
var convert = require('fonts.js');

var str = 'HELLO\nWORLD'
console.log(convert(str, {font: 'lines'})) // Lines is the default font.
/*
Output (It looks better in a web page.):
_    _  ______  _      _      _______
| |  | ||  ____|| |    | |    |  ___  |
| |__| || |__   | |    | |    | |   | |
|  __  ||  __|  | |    | |    | |   | |
| |  | || |____ | |___ | |___ | |___| |
|_|  |_||______||_____||_____||_______|
_   _   _  _______  _____  _      _____
| | | | | ||  ___  ||  _  || |    |  __ \
| | | | | || |   | || |_| || |    | |  \ \
| | | | | || |   | ||    _|| |    | |   | |
| |_| |_| || |___| || |\ \ | |___ | |__/ /
|_________||_______||_| \_\|_____||_____/
*/

Making your own font

Requirements:

To make your own font:

  • Step 1: Clone the github repository into you own folder.
  • Step 2: Create a coffeescript file under src/fonts with the name of your font as it's name.
  • Step 3: Structure the file like the default font. (Read the comments.)
  • Step 4: Use the fontCreater html page to help create each character.(Read bellow).
  • Step 5: Add the name of your font to the font list in index.coffee
  • Step 6: (Optionaly) Make a pull request so I can add the font.(Please test your font before you make a pull request though!(See bellow))

Making a character

  • Step 1: Design your character in the textbox. IMPORTANT: Make sure each line is the same width! Otherwise the characters following it in a string will look weird.
  • Step 2: Click the button.
  • Step 3: Put it in your font file.

Testing your font (or anything else)

Go to the root directory of the project and run npm test

Readme

Keywords

Package Sidebar

Install

npm i fonts.js

Weekly Downloads

7

Version

2.1.2

License

ISC

Last publish

Collaborators

  • 1p6