Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/externals/figlet/figfont.txt
12240 views
1
_____ ___ ____ __ _
2
| ___||_ _|/ ___| / _| ___ _ __ | |_ ___ _
3
| |_ | || | _ | |_ / _ \ | '_ \ | __|/ __|(_)
4
| _| | || |_| || _|| (_) || | | || |_ \__ \ _
5
|_| |___|\____||_| \___/ |_| |_| \__||___/(_)
6
7
The FIGfont Version 2 FIGfont and FIGdriver Standard
8
=== ======= ======= = ======= === ========= ========
9
Draft 2.0 Copyright 1996, 1997
10
by John Cowan and Paul Burton
11
Portions Copyright 1991, 1993, 1994
12
by Glenn Chappell and Ian Chai
13
May be freely copied and distributed.
14
15
Figlet lives at: http://www.figlet.org/
16
17
_____ __ __
18
/ ___/__ ___ / /____ ___ / /____
19
/ /__/ _ \/ _ \/ __/ -_) _ \/ __(_-<
20
\___/\___/_//_/\__/\__/_//_/\__/___/
21
22
INTRODUCTION
23
BASIC DEFINITIONS AND CONCEPTS
24
"FIGfont"
25
"FIGcharacters" and "Sub-characters"
26
"FIGdriver"
27
"FIGure"
28
"FIG"
29
"Layout Modes"
30
"Smushing Rules"
31
"Hardblanks"
32
CREATING FIGFONTS
33
The Header Line
34
Interpretation of Layout Parameters
35
Setting Layout Parameters Step-by-Step
36
FIGfont Comments
37
FIGcharacter Data
38
- Basic Data Structure
39
- Character Codes
40
- Required FIGcharacters
41
- Code Tagged FIGcharacters
42
NOTES - AVOIDING ERRORS AND GENERAL ADVICE
43
CONTROL FILES
44
Standard Format
45
Extended Commands
46
STANDARDIZED CAPABILITIES OF CURRENT AND FUTURE FIGDRIVERS
47
CHART OF CAPABILITIES OF FIGLET 2.2.2 AND FIGWIN 1.0
48
49
50
INTRODUCTION
51
============
52
53
This document specifies the format of font files, and the associated control
54
files, used by the FIGlet and FIGWin programs (FIGdrivers). It is written
55
for designers who wish to build fonts (FIGfonts) usable by either program,
56
and also serves as a standard for development of future versions or similar
57
FIGdrivers. Some features explained here are not supported by both programs.
58
See separate documentation to learn how to use FIGlet or FIGWin.
59
60
NOTE: FIGWin 1.0 is packaged with a program called FIGfont Editor for Windows
61
1.0, which is just that. It does not require a complete understanding of
62
this document to create FIGfonts. However it is a good idea to become
63
familiar with the "BASIC DEFINITIONS AND CONCEPTS" information before using
64
it.
65
66
If you design a FIGfont, please send an e-mail announcement to
67
<[email protected]>, the FIGlet fonts mailing list, and email a copy
68
to [email protected] for us to put it on the ftp site (ftp://ftp.figlet.org/)
69
70
BASIC DEFINITIONS AND CONCEPTS
71
===== =========== === ========
72
73
"FIGfont"
74
75
A FIGfont is a file which represents the graphical arrangement of characters
76
representing larger characters. Since a FIGfont file is a text file, it can
77
be created with any text editing program on any platform. The filename of a
78
FIGfont file must end with ".flf", which stands for "<F>IG<L>ettering
79
<F>ont".
80
81
82
"FIGcharacters" and "Sub-characters"
83
84
Because FIGfonts describe large characters which consist of smaller
85
characters, confusion can result when descussing one or the other.
86
Therefore, the terms "FIGcharacter" and "sub-character" are used,
87
respectively.
88
89
90
"FIGdriver"
91
92
The term FIGdriver is used in this document to encompass FIGlet, FIGWin, and
93
any future programs which use FIGfonts.
94
95
96
"FIGure"
97
98
A FIGure (thusly capitalized) is an image created by a FIGdriver.
99
100
101
"FIG"
102
103
A bit of history:
104
105
In Spring 1991, inspired by the Email signature of a friend named Frank, and
106
goaded on by Ian Chai, Glenn Chappell wrote a nifty little 170-line "C"
107
program called "newban", which would create large letters out of ordinary
108
text characters. At the time, it was only compiled for UNIX. In hindsight,
109
we now call it "FIGlet 1.0". FIGlet stands for <F>rank, <I>an, and <G>lenn's
110
<let>ters. In various incarnations, newban circulated around the net for a
111
couple of years. It had one font, which included only lowercase letters.
112
113
In early 1993, Ian decided newban was due for a few changes, so together Ian
114
and Glenn added the full ASCII character set, to start with. First, though,
115
Ian had to find a copy of the source, since Glenn had tossed it away as not
116
worth the disk space. Ian and Glenn discussed what could be done with it,
117
decided on a general re-write, and, 7 months later, ended up with 888 lines
118
of code, 13 FIGfonts and documentation. This was FIGlet 2.0, the first real
119
release.
120
121
To their great surprise, FIGlet took the net by storm. They received floods
122
of "FIGlet is great!" messages and a new contributed FIGfont about once a
123
week. To handle all the traffic, Ian quickly set up a mailing list, Daniel
124
Simmons kindly offered space for an FTP site, several people volunteered to
125
port FIGlet to non-Unix operating systems, ...and bug reports poured in.
126
127
Because of these, and the need to make FIGlet more "international", Ian and
128
Glenn released a new version of FIGlet which could handle non-ASCII character
129
sets and right-to-left printing. This was FIGlet 2.1, which, in a couple of
130
weeks, became figlet 2.1.1. This weighed in at 1314 lines, and there were
131
over 60 FIGfonts.
132
133
By late 1996, FIGlet had quite a following of fans subscribing to its mailing
134
list. It had been ported to MS-DOS, Macintosh, Amiga, Apple II GS, Atari ST,
135
Acorn and OS/2. FIGlet had been further updated, and there were nearly 200
136
FIGfonts.
137
138
John Cowan and Paul Burton are two FIGlet fans who decided to create new
139
versions. While John wrote FIGlet version 2.2 using C, Paul wrote FIGWin
140
1.0, the first true GUI (Windows) implementation of FIGlet, using Visual
141
Basic. John and Paul worked together to add new features to FIGfont files
142
which could be read by both programs, and together wrote this document, which
143
we hope helps to establish consistency in FIGfonts and help with the creation
144
of future FIGdrivers. FIGlet 2.2 has about 4800 lines of code, of which
145
over half is a support library for reading compressed files.
146
147
Three years later, in July 2005, FIGlet 2.2.2 was released under a new License
148
(the ``Academic Free License 2.1''). This version has proved to be very
149
stable, and persisted for more five years until minor bugfixes and another
150
license change resulted in the release of FIGlet 2.2.3 in January 2011. All
151
license concerns involving contributed code were solved and FIGlet is now
152
distributed under the ``New BSD License''. Contributed fonts amounted to more
153
than 400.
154
155
FIGlet 2.2 and FIGWin 1.0 both allow greater flexibility by use of new
156
information which can be contained in FIGfont files without interfering with
157
the function of older FIGdrivers.
158
159
NOTE: The Macintosh version of FIGlet is still command-line driven as of this
160
writing, and a GUI version is very much in demand. The FIGlet C code is
161
written to be easily plugged in to a GUI shell, so it will be a relatively
162
easy task for a Macintosh developer.
163
164
165
166
167
"Layout Modes"
168
169
A FIGdriver may arrange FIGcharacters using one of three "layout modes",
170
which define the spacing between FIGcharacters. The layout mode for the
171
horizontal axis may differ from the layout mode for the vertical axis. A
172
default choice is defined for each axis by every FIGfont.
173
174
The three layout modes are:
175
176
Full Size (Separately called "Full Width" or "Full Height".)
177
178
Represents each FIGcharacter occupying the full width or
179
height of its arrangement of sub-characters as designed.
180
181
Fitting Only (Separately called "Kerning or "Vertical Fitting".)
182
183
Moves FIGcharacters closer together until they touch.
184
Typographers use the term "kerning" for this phenomenon
185
when applied to the horizontal axis, but fitting also
186
includes this as a vertical behavior, for which there is
187
apparently no established typographical term.
188
189
Smushing (Same term for both axes.)
190
191
Moves FIGcharacters one step closer after they touch, so that
192
they partially occupy the same space. A FIGdriver must decide
193
what sub-character to display at each junction. There are two
194
ways of making these decisions: by controlled smushing or by
195
universal smushing.
196
197
Controlled smushing uses a set of "smushing rules" selected by
198
the designer of a FIGfont. (See "Smushing Rules" below.)
199
Each rule is a comparison of the two sub-characters which must
200
be joined to yield what to display at the junction.
201
Controlled smushing will not always allow smushing to occur,
202
because the compared sub-characters may not correspond to any
203
active rule. Wherever smushing cannot occur, fitting occurs
204
instead.
205
206
Universal smushing simply overrides the sub-character from the
207
earlier FIGcharacter with the sub-character from the later
208
FIGcharacter. This produces an "overlapping" effect with some
209
FIGfonts, wherin the latter FIGcharacter may appear to be "in
210
front".
211
212
A FIGfont which does not specify any smushing rules for a
213
particular axis indicates that universal smushing is to occur
214
when smushing is requested. Therefore, it is not possible for
215
a FIGfont designer to "forbid" smushing. However there are
216
ways to ensure that smushing does not cause a FIGfont to be
217
illegible when smushed. This is especially important for
218
smaller FIGfonts. (See "Hardblanks" for details.)
219
220
For vertical fitting or smushing, entire lines of output FIGcharacters are
221
"moved" as a unit.
222
223
Not all FIGdrivers do vertical fitting or smushing. At present, FIGWin 1.0
224
does, but FIGlet 2.2 does not. Further, while FIGlet 2.2 allows the user to
225
override the FIGfont designer's set of smushing rules, FIGWin 1.0 does not.
226
227
NOTE: In the documentation of FIGlet versions prior to 2.2, the term
228
"smushmode" was used to mean the layout mode, and this term further included
229
the smushing rules (if any) to be applied. However, since the layout mode
230
may or may not involve smushing, we are straying from the use of this
231
somewhat misleading term.
232
233
234
"Smushing Rules"
235
236
Again, smushing rules are for controlled smushing. If none are defined to be
237
active in a FIGfont, universal smushing occurs instead.
238
239
Generally, if a FIGfont is "drawn at the borders" using sub-characters
240
"-_|/\[]{}()<>", you will want to use controlled smushing by selecting from
241
the rules below. Otherwise, if your FIGfont uses a lot of other
242
sub-characters, do not select any rules and universal smushing will occur
243
instead. (See "Hardblanks" below if your FIGfont is very small and would
244
become illegible if smushed.) Experimentation is the best way to make these
245
decisions.
246
247
There are six possible horizontal smushing rules and five possible vertical
248
smushing rules. Below is a description of all of the rules.
249
250
NOTE: Ignore the "code values" for now. They are explained later.
251
252
The Six Horizontal Smushing Rules
253
254
Rule 1: EQUAL CHARACTER SMUSHING (code value 1)
255
256
Two sub-characters are smushed into a single sub-character
257
if they are the same. This rule does not smush
258
hardblanks. (See "Hardblanks" below.)
259
260
Rule 2: UNDERSCORE SMUSHING (code value 2)
261
262
An underscore ("_") will be replaced by any of: "|", "/",
263
"\", "[", "]", "{", "}", "(", ")", "<" or ">".
264
265
Rule 3: HIERARCHY SMUSHING (code value 4)
266
267
A hierarchy of six classes is used: "|", "/\", "[]", "{}",
268
"()", and "<>". When two smushing sub-characters are
269
from different classes, the one from the latter class
270
will be used.
271
272
Rule 4: OPPOSITE PAIR SMUSHING (code value 8)
273
274
Smushes opposing brackets ("[]" or "]["), braces ("{}" or
275
"}{") and parentheses ("()" or ")(") together, replacing
276
any such pair with a vertical bar ("|").
277
278
Rule 5: BIG X SMUSHING (code value 16)
279
280
Smushes "/\" into "|", "\/" into "Y", and "><" into "X".
281
Note that "<>" is not smushed in any way by this rule.
282
The name "BIG X" is historical; originally all three pairs
283
were smushed into "X".
284
285
Rule 6: HARDBLANK SMUSHING (code value 32)
286
287
Smushes two hardblanks together, replacing them with a
288
single hardblank. (See "Hardblanks" below.)
289
290
291
The Five Vertical Smushing Rules
292
293
Rule 1: EQUAL CHARACTER SMUSHING (code value 256)
294
295
Same as horizontal smushing rule 1.
296
297
Rule 2: UNDERSCORE SMUSHING (code value 512)
298
299
Same as horizontal smushing rule 2.
300
301
Rule 3: HIERARCHY SMUSHING (code value 1024)
302
303
Same as horizontal smushing rule 3.
304
305
Rule 4: HORIZONTAL LINE SMUSHING (code value 2048)
306
307
Smushes stacked pairs of "-" and "_", replacing them with
308
a single "=" sub-character. It does not matter which is
309
found above the other. Note that vertical smushing rule 1
310
will smush IDENTICAL pairs of horizontal lines, while this
311
rule smushes horizontal lines consisting of DIFFERENT
312
sub-characters.
313
314
Rule 5: VERTICAL LINE SUPERSMUSHING (code value 4096)
315
316
This one rule is different from all others, in that it
317
"supersmushes" vertical lines consisting of several
318
vertical bars ("|"). This creates the illusion that
319
FIGcharacters have slid vertically against each other.
320
Supersmushing continues until any sub-characters other
321
than "|" would have to be smushed. Supersmushing can
322
produce impressive results, but it is seldom possible,
323
since other sub-characters would usually have to be
324
considered for smushing as soon as any such stacked
325
vertical lines are encountered.
326
327
328
"Hardblanks"
329
330
A hardblank is a special sub-character which is displayed as a blank (space)
331
in rendered FIGures, but is treated more like a "visible" sub-character when
332
fitting or smushing horizontally. Therefore, hardblanks keep adjacent
333
FIGcharacters a certain distance apart.
334
335
NOTE: Hardblanks act the same as blanks for vertical operations.
336
337
Hardblanks have three purposes:
338
339
1) Hardblanks are used to create the blank (space) FIGcharacter.
340
341
Usually the space FIGcharacter is simply one or two vertical
342
columns of hardblanks. Some slanted FIGfonts as shown below
343
have a diagonal arrangement of hardblanks instead.
344
345
2) Hardblanks can prevent "unreasonable" fitting or smushing.
346
347
Normally when fitting or smushing, the blank (space)
348
sub-character is considered "vacant space". In the following
349
example, a capital "C" FIGcharacter is smushed with a "minus"
350
FIGcharacter.
351
______ ______
352
/ ____/ / ____/
353
/ / ____ >>-Becomes-> / / ____
354
/ /___ /___/ / /__/___/
355
\____/ \____/
356
357
The FIGure above looks like a capital G. To prevent this, a
358
FIGfont designer might place a hardblank in the center of the
359
capital C. In the following example, the hardblank is
360
represented as a "$":
361
______ ______
362
/ ____/ / ____/
363
/ / $ ____ >>-Becomes-> / / ____
364
/ /___ /___/ / /___/___/
365
\____/ \____/
366
367
Using hardblanks in this manner ensures that FIGcharacters
368
with a lot of empty space will not be unreasonably "invaded"
369
by adjacent FIGcharacters. Generally, FIGcharacters such as
370
capital C, L or T, or small punctuation marks such as commas,
371
may contain hardblanks, since they may contain a lot of vacant
372
space which is "accessible" from either side.
373
374
3) Hardblanks can prevent smushing from making FIGfonts illegible.
375
376
This legitimate purpose of hardblanks is often overused. If a
377
FIGfont designer is absolutely sure that smushing "visible"
378
sub-characters would make their FIGfont illegible, hardblanks
379
may be positioned at the end of each row of sub-characters,
380
against the visible sub-characters, creating a barrier.
381
382
With older FIGdrivers, using hardblanks for this purpose meant
383
that FIGcharacters would have to be separated by at least one
384
blank in output FIGures, since only a hardblank could smush
385
with another hardblank. However with the advent of universal
386
smushing, this is no longer necessary. Hardblanks ARE
387
overriden by any visible sub-character when performing
388
universal smushing. Hardblanks still represent a "stopping
389
point", but only AFTER their locations are occupied.
390
391
NOTE: Earlier it was stated that universal smushing overrides
392
the sub-character from the former FIGcharacter with the
393
sub-character from the latter FIGcharacter. Hardblanks (and
394
blanks or spaces) are the exception to this rule; they will
395
always be overriden by visible sub-characters, regardless of
396
which FIGcharacter contains the hardblank. This ensures that
397
no visible sub-characters "disappear".
398
399
Therefore, one can design a FIGfont with a default behavior of
400
universal smushing, while the output FIGure would LOOK like
401
the effect of fitting, or even full size if additional
402
hardblanks are used. If a user "scales down" the layout mode
403
to fitting, the result would look like "extra spacing" between
404
FIGcharacters.
405
406
Taking this concept further, a FIGcharacter may also include
407
extra blanks (spaces) on the left side of each FIGcharacter,
408
which would define the FIGcharacter's width as slightly larger
409
than required for the visible sub-characters and hardblanks.
410
With such a FIGfont, a user who further "scales down" the
411
layout mode to full size would see even greater spacing.
412
413
These techniques prevent horizontal smushing from causing a
414
FIGfont to become illegible, while offering greater
415
flexibility of output to users.
416
417
NOTE: These techniques cannot be used to prevent vertical
418
smushing of visible sub-characters, since hardblanks are not
419
respected in the vertical axis. Although it is possible to
420
select only one vertical smushing rule which involves only
421
sub-characters which are not used in your FIGfont, it is
422
recommend that you do NOT do so. In our opinion, most users
423
would prefer to get what they ask for, rather than being
424
told, in effect: "I, the FIGfont designer, have decided that
425
you wouldn't like the results of vertical smushing, so I have
426
prevented you from trying it." Instead, we recommend setting
427
the default behavior to either fitting or full height, and
428
either allowing universal smushing, or selecting vertical
429
smushing rules which seem most appropriate. A user of your
430
FIGfont will quickly see why you did not choose smushing as
431
the default vertical layout mode, and will agree with you.
432
433
434
"Character Sets" and "Character Codes"
435
436
When you type using your keyboard, you are actually sending your computer a
437
series of numbers. Each number must be interpreted by your computer so that
438
it knows what character to display. The computer uses a list of definitions,
439
called a "character set". The numbers which represent each character are
440
called "character codes".
441
442
There are many character sets, most of which are internationally accepted as
443
standards. By far, the most common character set is ASCII, which stands for
444
"American Standard Code for Information Interchange". ASCII identifies its
445
characters with codes ranging from 0 to 127.
446
447
NOTE: The term "ASCII art" has become well-understood to mean artistic images
448
which consist of characters on your screen (such as FIGures).
449
450
For a list of the printable ASCII characters with the corresponding codes,
451
see the section "REQUIRED CHARACTERS" below. The other ASCII codes in the
452
range of 0 through 31 are "control characters" such as carriage-return
453
(code 13), linefeed/newline (code 10), tab (code 9), backspace (code 8) or
454
null (code 0). Code 127 is a delete in ASCII.
455
456
Getting more technical for just a moment: A byte consisting of 8 bits (eight
457
1's or 0's) may represent a number from 0 to 255. Therefore, most computers
458
have DIRECT access to 256 characters at any given time. A character set
459
which includes 256 characters is called an 8-bit character set.
460
461
For Latin-based languages, ASCII is almost always the first half of a larger
462
8-bit character set. Latin-1 is the most common example of an 8-bit
463
character set. Latin-1 includes all of ASCII, and adds characters with codes
464
from 128 to 255 which include umlauted ("double-dotted") letters and
465
characters with various other accents. In the United States, Windows and
466
most Unix systems have Latin-1 directly available.
467
468
Most modern systems allow the possibility of changing 8-bit character sets.
469
On Windows systems, character sets are referred to as "code pages". There
470
are many other character sets which are not mentioned here. DOS has its own
471
character set (which also has international variants) that includes graphics
472
characters for drawing lines. It is also an extension of ASCII.
473
474
For some languages, 8-bit character sets are insufficient, particularly on
475
East Asian systems. Therefore, some systems allow 2 bytes for each
476
character, which multiplies the 256 possibilties by 256, resulting in 65536
477
possible characters. (Much more than the world will ever need.)
478
479
Unicode is a character set standard which is intended to fulfill the
480
worldwide need for a single character set which includes all characters used
481
worldwide. Unicode includes character codes from 0 to 65535, although at
482
present, only about 22,000 characters have been officially assigned and named
483
by the Unicode Consortium. The alphabets and other writing systems
484
representable with Unicode include all Latin-alphabet systems, Greek,
485
Russian and other Cyrillic-alphabet systems, Hebrew, Arabic, the various
486
languages of India, Chinese, Japanese, Korean, and others. The existing
487
Unicode symbols include chess pieces, astrological signs, gaming symbols,
488
telephones, pointing fingers, etc. --- just about any type of FIGcharacter
489
you may wish to create. Unicode is constantly (but slowly) being extended
490
to handle new writing systems and symbols. Information on Unicode is
491
available at http://www.unicode.org and at ftp://unicode.org .
492
493
Unicode, Latin-1, and ASCII all specify the same meanings for overlapping
494
character codes: ASCII 65 = Latin-1 65 = Unicode 65 = "A", formally known
495
as "LATIN CAPITAL LETTER A".
496
497
Since a keyboard usually has only about 100 keys, your computer may contain
498
a program called a "keyboard map", which will interpret certain keystrokes
499
or combinations of keystrokes as different character codes. Keyboard maps
500
use "mapping tables" to make these determinations. The appropriate keyboard
501
activity for a given character code may involve several keystrokes. Almost
502
all systems are capable of handling at least 8-bit character sets (containing
503
256 characters), so there is always an active keyboard map, at least for
504
those characters which are not actually painted on the keys. (United States
505
users may not even know that their computer can interpret special keystrokes.
506
Such keystrokes may be something similar to holding down the ALT key while
507
typing a character code on the numeric keypad. Try it!)
508
509
Below are characters 160 through 255, AS REPRESENTED ON YOUR SYSTEM.
510
511
������������������������������������������������
512
������������������������������������������������
513
514
IMPORTANT NOTE: Depending on which character set is active on your system,
515
you may see different characters. This document (like all computer
516
documents) does not contains characters per se, only bytes. What you see
517
above is your particular computer's representation of these byte values.
518
In other words, your active character set. However, if it is Latin-1, the
519
first visible character is an inverted "!", and the last is an umlauted "y".
520
Although we can safely assume your computer has ASCII, it does not
521
necessarily have the Latin-1 character set active.
522
523
What does all this have to do with FIGfonts???
524
525
First, it should be evident that it is best to use only ASCII characters for
526
sub-characters when possible. This will ensure portability to different
527
platforms.
528
529
FIGlet has gained international popularity, but early versions were made to
530
handle only FIGcharacters with assigned character codes corresponding to
531
ASCII. So, over the years there have been four methods used to create
532
"virtual mapping tables" within the program itself:
533
534
The first method was simply to create FIGcharacters which do not
535
look like the ASCII character set implies. For example, a
536
FIGfont might contain Greek letters, and within its comments, it
537
may say, "If you type A, you'll get a Greek Alpha" etc. With
538
the advent of newer features, it is preferable not to use this
539
method. Instead, when possible, add new FIGcharacters to
540
existing FIGfonts or create new FIGfonts with FIGcharacters coded
541
to match the expectations of ASCII/Latin-1/Unicode, and create an
542
appropriate control file. (See "CONTROL FILES" below.) Remember
543
that Unicode includes almost any character for which you may want
544
to create a FIGcharacter.
545
546
The second method was very specific, to accommodate the German
547
audience. A special option was added to the FIGlet program
548
which would re-route input characters "[", "\", and "]" to
549
umlauted A, O and U, while "{", "|", and "}" would become the
550
respective lowercase versions of these. Also, "~" was made to
551
become the s-z character when this special option was used. This
552
was called "the -D option." The addition of this feature meant
553
that all compatible FIGfonts must contain these Deutsch (German)
554
FIGcharacters, in addition to the ASCII FIGcharacters. Although
555
this option is still available in the most recent version, it is
556
no longer necessary, as the same result can be achieved by the
557
newer features described below. However, the requirement for
558
Deutsch FIGcharacters remains for backward compatibility. (Or at
559
least zero-width FIGcharacters in their place.)
560
561
Later, FIGlet was made to accept control files, which are quite
562
literally a form of mapping table. (See "CONTROL FILES" below.)
563
This was a significant advance for internationalization.
564
565
FIGlet 2.2 can now accept specially encoded formats of input
566
text which imply more than one byte per character.
567
568
569
CREATING FIGFONTS
570
======== ========
571
572
NOTE: FIGWin 1.0 is packaged with a program called FIGfont Editor for Windows
573
1.0, which is just that. There is no need to read further if you intend to
574
use it. However, the section "CONTROL FILES" below is still relevant.
575
576
Since a FIGfont file is a text file, it can be created with any text editing
577
program on any platform, and will still be compatible with FIGdrivers on all
578
operating systems, except that the bytes used to indicate the end of each
579
text line may vary. (PC's use carriage return and linefeed at the end of
580
each line, Macintosh uses carriage return only, and UNIX uses linefeed only.)
581
582
This minor difference among operating systems is handled easily by setting
583
your FTP program to ASCII mode during upload or download. So there is no
584
need to be concerned about this as long as you remember to do this during
585
file transfer.
586
587
The filename of a FIGfont file must end with ".flf", which stands for
588
"<F>IG<L>ettering <F>ont". The first part of the filename should contain
589
only letters, and should be lowercase on operating systems which permit case
590
sensitive filenames. The filename should be unique in the first 8
591
characters, since some older file systems truncate longer filenames.
592
593
It is easier to modify an existing FIGfont than it is to create a new one
594
from scratch. The first step is to read and understand this document.
595
You may want to load "standard.flf" or another FIGfont into a text editor as
596
an example while you read.
597
598
A FIGfont file contains three portions: a header line, comments, and
599
FIGcharacter data.
600
601
602
THE HEADER LINE
603
604
The header line gives information about the FIGfont. Here is an example
605
showing the names of all parameters:
606
607
flf2a$ 6 5 20 15 3 0 143 229 NOTE: The first five characters in
608
| | | | | | | | | | the entire file must be "flf2a".
609
/ / | | | | | | | \
610
Signature / / | | | | | \ Codetag_Count
611
Hardblank / / | | | \ Full_Layout*
612
Height / | | \ Print_Direction
613
Baseline / \ Comment_Lines
614
Max_Length Old_Layout*
615
616
* The two layout parameters are closely related and fairly complex.
617
(See "INTERPRETATION OF LAYOUT PARAMETERS".)
618
619
For those desiring a quick explanation, the above line indicates that this
620
FIGfont uses "$" to represent the hardblank in FIGcharacter data, it has
621
FIGcharacters which are 6 lines tall, 5 of which are above the baseline, no
622
line in the FIGfont data is more than 20 columns wide, the default horizontal
623
layout is represented by the number 15, there are 3 comment lines, the
624
default print direction for this FIGfont is left-to-right, a complete
625
description of default and possible horizontal and vertical layouts is
626
represented by the number 143, and there are 229 code-tagged characters.
627
628
The first seven parameters are required. The last three (Direction,
629
Full_Layout, and Codetag_Count, are not. This allows for backward
630
compatibility with older FIGfonts, but a FIGfont without these parameters would
631
force a FIGdriver to "guess" (by means not described in this document) the
632
information it would expect to find in Full_Layout. For this reason, inclusion
633
of all parameters is strongly recommended.
634
635
Future versions of this standard may add more parameters after Codetag_Count.
636
637
A description of each parameter follows:
638
639
Signature
640
641
The signature is the first five characters: "flf2a". The first four
642
characters "flf2" identify the file as compatible with FIGlet version 2.0 or
643
later (and FIGWin 1.0). The "a" is currently ignored, but cannot be omitted.
644
Different characters in the "a" location may mean something in future
645
versions of this standard. If so, you can be sure your FIGfonts will still
646
work if this character is "a".
647
648
Hardblank
649
650
Immediately following the signature is the hardblank character. The
651
hardblank character in the header line defines which sub-character will be
652
used to represent hardblanks in the FIGcharacter data.
653
654
By convention, the usual hardblank is a "$", but it can be any character
655
except a blank (space), a carriage-return, a newline (linefeed) or a null
656
character. If you want the entire printable ASCII set available to use, make
657
the hardblank a "delete" character (character code 127). With the exception
658
of delete, it is inadvisable to use non-printable characters as a hardblank.
659
660
Height
661
662
The Height parameter specifies the consistent height of every FIGcharacter,
663
measured in sub-characters. Note that ALL FIGcharacters in a given FIGfont
664
have the same height, since this includes any empty space above or below.
665
This is a measurement from the top of the tallest FIGcharacter to the bottom
666
of the lowest hanging FIGcharacter, such as a lowercase g.
667
668
Baseline
669
670
The Baseline parameter is the number of lines of sub-characters from the
671
baseline of a FIGcharacter to the top of the tallest FIGcharacter. The
672
baseline of a FIGfont is an imaginary line on top of which capital letters
673
would rest, while the tails of lowercase g, j, p, q, and y may hang below.
674
In other words, Baseline is the height of a FIGcharacter, ignoring any
675
descenders.
676
677
This parameter does not affect the output of FIGlet 2.2 or FIGWin 1.0, but
678
future versions or other future FIGdrivers may use it. The Baseline
679
parameter should be correctly set to reflect the true baseline as described
680
above. It is an error for Baseline to be less than 1 or greater than the
681
Height parameter.
682
683
Max_Length
684
685
The Max_Length parameter is the maximum length of any line describing a
686
FIGcharacter. This is usually the width of the widest FIGcharacter, plus 2
687
(to accommodate endmarks as described later.) However, you can (and probably
688
should) set Max_Length slightly larger than this as a safety measure in case
689
your FIGfont is edited to include wider FIGcharacters. FIGlet (but not
690
FIGWin 1.0) uses this number to minimize the memory taken up by a FIGfont,
691
which is important in the case of FIGfonts with many FIGcharacters.
692
693
Old_Layout
694
695
(See "INTERPRETATION OF LAYOUT PARAMETERS" below.)
696
697
Comment_Lines
698
699
Between the first line and the actual FIGcharacters of the FIGfont are the
700
comment lines. The Comment_Lines parameter specifies how many lines there
701
are. Comments are optional, but recommended to properly document the origin
702
of a FIGfont.
703
704
Print_Direction
705
706
The Print_Direction parameter tells which direction the font is to be
707
printed by default. A value of 0 means left-to-right, and 1 means
708
right-to-left. If this parameter is absent, 0 (left-to-right) is assumed.
709
Print_Direction may not specify vertical print, although FIGdrivers are
710
capable of vertical print. Versions of FIGlet prior to 2.1 ignore this
711
parameter.
712
713
Full_Layout
714
715
(See "INTERPRETATION OF LAYOUT PARAMETERS" just below.)
716
717
Codetag_Count
718
719
Indicates the number of code-tagged (non-required) FIGcharacters in this
720
FIGfont. This is always equal to the total number of FIGcharacters in the font
721
minus 102. This parameter is typically ignored by FIGdrivers, but can be
722
used to verify that no characters are missing from the end of the FIGfont.
723
The chkfont program will display the number of codetagged characters
724
in the FIGfont on which it is run, making it easy to insert this parameter
725
after a FIGfont is written.
726
727
728
INTERPRETATION OF LAYOUT PARAMETERS
729
730
Full_Layout describes ALL information about horizontal and vertical layout:
731
the default layout modes and potential smushing rules, even when smushing is
732
not a default layout mode.
733
734
Old_Layout does not include all of the information desired by the most
735
recent FIGdrivers, which is the inspiration for the creation of the new
736
Full_Layout parameter. Old_Layout is still required for backward
737
compatibility, and FIGdrivers must be able to interpret FIGfonts which do not
738
have the Full_Layout parameter. (See "STANDARDIZED CAPABILITIES OF CURRENT
739
AND FUTURE FIGDRIVERS".)
740
741
Versions of FIGlet prior to 2.2 do not recognize the Full_Layout parameter.
742
Documentation accompanying FIGlet versions prior to 2.2 refer to Old_Layout
743
as "smushmode", which is somewhat misleading since it can indicate layout
744
modes other than smushing.
745
746
Old_Layout and Full_Layout must contain some redundant information.
747
748
Setting the layout parameters is a matter of adding numbers together ("code
749
values"). What follows is a chart of the meanings of all code values.
750
(You may skip down to "SETTING LAYOUT PARAMETERS STEP BY STEP" if you prefer,
751
or if you find this portion confusing.)
752
753
Full_Layout: (Legal values 0 to 32767)
754
755
1 Apply horizontal smushing rule 1 when smushing
756
2 Apply horizontal smushing rule 2 when smushing
757
4 Apply horizontal smushing rule 3 when smushing
758
8 Apply horizontal smushing rule 4 when smushing
759
16 Apply horizontal smushing rule 5 when smushing
760
32 Apply horizontal smushing rule 6 when smushing
761
64 Horizontal fitting (kerning) by default
762
128 Horizontal smushing by default (Overrides 64)
763
256 Apply vertical smushing rule 1 when smushing
764
512 Apply vertical smushing rule 2 when smushing
765
1024 Apply vertical smushing rule 3 when smushing
766
2048 Apply vertical smushing rule 4 when smushing
767
4096 Apply vertical smushing rule 5 when smushing
768
8192 Vertical fitting by default
769
16384 Vertical smushing by default (Overrides 8192)
770
771
When no smushing rules are included in Full_Layout for a given axis, the
772
meaning is that universal smushing shall occur, either by default or when
773
requested.
774
775
Old_Layout: (Legal values -1 to 63)
776
777
-1 Full-width layout by default
778
0 Horizontal fitting (kerning) layout by default*
779
1 Apply horizontal smushing rule 1 by default
780
2 Apply horizontal smushing rule 2 by default
781
4 Apply horizontal smushing rule 3 by default
782
8 Apply horizontal smushing rule 4 by default
783
16 Apply horizontal smushing rule 5 by default
784
32 Apply horizontal smushing rule 6 by default
785
786
* When Full_Layout indicates UNIVERSAL smushing as a horizontal default
787
(i.e., when none of the code values of horizontal smushing rules are included
788
and code value 128 is included in Full_Layout) Old_Layout must be set to 0
789
(zero). Older FIGdrivers which cannot read the Full_Layout parameter are
790
also incapable of universal smushing. Therefore they would be directed to
791
the "next best thing", which is horizontal fitting (kerning).
792
793
NOTE: You should NOT add the -1 value to any positive code value for
794
Old_Layout. This would be a logical contradiction.
795
796
See "STANDARDIZED CAPABILITIES OF CURRENT AND FUTURE FIGDRIVERS" for the
797
behavior of a FIGdriver when the Full_Layout parameter is absent (presumably
798
in an older FIGfont).
799
800
The following rules establish consistency between Old_Layout and Full_Layout.
801
802
If full width is to be the horizontal default:
803
Old_Layout must be -1.
804
Full_Layout must NOT include code values 64 nor 128.
805
806
If horizontal fitting (kerning) is to be default:
807
Old_Layout must be 0.
808
Full_Layout must include code value 64.
809
Full_Layout must NOT include code value 128.
810
811
If CONTROLLED smushing is to be the horizontal default:
812
Old_Layout must be a positive number, represented by the added
813
code values of all desired horizontal smushing rules.
814
Full_Layout must include the code values for the SAME set of
815
horizontal smushing rules as included in Old_Layout.
816
Full_Layout must include code value 128.
817
818
If UNIVERSAL smushing is to be the horizontal default:
819
Old_Layout must be 0.
820
Full_Layout must include code value 128.
821
Full_Layout must NOT include any code value under 64.
822
823
In general terms, if Old_Layout specifies horizontal smushing rules,
824
Full_Layout must specify the same set of horizontal rules, and both must
825
indicate the same horizontal default layout mode.
826
827
828
SETTING LAYOUT PARAMETERS STEP-BY-STEP
829
830
The following step-by-step process will yield correct and consistent values
831
for the two layout parameters. You may skip this if you find the
832
explanations above easier to use.
833
834
Step 1: Start with 0 for both numbers.
835
836
Write "Old_Layout" and "Full_Layout" on a piece of paper.
837
Write the number 0 next to each.
838
The number 0 may be crossed out and changed several times below.
839
Go to step 2.
840
841
Step 2: Set the DEFAULT HORIZONTAL LAYOUT MODE.
842
843
If you want to use FULL WIDTH as the default
844
Make Old_Layout -1
845
Go to step 3.
846
If you want to use HORIZONTAL FITTING (kerning) as the default
847
Make Full_Layout 64
848
Go to step 3.
849
If you want to use HORIZONTAL SMUSHING as the default
850
Make Full_Layout 128
851
Go to step 3.
852
853
Step 3: Specify HOW TO SMUSH HORIZONTALLY WHEN SMUSHING.
854
855
If you want to use UNIVERSAL smushing for the horizontal axis
856
Go to step 4.
857
If you want to use CONTROLLED smushing for the horizontal axis
858
Add together the code values for all the horizontal smushing
859
rules you want from the list below to get the horizontal
860
smushing rules total.
861
862
EQUAL CHARACTER SMUSHING 1
863
UNDERSCORE SMUSHING 2
864
HIERARCHY SMUSHING 4
865
OPPOSITE PAIR SMUSHING 8
866
BIG X SMUSHING 16
867
HARDBLANK SMUSHING 32
868
869
Horizontal smushing rules total: ___
870
871
If Full_Layout is currently 128
872
Change Old_Layout to the horizontal smushing rules total.
873
Increase Full_Layout by the horizontal smushing rules total.
874
Go to Step 4.
875
If Full_Layout is currently 0 or 64
876
Increase Full_Layout by the horizontal smusing rules total.
877
Go to Step 4.
878
879
Step 4: Set the DEFAULT VERTICAL LAYOUT MODE.
880
881
If you want to use FULL HEIGHT as the default
882
Go to step 5.
883
If you want to use VERTICAL FITTING as the default
884
Increase Full_Layout by 8192.
885
Go to step 5.
886
If you want to use VERTICAL SMUSHING as the default
887
Increase Full_Layout by 16384.
888
Go to step 5.
889
890
Step 5: Specify HOW TO SMUSH VERTICALLY WHEN SMUSHING.
891
892
If you want to use UNIVERSAL smushing for the vertical axis
893
Go to step 6.
894
If you want to use CONTROLLED smushing for the vertical axis
895
Add together the code values for all the vertical smushing
896
rules you want from the list below to get the vertical
897
smushing rules total.
898
899
EQUAL CHARACTER SMUSHING 256
900
UNDERSCORE SMUSHING 512
901
HIERARCHY SMUSHING 1024
902
HORIZONTAL LINE SMUSHING 2048
903
VERTICAL LINE SUPERSMUSHING 4096
904
905
Vertical smushing rules total: ____
906
907
Increase Full_Layout by the vertical smushing rules total.
908
Go to step 6.
909
910
Step 6: You're done.
911
912
The resulting value of Old_Layout will be a number from -1 to 63.
913
The resulting value of Full_Layout will be a number from 0 and 32767.
914
915
916
FIGFONT COMMENTS
917
918
After the header line are FIGfont comments. The comments can be as many
919
lines as you like, but should at least include your name and Email address.
920
Here is an example which also shows the header line.
921
922
flf2a$ 6 5 20 15 3 0 143
923
Example by Glenn Chappell <[email protected]> 8/94
924
Permission is hereby given to modify this font, as long as the
925
modifier's name is placed on a comment line.
926
927
Comments are not required, but they are appreciated. Please comment your
928
FIGfonts.
929
930
Remember to adjust the Comment_Lines parameter as you add lines to your
931
comments. Don't forget that blank lines DO count.
932
933
934
FIGCHARACTER DATA
935
============ ====
936
937
The FIGcharacter data begins on the next line after the comments and
938
continues to the end of the file.
939
940
BASIC DATA STRUCTURE
941
942
The sub-characters in the file are given exactly as they should be output,
943
with two exceptions:
944
945
1) Hardblanks should be the hardblank character specified in the
946
header line, not a blank (space).
947
948
2) Every line has one or two endmark characters, whose column
949
locations define the width of each FIGcharacter.
950
951
In most FIGfonts, the endmark character is either "@" or "#". The FIGdriver
952
will eliminate the last block of consecutive equal characters from each line
953
of sub-characters when the font is read in. By convention, the last line of
954
a FIGcharacter has two endmarks, while all the rest have one. This makes it
955
easy to see where FIGcharacters begin and end. No line should have more
956
than two endmarks.
957
958
Below is an example of the first few FIGcharacters, taken from small.flf.
959
960
NOTE: The line drawn below consisting of "|" represents the left margin of
961
your editor. It is NOT part of the FIGfont. Also note that hardblanks are
962
represented as "$" in this FIGfont, as would be described in the header line.
963
964
|$@
965
|$@
966
blank/space |$@
967
|$@
968
|$@@
969
| _ @
970
|| |@
971
exclamation point ||_|@
972
|(_)@
973
| @@
974
| _ _ @
975
|( | )@
976
double quote | V V @
977
| $ @
978
| @@
979
| _ _ @
980
| _| | |_ @
981
number sign ||_ . _|@
982
||_ _|@
983
| |_|_| @@
984
| @
985
| ||_@
986
dollar sign |(_-<@
987
|/ _/@
988
| || @@
989
990
Notice that each FIGcharacter occupies the same number of lines (6 lines, in
991
this case), which must also be expressed in the header line as the Height
992
parameter.
993
994
Also notice that for every FIGcharacter, there must be a consistent width
995
(length) for each line once the endmarks are removed. To do otherwise would
996
be an error.
997
998
Be aware of the vertical alignment of each FIGcharacter within its height,
999
so that all FIGcharacters will be properly lined up when printed.
1000
1001
If one of the last sub-characters in a particular FIGcharacter is "@", you
1002
should use another character for the endmark in that FIGcharacter so that
1003
the intended "@" is not interpreted as an endmark. "#" is a common
1004
alternative.
1005
1006
Load a few existing FIGfonts into your favorite text editor for other
1007
examples.
1008
1009
1010
REQUIRED FIGCHARACTERS
1011
1012
Some FIGcharacters are required, and must be represented in a specific order.
1013
Specifically: all of the printable character codes from ASCII shown in the
1014
table below, in order, plus character codes 196, 214, 220, 228, 246, 252,
1015
and 223, in that order. In Latin-1, these extra 7 characters represent the
1016
following German characters: umlauted "A", "O", "U", "a", "o" and "u"; and
1017
also "ess-zed".
1018
1019
Printable portion of the ASCII character set:
1020
1021
32 (blank/space) 64 @ 96 `
1022
33 ! 65 A 97 a
1023
34 " 66 B 98 b
1024
35 # 67 C 99 c
1025
36 $ 68 D 100 d
1026
37 % 69 E 101 e
1027
38 & 70 F 102 f
1028
39 ' 71 G 103 g
1029
40 ( 72 H 104 h
1030
41 ) 73 I 105 i
1031
42 * 74 J 106 j
1032
43 + 75 K 107 k
1033
44 , 76 L 108 l
1034
45 - 77 M 109 m
1035
46 . 78 N 110 n
1036
47 / 79 O 111 o
1037
48 0 80 P 112 p
1038
49 1 81 Q 113 q
1039
50 2 82 R 114 r
1040
51 3 83 S 115 s
1041
52 4 84 T 116 t
1042
53 5 85 U 117 u
1043
54 6 86 V 118 v
1044
55 7 87 W 119 w
1045
56 8 88 X 120 x
1046
57 9 89 Y 121 y
1047
58 : 90 Z 122 z
1048
59 ; 91 [ 123 {
1049
60 < 92 \ 124 |
1050
61 = 93 ] 125 }
1051
62 > 94 ^ 126 ~
1052
63 ? 95 _
1053
1054
Additional required Deutsch FIGcharacters, in order:
1055
1056
196 (umlauted "A" -- two dots over letter "A")
1057
214 (umlauted "O" -- two dots over letter "O")
1058
220 (umlauted "U" -- two dots over letter "U")
1059
228 (umlauted "a" -- two dots over letter "a")
1060
246 (umlauted "o" -- two dots over letter "o")
1061
252 (umlauted "u" -- two dots over letter "u")
1062
223 ("ess-zed" -- see FIGcharacter illustration below)
1063
___
1064
/ _ \
1065
| |/ /
1066
Ess-zed >>---> | |\ \
1067
| ||_/
1068
|_|
1069
1070
If you do not wish to define FIGcharacters for all of those required above,
1071
you MAY create "empty" FIGcharacters in their place by placing endmarks flush
1072
with the left margin. The Deutsch FIGcharacters are commonly created as
1073
empty. If your FIGfont includes only capital letters, please copy them to
1074
the appropriate lowercase locations, rather than leaving lowercase letters
1075
empty. A FIGfont which does not include at least all ASCII letters, a space,
1076
and a few basic punctuation marks will probably frustrate some users. (For
1077
example "@" is more frequently desired as a FIGcharacter than you may think,
1078
since Email addresses may be written as FIGures.)
1079
1080
1081
CODE TAGGED FIGCHARACTERS
1082
1083
After the required FIGcharacters, you may create FIGcharacters with any
1084
character code in the range of -2147483648 to +2147483647. (Over four
1085
billion possibilities, which is "virtual infinity" for this purpose.)
1086
One exception: character code -1 is NOT allowed for technical reasons.
1087
It is advisable to assign character codes such that the appearance of your
1088
FIGcharacters matches the expectations of ASCII/Latin-1/Unicode, with a few
1089
exceptions:
1090
1091
1) If a FIGcharacter with code 0 is present, it is treated
1092
specially. It is a FIGfont's "missing character". Whenever
1093
the FIGdriver is told to print a character which doesn't exist
1094
in the current FIGfont, it will print FIGcharacter 0. If there
1095
is no FIGcharacter 0, nothing will be printed.
1096
1097
2) If a FIGfont contains a non-Latin alphabet in character codes
1098
in the ASCII range 32-126 (which is discouraged), we have found
1099
it helpful to include a human-readable translation table as one
1100
of the FIGcharacters instead of a "glyph". Typically, the "~"
1101
would contain this table. The translation table FIGcharacter
1102
would contain a list of all the special characters in the
1103
FIGfont, along with the ASCII characters to which they
1104
correspond. Keep this table no more than 79 columns wide.
1105
(Thanks to Gedaliah Friedenberg for this idea.)
1106
1107
3) In more extensive Unicode fonts, you can assign a negative
1108
character code (other than -1) to one or more translation
1109
tables, similar to #2 above. (All Unicode character codes are
1110
positive.) And, you will most likely suggest within the
1111
comments that a user access one of several control files (See
1112
"CONTROL FILES" below) to gain access to Latin-2, Latin-3, or
1113
other 8-bit standardized character sets. The control files may
1114
redirect the "~" character to one of the negative character codes so
1115
that the translation table would display the table when "~" is
1116
given for input. Doing this allows you to still have a "~"
1117
FIGcharacter for those who do not use a control file.
1118
1119
Those FIGcharacters which are not required must have an explicit character
1120
code in a separate line preceding them, called a "code tag". A code tag
1121
contains the value of the character code, followed by whitespace (a few
1122
spaces), and perhaps an optional comment. The comment is usually the name of
1123
the FIGcharacter. The Unicode Consortium has assigned formal names to all
1124
officially accepted characters, and these may be used. An entire code tag,
1125
including the comment, should not occupy more than 95 columns. (Over 100
1126
characters here may make older versions of FIGlet crash.)
1127
1128
Here is an example, showing two code tagged FIGcharacters after the last two
1129
required Deutsch FIGcharacters. Again, the line drawn below consisting of
1130
"|" represents the left margin of your editor, and is NOT part of the FIGfont.
1131
1132
| _ _ @
1133
|(_) (_)@
1134
|| | | |@
1135
|| |_| |@
1136
| \__,_|@
1137
| @@
1138
| ___ @
1139
| / _ \@
1140
|| |/ /@
1141
|| |\ \@
1142
|| ||_/@
1143
||_| @@
1144
|161 INVERTED EXCLAMATION MARK
1145
| _ @
1146
|(_)@
1147
|| |@
1148
|| |@
1149
||_|@
1150
| @@
1151
|162 CENT SIGN
1152
| _ @
1153
| | | @
1154
| / __)@
1155
|| (__ @
1156
| \ )@
1157
| |_| @@
1158
1159
1160
A character code may be expressed in decimal (as shown above, numbers we're
1161
all familiar with), or in Octal (seldom used) or in hexadecimal.
1162
1163
Character codes expressed in octal must be preceded by "0" (zero), and if
1164
negative, "-" (minus) must precede the "0". There are eight octal digits:
1165
01234567. You may recall octal numbers from school as "base 8 numbers".
1166
1167
Character codes expressed in hexadecimal must be preceded by "0x" or "0X".
1168
(That's also a zero.) If negative, the "-" must precede the "0x". There are
1169
16 hexadecimal digits: 01234567890ABCDEF. (The "letter-digits" may also be
1170
lowercase.) Hexadecimal is "base 16".
1171
1172
It is common to express character codes less than 256 (in the range of an
1173
8-bit character set) as decimal, while FIGfonts which extend into the Unicode
1174
range would have character codes expressed in hexadecimal. This is because
1175
the Unicode Standard expresses character codes in hexadecimal, which is
1176
helpful for programmers.
1177
1178
The code tagged FIGcharacters may be listed in any order, but simple
1179
sequential order is recommended.
1180
1181
If two or more FIGcharacters have the same character code, the last one in
1182
the FIGfont is the one used. It is common for the Deutsch FIGcharacters to
1183
be given twice in a FIGfont, just to maintain a consistent order for the
1184
Latin-1 range (128 to 255).
1185
1186
It is not advisable to assign character codes in the range of 1 to 31, since
1187
this range includes control characters in ASCII. Character code 127 is a
1188
delete in ASCII, and is also not advised. Character codes 128 to 159 are
1189
additional control characters in Latin-1, and they too should not be used.
1190
All of the above are legal, technically, but are not part of what is legal
1191
for input, so they could only be accessed by use of a control file.
1192
(See "CONTROL FILES" below.) If you are still tempted to use them, consider
1193
negative character codes instead, which are meaningless in all standardized
1194
character sets.
1195
1196
Again, the character code -1 is illegal for technical reasons.
1197
1198
1199
NOTES - AVOIDING ERRORS AND GENERAL ADVICE
1200
===== ======== ====== === ======= ======
1201
1202
It is very important that every character in a font has the same height, and,
1203
once the endmarks are removed, that all the lines constituting a single
1204
FIGcharacter have the same length. Be careful also that no lines in the font
1205
file have trailing blanks (spaces), as the FIGdriver will take these to be
1206
the endmarks. (FIGWin 1.0 will not consider blanks to be endmarks.)
1207
1208
Errors in a FIGfont can be detected by using the "chkfont" program,
1209
part of the standard FIGlet package, and also available, as of this
1210
writing from http://www.figlet.org/
1211
1212
For FIGWin users, the FIGWin program will report errors when a FIGfont is
1213
read in; it is less forgiving than FIGlet, which can produce nonsense if the
1214
FIGfont is incorrectly formatted.
1215
1216
Remember that sub-characters outside of the ASCII range will not necessarily
1217
display the same way on your system as on others.
1218
1219
The blank (space) FIGcharacter should usually consist of one or two columns
1220
of hardblanks and nothing else; slanted fonts are an exception to this rule.
1221
If the space FIGcharacter does not contain any hardblanks, it will disappear
1222
when horizontal fitting (kerning) or smushing occurs.
1223
1224
Again, if you design a FIGfont, please let us know!
1225
1226
1227
CONTROL FILES
1228
======= =====
1229
1230
A FIGfont control file is a separate text file, associated with one or more
1231
FIGfonts, that indicates how to map input characters into FIGfont character
1232
codes. By default, FIGdrivers read single bytes from the input source and
1233
interpret them as Latin-1 FIGcharacters.
1234
1235
FIGlet version 2.2 (and later) can optionally interpret its input as DBCS or
1236
UTF-8 characters, making it possible to access FIGcharacters with codes
1237
outside the Latin-1 range (greater than 255).
1238
1239
In addition, though, all versions of FIGlet can use control files to
1240
transform specific character codes (or ranges of codes) as other codes
1241
(or ranges). Multiple control files can be specified, in which case multiple
1242
stages of transformation are performed.
1243
1244
The filename of a control file always ends with ".flc".
1245
1246
CONTROL FILE FORMAT
1247
1248
Control files contain several kinds of lines. Lines beginning with "#", as
1249
well as blank lines, are comment lines and are ignored. All other lines are
1250
command lines, with one of the following formats:
1251
1252
t inchar outchar
1253
t inchar1-inchar2 outchar1-outchar2
1254
number number
1255
f
1256
h
1257
j
1258
b
1259
u
1260
g{0|1|2|3} {94|96|94x94} [char]
1261
g{L|R} {0|1|2|3}
1262
1263
where "inchar", "outchar", and "char" are either Latin-1 characters
1264
representing their own codes, or else are numeric character codes preceded by
1265
a "\" character; and "number" is a numeric character code with no preceding
1266
"\" character.
1267
1268
Thus "A" represents the code 65, as does "\65", and "\0x100" represents the
1269
code 256 (100 in hexadecimal). In addition, "\ " (backslash followed by a
1270
space) represents the code 32 (space), and the following backslash sequences
1271
are also understood:
1272
1273
\a code 7 (a bell/alert)
1274
\b code 8 (a backspace)
1275
\e code 27 (an ESC character)
1276
\f code 12 (a form feed)
1277
\n code 10 (a newline/line feed)
1278
\r code 13 (a carriage return)
1279
\t code 9 (a horizontal tab)
1280
\v code 11 (a vertical tab)
1281
\\ code 92 (a backslash)
1282
1283
All of these combinations except perhaps "\\" are very unlikely to be used,
1284
but they are provided just in case they are needed.
1285
1286
Whitespace characters are used between "t" and "inchar" and between "inchar"
1287
and "outchar", but not around the "-" characters used in the second type of
1288
"t" command.
1289
1290
The term "string" refers to any number of characters represented in the
1291
format given above. The characters begin after the whitespace following the
1292
letter "s", and continue to the end of the line.
1293
1294
Anything following the first letter of an "f", "h", "j", or "u" command is
1295
ignored.
1296
1297
The first type of "t" command transforms characters with the code "inchar"
1298
into characters with the code "outchar". The second type of "t" command
1299
transforms characters in the range "inchar1" to "inchar2" as the
1300
corresponding codes in the range "outchar1" to "outchar2". Both ranges must
1301
be of the same size. The form "number number" is equivalent to a "t"
1302
command of the first type, and is provided for compatibility with the mapping
1303
tables issued by the Unicode Consortium.
1304
1305
Multiple transformation stages can be encoded in a single control file by
1306
using "f" commands to separate the stages.
1307
1308
Versions of FIGlet before 2.1 required that the first line of a control file
1309
consist of the signature string "flc2a". This signature line is still
1310
permitted in FIGlet 2.2 and later versions, but is no longer required.
1311
1312
Here is an example of a control file. The blanks at the beginning of each
1313
line are for readability only, and are not part of the file.
1314
1315
The following control file:
1316
1317
flc2a
1318
t # $
1319
t A-Z a-z
1320
1321
will map the "#" character to "$", and will also convert uppercase ASCII to
1322
lowercase ASCII.
1323
1324
If a number of consecutive "t" commands are given, then for each character
1325
processed, only the first applicable command (if any) will be executed.
1326
Consider this control file:
1327
1328
t A B
1329
t B A
1330
1331
It will swap the characters "A" and "B". If the FIGdriver reads an "A", the
1332
first command will change "A" to "B", in which case the second will not be
1333
executed. If the FIGdriver reads a "B", the first command will have no
1334
effect, and the second command will change "B" to "A". Here is another
1335
control file:
1336
1337
t A B
1338
t A C
1339
1340
In this example, the second line is never executed. In short, a sequence of
1341
"t" lines "does what it ought to".
1342
1343
More complex files, in which a single character is acted upon by several "t"
1344
commands, can be set up using an "f" command. For example:
1345
1346
flc2a
1347
t a-z A-Z
1348
f
1349
t Q ~
1350
1351
This control file specifies two transformation stages. In the first stage,
1352
lowercase ASCII letters are changed to their uppercase equivalents. The
1353
second stage maps any Q (whether original or a converted "q") into the "~"
1354
character. If the "f" command were omitted, "q" characters would remain "Q"
1355
and not be converted to "~".
1356
1357
EXTENDED COMMANDS
1358
1359
The "h", "j", "b", "u", and "g" commands are only understood by FIGlet
1360
version 2.2 or later. They control how a FIGdriver interprets bytes in the
1361
input. By default, the FIGdriver interprets each byte of input as a distinct
1362
character. This mode is suitable for most character encodings. All these
1363
commands are logically acted on before any other control file commands, no
1364
matter where in the sequence of control files they appear. They are also
1365
mutually exclusive; if more than one of these commands is found, only the
1366
last is acted on. Multiple "g" commands are permitted, however.
1367
1368
The "h" command forces the input to be interpreted in HZ mode, which is used
1369
for the HZ character encoding of Chinese text. In this mode, the sequence
1370
"~{" (which is removed from the input) signals that all following characters
1371
are two bytes long until the sequence "~}" is detected. In addition, the
1372
sequence "~~" is changed to just "~", and all other two-byte sequences
1373
beginning with "~" are removed from the input. The character code
1374
corresponding to a two-byte character is:
1375
1376
first character * 256 + second character
1377
1378
The "j" command forces the input to be interpreted in Shift-JIS mode (also
1379
called "MS-Kanji mode"). Input bytes in the ranges 128-159 and 224-239 are
1380
read as the high-order byte of a two-byte character; all other bytes are
1381
interpreted as one-byte characters. The value of a two-byte character is
1382
determined in the same way as in HZ mode.
1383
1384
The "b" command forces the input to be interpreted in DBCS mode, which is
1385
suitable for processing HZ or Shift-GB Chinese text or Korean text. Input
1386
bytes in the ranges 128-255 are read as the high-order byte of a two-byte
1387
character; all other bytes are interpreted as one-byte characters. The
1388
value of a two-byte character is determined in the same way as in HZ mode.
1389
1390
The "u" command forces the input to be interpreted in UTF-8 mode, which
1391
causes any input byte in the range 0x80 to 0xFF to be interpreted as the
1392
first byte of a multi-byte Unicode (ISO 10646) character. UTF-8 characters
1393
can be from 1 to 6 bytes long. An incorrectly formatted sequence is
1394
interpreted as the character 128 (normally an unused control character).
1395
1396
Otherwise, the input is allowed to contain ISO 2022 escape sequences, which
1397
are decoded to generate appropriate character codes. These character codes
1398
are *not* a subset of Unicode, but may be more useful in processing East
1399
Asian text. A brief explanation of ISO 2022 is given here in order to
1400
clarify how a FIGdriver should interpret it. The "g" command provides
1401
information for the ISO 2022 interpreter, and is explained below.
1402
1403
ISO 2022 text is specified using a mixture of registered character sets.
1404
At any time, up to four character sets may be available. Character sets
1405
have one of three sizes: single-byte character sets with 94 characters
1406
(e.g. ASCII), single-byte character sets with 96 characters (e.g. the top
1407
halves of ISO Latin-1 to Latin-5), or double-byte character sets with
1408
94 x 94 characters (e.g. JIS 0208X-1983). Each registered character set has
1409
a standard designating byte in the range 48 to 125; the bytes are unique withi
1410
n character set sizes, but may be reused across sizes. For example, byte 66
1411
designates the 94-character set ASCII, the 96-character set ISO Latin-2 (top
1412
half), and the 94 x 94 Japanese character set JIS 0208X-1983. In this
1413
document, the designating byte of a character set will be represented by <D>.
1414
1415
The four available character sets are labeled G0, G1, G2, and G3. Initially,
1416
G0 is the 94-character set ASCII, and G1 is the 96-character set ISO Latin-1
1417
(top half). The other character sets are unassigned. The following escape
1418
sequences (where ESC = the byte 27) specify changes to the available
1419
character sets:
1420
1421
ESC ( <D> Set G0 to the 94-character set <D>
1422
ESC ) <D> Set G1 to the 94-character set <D>
1423
ESC * <D> Set G2 to the 94-character set <D>
1424
ESC + <D> Set G3 to the 94-character set <D>
1425
ESC - <D> Set G1 to the 96-character set <D>
1426
ESC . <D> Set G2 to the 96-character set <D>
1427
ESC / <D> Set G3 to the 96-character set <D>
1428
ESC $ <D> Set G0 to the 94 x 94 character set <D>
1429
ESC $ ( <D> Set G0 to the 94 x 94 character set <D>
1430
ESC $ ) <D> Set G1 to the 94 x 94 character set <D>
1431
ESC $ * <D> Set G2 to the 94 x 94 character set <D>
1432
ESC $ + <D> Set G3 to the 94 x 94 character set <D>
1433
1434
1435
Note that G0 may not be a 96-character set, and that there are two ways to
1436
specify a 94 x 94 character set in G0, of which the first is deprecated.
1437
1438
ISO 2022 decoding affects input bytes in the ranges 33 to 126 and 160 to 255,
1439
known as "the left half" and "the right half" respectively. All other bytes,
1440
unless they belong to a control sequence shown in this document, remain
1441
unchanged. Initially, the left half is interpreted as character set G0,
1442
and the right half as character set G1. This can be changed by the following
1443
control sequences:
1444
1445
SI (byte 15) Interpret the left half as G1 characters
1446
SO (byte 14) Interpret the left half as G0 characters
1447
ESC n Interpret the left half as G2 characters
1448
ESC o Interpret the left half as G3 characters
1449
ESC ~ Interpret the right half as G1 characters
1450
ESC } Interpret the right half as G2 characters
1451
ESC | Interpret the right half as G3 characters
1452
SS2 (byte 142) Interpret next character only as G2
1453
ESC N Interpret next character only as G2
1454
SS3 (byte 143) Interpret next character only as G3
1455
ESC O Interpret next character only as G3
1456
1457
1458
This rich schema may be used in various ways. In ISO-2022-JP, the Japanese
1459
flavor of ISO 2022, only the bytes 33-126 and the G0 character set is used,
1460
and escape sequences are used to switch between ASCII, ISO-646-JP (the
1461
Japanese national variant of ASCII), and JIS 0208X-1983. In other versions,
1462
the G1 character set has 94 x 94 size, and so any byte in the range 160-255
1463
is automatically the first byte of a double-byte character.
1464
1465
FIGdrivers that support ISO 2022 do so in the following way. Each character i
1466
is decoded and assigned to a character set <D>.
1467
1468
If the character belongs to a 94-bit character set,
1469
then if its value exceeds 128, it is reduced by 128,
1470
and the value 65536 * <D> is added to it,
1471
unless <D> is 66 (ASCII).
1472
If the character belongs to a 96-bit character set,
1473
then if its value is less than 128, it is increased by 128,
1474
and the value 65536 * <D> is added to it,
1475
unless <D> is 65 (ISO Latin-1).
1476
If the character belongs to a 94 x 94 character set,
1477
then the value is the sum of:
1478
the first byte * 256,
1479
plus the second byte,
1480
plus the value 65536 * <D>.
1481
1482
1483
Thus, the character code 65 ("A") in ASCII remains 65, the character code
1484
196 in ISO Latin-1 ("A-umlaut") remains 196, the character code 65 (0x41)
1485
in ISO-646-JP (whose <D> is 74 = 0x4A) becomes 0x4A0041 =4849729, and the
1486
two-byte sequence 33 33 (0x21 0x21) in JIS 0208X-1983 (whose <D> is
1487
65 = 0x41) becomes 0x412121 = 4268321. These codes may be used in compiling
1488
FIGfonts suitable for use with ISO 2022 encoded text.
1489
1490
The initial settings of G0 through G3 and their assignments to the left half
1491
and the right half can be altered in a control file by using "g" commands,
1492
as follows:
1493
1494
g {0|1|2|3} {94|96|94x94} [<D>]
1495
1496
specifies that one of G0-G3 is a 94, 96, or 94x94 character set with
1497
designating character <D>. If no designating character is specified, then a
1498
<D> value of zero is assumed.
1499
1500
For example, the list of control commands:
1501
1502
g 0 94 B
1503
g 1 96 A
1504
1505
sets the G0 character set to ASCII (94-character set "B") and the G1
1506
character set to the top half of Latin-1 (96-character set "A"). (This is the
1507
default setting).
1508
1509
To change the initial assignments of G0 to the left half and G1 to the right
1510
half, "g" commands of the form
1511
1512
g {L|R} {0|1|2|3}
1513
1514
For example, the command:
1515
1516
g R 2
1517
1518
causes right-half bytes (in the range 160-255) to be interpreted as G2.
1519
Whether these bytes are interpreted singly or in pairs depends on the type
1520
of character set that is currently available as G2.
1521
1522
Spaces may be freely used or omitted in "g" commands.
1523
1524
The standard FIGlet distribution contains mapping tables for Latin-2 (ISO 8859-2),
1525
Latin-3 (ISO 8859-3), Latin-4 (ISO 8859-4), and Latin-5 (ISO 8859-9). They
1526
can be used with the font "standard.flf", which contains all the characters
1527
used in these standards.
1528
1529
1530
STANDARDIZED CAPABILITIES OF CURRENT AND FUTURE FIGDRIVERS
1531
============ ============ == ======= === ====== ==========
1532
1533
We assert the following as the "Law" of our intentions:
1534
1535
PROFIT
1536
1537
All future FIGdrivers shall be FREE OF CHARGE to the general public via the
1538
Internet. Any advertisements of other works by the author must be in
1539
documentation only, and limited to ONE "screenful", and shall not appear by
1540
normal program behavior, nor interfere with normal behavior. No FIGdriver
1541
shall disable itself after a set period of time or request "donations".
1542
No FIGdriver shall offer any other FIGdriver with improved capability for
1543
creating FIGures in exchange for money.
1544
1545
REQUIRED FEATURES OF FUTURE VERSIONS
1546
1547
Future FIGdrivers must read and process FIGfont files as described in this
1548
document, but are not necessarily expected to process control files, smush,
1549
perform fitting or kerning, perform vertical operations, or even produce
1550
multiple lines in output FIGures.
1551
1552
FIGDRIVER NAMES
1553
1554
Future FIGdrivers must be named to include capitalized "FIG" and shall have
1555
an incremental version number specific to its own platform.
1556
1557
BACKWARDS COMPATIBILITY OF FUTURE VERSIONS
1558
1559
Any future FIGdriver created for the same platform as an existing FIGdriver,
1560
and using the same name as the existing FIGdriver, shall be considered a new
1561
version of the preceding FIGdriver, and shall contain all historical comments
1562
of updates to past versions on the same platform, and shall have full
1563
capability of the preceding versions. If the source code is not provided to
1564
the general public, it shall be at least provided to any potential developers
1565
of later versions, and such comments relating to past versions shall be
1566
accessible to any user by other means or documentation. If a new program is
1567
created on a platform that already has an existing FIGdriver, it must be
1568
given a new and distinct name. This allows multiple FIGdrivers to exist for
1569
the same platform with different capabilities.
1570
1571
The format of FIGfonts may not be modified to be non-backwards compatible
1572
UNLESS:
1573
1574
1) The new format is easily editable as an ASCII text file,
1575
beginning with the characters "flf" followed by a sequential
1576
number.
1577
1578
2) At least all of the same information can be derived from the
1579
new format as the prior format (currently "flf2"). This
1580
includes the main comments which give credit to the FIGfont
1581
designer.
1582
1583
3) Individuals are found who are willing and have the ability to
1584
either port or develop versions for at least UNIX, DOS,
1585
Windows, and Amiga which will read both the new formats AND the
1586
prior format (currently "flf2"), and retain the capability of
1587
past versions. It is intended that this will be expanded to
1588
include Macintosh if a GUI version exists. This list of
1589
required operating systems may be reduced if an operating
1590
system falls out of popularity or increased if a new operating
1591
system for which there is a FIGdriver comes into greater
1592
popularity, according to the consensus of opinions of past
1593
developers for the most popular operating systems.
1594
1595
4) A C, Java, or other version must always exist which can
1596
receive input and instructions either from a command line, a
1597
file, or directly over the internet so that FIGures can be
1598
obtained from internet-based services without the need to
1599
download any FIGdriver.
1600
1601
5) All existing FIGfonts available from the "official" point of
1602
distribution (http://www.figlet.org/),
1603
must be converted to the new format, and offered for download
1604
alongsidethe new versions.
1605
1606
THE FUNCTION OF WORD WRAPPING
1607
1608
All future FIGdrivers should duplicate these behaviors, unless a version is
1609
only capable of outputting one-line FIGures, which is acceptable as long no
1610
preceding versions exist for its platform which can output multiple-line
1611
FIGures.
1612
1613
FIGdrivers which perform word wrapping do so by watching for blanks (spaces)
1614
in input text, making sure that the FIGure is no more wide than the maximum
1615
width allowed.
1616
1617
Input text may also include linebreaks, so that a user may specify where
1618
lines begin or end instead of relying on the word wrapping of the FIGdriver.
1619
(Linebreaks are represented by different bytes on different platforms, so
1620
each FIGdriver must watch for the appropriate linebreaks for its particular
1621
platform.)
1622
1623
When a FIGdriver word wraps and there are several consecutive blanks in input
1624
text where the wrapping occurred, the FIGdriver will disregard all blanks
1625
until the next non-blank input character is encountered. However, if blanks
1626
in input text immediately follow a linebreak, or if blanks are the first
1627
characters in the input text, the blanks will be "printed", moving any
1628
visible FIGcharacters which follow on the same output line to the right.
1629
Similarly, if an image is right-aligned, and blanks immediately precede
1630
linebreaks or the end of input text, a FIGdriver will move an entire line of
1631
output FIGcharacters to the left to make room for the blank FIGcharacters
1632
until the left margin is encountered. (If the print direction is
1633
right-to-left, everything stated in this paragraph is reversed.)
1634
1635
Word processing programs or text editors usually behave similarly in all
1636
regards to word wrapping.
1637
1638
GENERAL INTENT FOR CROSS-PLATFORM PORTABILITY
1639
1640
Currently, all versions of FIGlet are compiled from C code, while FIGWin 1.0
1641
is written in Visual Basic. Over time it is intended that a later version of
1642
FIGWin will be created using a GUI C programming language, and that the
1643
FIGlet C code shall continue to be written to be easily "plugged in" to a
1644
GUI shell. It is preferable for developers of FIGdrivers for new platforms
1645
to use C or a GUI version of C, so that when the core rendering engine of
1646
FIGlet is updated, it will be portable to other platforms.
1647
1648
CONTROL FILE COMMANDS
1649
1650
New control file commands may be added to later versions of this standard.
1651
However, the commands "c", "d", and "s" are permanently reserved and may
1652
never be given a meaning.
1653
1654
FILE COMPRESSION
1655
1656
FIGfonts (and control files) are often quite long, especially if many
1657
FIGcharacters are included, or if the FIGcharacters are large. Therefore,
1658
some FIGdrivers (at present, only FIGlet version 2.2 or later) allow
1659
compressed FIGfonts and control files.
1660
1661
The standard for FIG compression is to place the FIGfont or control file into
1662
a ZIP archive. ZIP archives can be created by the proprietary program PKZIP
1663
on DOS and Windows platforms, or by the free program Info-ZIP ZIP on almost
1664
all platforms. More information on ZIP can be obtained at
1665
http://www.cdrom.com/pub/infozip/Info-Zip.html .
1666
1667
The ZIP archive must contain only a single file. Any files in the archive
1668
after the first are ignored by FIGdrivers. In addition, the standard
1669
extension ".zip" of the archive must be changed to ".flf" or ".flc" as
1670
appropriate. It does not matter what the name of the file within the
1671
archive is.
1672
1673
1674
1675
CHART OF CAPABILITIES OF FIGLET 2.2 AND FIGWIN 1.0
1676
===== == ============ == ====== === === ====== ===
1677
1678
The following chart lists all capabilities which are either new with the
1679
release of both FIGdrivers, or is not a common capability among both.
1680
1681
FIGlet 2.2 FIGWIN 1.0
1682
Interpreting the Full_Layout parameter: Yes Yes
1683
Universal smushing: Yes Yes
1684
Supporting multi-byte input text formats: Yes No
1685
Processing control files: Yes No
1686
Changing default smushing rules: Yes No
1687
Bundled with a GUI editor of FIGfonts: No Yes
1688
Vertical fitting and smushing: No Yes
1689
1690
___________ __ _
1691
\_ _____/ ____ |__| ____ ___ __ | |
1692
| __)_ / \ | |/ _ < | || |
1693
| \ | \ | ( <_> )___ | \|
1694
/_______ /___| /\__| |\____// ____| __
1695
\/ \/\______| \/ \/
1696
1697