Giter Site home page Giter Site logo

Comments (5)

ErinCall avatar ErinCall commented on June 30, 2024 11

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.

  • .flf files are ASCII text, as you might expect since they're designed to display on terminals in 1994
  • The first line is a header with metadata about the font:
  • The first 5 characters should be flf2a, providing a filetype sigil
  • The next character denotes what character will be used for non-smushable blanks. That is, whatever character is in this position, when that character is encountered in a letter definition, it should be replaced with a space. Using $ here seems common, but of course that won't work if you want to use $s in your letters.
  • Next, there are up to 7 space-separated integers:
    • height (number of rows) of a letter in this font
    • height of a letter, not including descenders
    • width (in columns) of the widest letter in this font
    • default smushmode for this font (analogous to the -m flag to figlet)
    • total number of comment lines in this font file. Comments come immediately after the header and before the first letter definition. Having a character reserved for comments would of course be inconvenient for font authors.
    • 0 if this font should display left-to-right, or 1 if it should display right-to-left.
    • Another number whose meaning I can't quite identify, but which seems to show up in fonts that provide letters at code points outside of ASCII
  • The first five seem mandatory; one or both of the last two are omitted in a lot of fonts and may be later additions to the format.

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

Finally, the letters, following these rules:

  • Letters are the height specified in the header
  • There're no separating lines between characters
  • The letter is bracketed on the right by a column of characters. This character is the same throughout the font file (i.e. you must pick some character that won't appear in any of your letters).
  • The last line of the letter has an extra bracket-character to the right of the bracketing column.
  • The letters start at space (ASCII 32) and go in ASCII order up to 126
  • The Germans have laid claim to positions 127 through 133, with Ä Ö Ü ä ö ü ß
  • A handful of fonts, such as slant, provide letters at code points above 133, indicated with what looks like the decimal representation of the UTF-8 encoding of the letter and the Unicode description of the letter on a line above the letter definition.
    • figlet-js doesn't appear to support these letters. Honestly I can't blame them; it seems like an awkward tacked-on-later extension to the format. There's even a versioning scheme in the file header! Why not declare a new format-version for Unicode support? :(

from asciimo.

jarv avatar jarv commented on June 30, 2024 9

@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".)

from asciimo.

tajmone avatar tajmone commented on June 30, 2024 3

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 ]

from asciimo.

Marak avatar Marak commented on June 30, 2024

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

from asciimo.

ErinCall avatar ErinCall commented on June 30, 2024

ah-HA! Thanks :)

from asciimo.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.