View Source Figlet.Parser.FontFileParser (figlet v0.3.2)

This module parses figlet font files identified by the path to the file.

A FIGlet file has 3 main parts:

  • Headerline
  • Comments
  • Character Data

FIGcharacter Data

The FIGcharacter data begins on the next line after the comments and continues to the end of the file.

Basic Data Structure

The sub-characters in the file are given exactly as they should be output, with two exceptions:

  1. Hardblanks should be the hardblank character specified in the header line, not a blank (space).
  2. Every line has one or two endmark characters, whose column locations define the width of each FIGcharacter.

In most FIGfonts, the endmark character is either "@" or "#". The FIGdriver will eliminate the last block of consecutive equal characters from each line of sub-characters when the font is read in. By convention, the last line of a FIGcharacter has two endmarks, while all the rest have one. This makes it easy to see where FIGcharacters begin and end. No line should have more than two endmarks.

See Also

Building a parser for Figlet files would be practically impossible without a useful spec for reference. Relevant links for the Figlet font file spec:

Summary

Functions

Parses the Figlet font file at the given absolute filepath, returning a %Figlet.Font{} struct.

Functions

parse(filepath, opts \\ [])

Parses the Figlet font file at the given absolute filepath, returning a %Figlet.Font{} struct.

Given: flf2a 4 3 8 15 11 0 10127

The 6th character (the invisible one after the a) is a unicode value for "hardBlank"

All FIGlet fonts must contain chars 32-126, 196, 214, 220, 228, 246, 252, 223