Marak / asciimo

asciimo - create awesome ascii art with javascript! works in the browser or node.js
GNU General Public License v2.0
287 stars 34 forks source link

How to Parse Figlet Font File .FLF #3

Open schneems opened 13 years ago

schneems commented 13 years ago

Hey, i'm interested in writing a pure Ruby implementation of filglet for fun. Do you have any specs for the figlet font files .FLF ? If not how did you figure out how to parse them? Did you just look at another project? If so what project?

Marak commented 13 years ago

https://github.com/scottgonzalez/figlet-js http://en.wikipedia.org/wiki/FIGlet http://www.figlet.org/

ErinCall commented 9 years ago

Since this issue is high in google results, and I can't find an flf spec anywhere, here's what I've surmised. Throughout this comment I use "character" to refer to ASCII bytes within the .flf file and "letter" to refer to the glyphs defined by the font.

Next you have the comments, if any, as discussed above.

Finally, the letters, following these rules:

jarv commented 9 years ago

@AndrewLorente I believe http://www.jave.de/docs/figfont.txt is the spec you are looking for.

THE HEADER LINE

The header line gives information about the FIGfont.  Here is an example
showing the names of all parameters:

          flf2a$ 6 5 20 15 3 0 143 229    NOTE: The first five characters in
            |  | | | |  |  | |  |   |     the entire file must be "flf2a".
           /  /  | | |  |  | |  |   \
  Signature  /  /  | |  |  | |   \   Codetag_Count
    Hardblank  /  /  |  |  |  \   Full_Layout*
         Height  /   |  |   \  Print_Direction
         Baseline   /    \   Comment_Lines
          Max_Length      Old_Layout*

  * The two layout parameters are closely related and fairly complex.
      (See "INTERPRETATION OF LAYOUT PARAMETERS".)
ErinCall commented 9 years ago

ah-HA! Thanks :)

tajmone commented 8 years ago

A very exhaustive document explaining FIGLet / FIGDriver / FIGFonts implementation standard (from 1st version to latest v2.2):

http://www.jave.de/figlet/figfont.html

It goes into details on how FIGFonts should be parsed, kerned, smushed, ecc.

[ same as @jarv 's link above, but in HML version ]