30 Commits

Author SHA1 Message Date
Claudio Matsuoka
96756a169e Fix parameters of readfontchar()
Found by inspection, the absence of function prototypes cause the compiler
to not issue a warning about this problem.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-16 11:09:44 -02:00
Claudio Matsuoka
5f7350cae5 Add support to TLF font format
The TLF font format is used by TOIlet and is very similar to the FLF
font format, the only difference being the presence of UTF-8 encoded
Unicode characters. This patch adds TLF support to FIGlet if TLF_FONTS
is defined in Makefile.

When TLF_FONTS is defined, the internal character format is changed
to UCS-4 wide characters. System requirements are support to UTF-8
multibyte encoding, a font capable of displaying Unicode glyphs and an
implementation of C99 wchar.h.

Warning: UTF-8 characters are allowed as endmarks and sub-characters, but
not as a hardblank symbol.

Example:

$ fortune | ./figlet -fpagga
░█▀█░▀█▀░█▀█░█▀▀░▀█▀░█░█░░░█▀█░█▀▀░█▀▄░█▀▀░█▀▀░█▀█░▀█▀░░░█▀█░█▀▀
░█░█░░█░░█░█░█▀▀░░█░░░█░░░░█▀▀░█▀▀░█▀▄░█░░░█▀▀░█░█░░█░░░░█░█░█▀▀
░▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░░▀░░░░▀░░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀░▀░░▀░░░░▀▀▀░▀░░
░█▀▀░█░█░█▀▀░█▀▄░█░█░▀█▀░█░█░▀█▀░█▀█░█▀▀░░░▀█▀░█▀▀░░░█▀▀░█▀▄░█▀█░█▀█░░░
░█▀▀░▀▄▀░█▀▀░█▀▄░░█░░░█░░█▀█░░█░░█░█░█░█░░░░█░░▀▀█░░░█░░░█▀▄░█▀█░█▀▀░░░
░▀▀▀░░▀░░▀▀▀░▀░▀░░▀░░░▀░░▀░▀░▀▀▀░▀░▀░▀▀▀░░░▀▀▀░▀▀▀░░░▀▀▀░▀░▀░▀░▀░▀░░░▀░
░░░░░░░░░░░░░░░▀█▀░█░█░█▀▀░█▀█░█▀▄░█▀█░█▀▄░█▀▀
░░░░░▄▄▄░▄▄▄░░░░█░░█▀█░█▀▀░█░█░█░█░█░█░█▀▄░█▀▀
░░░░░░░░░░░░░░░░▀░░▀░▀░▀▀▀░▀▀▀░▀▀░░▀▀▀░▀░▀░▀▀▀
░█▀▀░▀█▀░█░█░█▀▄░█▀▀░█▀▀░█▀█░█▀█
░▀▀█░░█░░█░█░█▀▄░█░█░█▀▀░█░█░█░█
░▀▀▀░░▀░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-16 10:53:05 -02:00
Claudio Matsuoka
ae816570cf Add missing chkfont source to distribution package
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-13 23:51:30 -02:00
Claudio Matsuoka
b3df1e6321 Fix binary list
Otherwise figlist and showfigfonts won't be installed on make install.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-13 00:33:37 -02:00
Claudio Matsuoka
628c0297f4 Fix DESTDIR setting for fonts directory
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-12 22:13:48 -02:00
Claudio Matsuoka
5b020c2272 Updated license to 3-clause BSD
License change was discussed in the mailing list and authors agreed
to use a non-restrictive license as the AFL mandated redistribution
of source code with each copy of the binary, and could also conflict
with the GPL license.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-12 14:03:50 -02:00
Claudio Matsuoka
c4a2f0db58 Updated version number and release date
Updated to version 2.2.3, release date 12 January 2011, and also add self
to author list with current year in Copyright notice.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-12 11:01:21 -02:00
Claudio Matsuoka
7abaf77501 Add utilities to See Also section in manual
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-12 10:17:26 -02:00
Claudio Matsuoka
3635c3c5b4 Set version number to 2.2.3
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-12 00:35:48 -02:00
Claudio Matsuoka
d971045702 Update version number and changelog file
List current changes to the CHANGES file and call this version 2.3.
The version and date must be updated in several places before the
final release, including the FAQ and all man pages.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-12 00:27:50 -02:00
Claudio Matsuoka
897df1c955 Add utility man pages written by Jonathon Abbott
Add chkfont(6), figlist(6) and showfigfonts(6) manual pages contributed
by Jonathon Abbott to the Debian Project.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-12 00:11:26 -02:00
Claudio Matsuoka
6d142cab60 Add distribution package generation target
This should make distribution package generation easier. Also removed
clang-specific entries since C flags are the same used in gcc.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 21:15:30 -02:00
Claudio Matsuoka
eedfd2e55f Add Turbo C makefile
This makefile allows FIGlet to be built out-of-the-box using Turbo C++ 3.0
running maker -f Makefile.tc. To build with Turbo C++ 1.0, rename the file
to Makefile and run make.exe.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 19:47:37 -02:00
Claudio Matsuoka
6b41034f2f Address Turbo C warnings
Same case as before, return from main() using return instead of exit().

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 19:47:09 -02:00
Claudio Matsuoka
0a94e7271c Fix directory creation in install target
Also move man6 out of MANDIR to keep compatibility with modern canonical
usage of installation variables in Linux.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 18:55:30 -02:00
Claudio Matsuoka
6ab60b0cc6 Address Turbo C warnings
Return from main() using return instead of exit().

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 18:54:37 -02:00
Claudio Matsuoka
63a1f39cf4 Initialize variables to prevent compiler warning
Explicitly initialize chkfont variables to prevent compiler warning,
and remove GCC-specific pragmas that don't work in all GCC versions
anyway -- warnings were still issued on the MinGW cross-compiler and
in the FreeBSD 8.0 gcc.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 18:03:55 -02:00
Claudio Matsuoka
208b9e5134 Change makefile rules for compatibility
Not all non-GNU make(1) utility recognize $* in Makefile rule dependencies,
changed to a more compatible format to work e.g. with BSD make.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 17:58:39 -02:00
Claudio Matsuoka
f926ed97ac Address ignored return value warnings in chkfont
Actually verify return values of fgets() and fscanf() in chkfont instead
of disabling the warning.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 17:54:24 -02:00
Claudio Matsuoka
7981f92538 Add compiler definitions for clang
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 17:27:19 -02:00
Claudio Matsuoka
a2d9196f41 Address unitialized variable compiler warnings
Either initialize unitialized variables to sensible values, or supress
the warning in case the variable is always correctly initialized.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 17:14:16 -02:00
Claudio Matsuoka
e906b5fd72 Update Makefile to meet modern standards
Changed Makefile to use BINDIR as the destination for binary files instead
of DESTDIR, and reserve DESTDIR as the extra installation prefix commonly
used in package building.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 14:32:30 -02:00
Claudio Matsuoka
9b6d83988d Relicense zipio files under the MIT license
Zipio files were licensed under a restrictive license containing a clause
mandating that any modifications to the source code must be sent via e-mail
to the copyright owner. The author was contacted and permitted the files
to be relicensed under the MIT license. This should avoid any problems
restributing FIGlet as free software in Linux distributions.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 13:26:08 -02:00
Claudio Matsuoka
caf8b1fcfd Fix memory violation when smushing at line start
Smushing characters at the line start can cause the next character to
be copied to an offset before the start of the line buffer. In this
case, add an offset to source and copy to a valid destination position.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 10:59:54 -02:00
Claudio Matsuoka
7a76594dbd Add gitignore file and fix script permissions
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-11 10:16:35 -02:00
Micah Cowan
6866db6fce Fix handling of JIS X 0201 characters
The manpage mentions that the "banner" font supports katakana; this may
be verified by using the "uskata" controlfile, which maps katakana characters
into the 7-bit G0 graphical character codespace:

printf 'ABCDE' | figlet -f banner -C uskata

However, it also claims to suport mixed latin and katakana via the
controlfile jis0201; looking at the control file (without knowing anything
authoritative about the control file syntax), it does appear to (attempt to)
map katakana characters into the 8-bit character space (same positions as
with uskata, except with the high bit set, so that the 7-bit space may be
reserved for ASCII latin characters). However, it doesn't actually work:

printf '\xB1\xB2\xB3\xB4\xB5' | figlet -f banner -C jis0201

prints nothing (it should print the same as in the first example).

The jis0201.flc file appears to be a Unicode mapping file from the Unicode
Consortium, rather than a figlet control file. Also, the mapping specified
there is to half-width katakana characters (U+FF61 - U+FF9F); whereas it
appears ,from the working contents of uskata.flc, and the contents of
banner.flf, that the banner font expects the normal katakana character
codes (U+30A1 - U+30FE).

Here's the proposed control-file to replace jis0201.flc. Rather than mapping
the first 256 byte values to JIS X 201, it makes use of figlet's ISO 2022
support. So you can use low- and high-value bytes, or you can use SHIFT OUT
and SHIFT IN, or whatever. Also, it maps the katakana code points to Unicode
full-width katakana characters, rather than half-width katakana, which,
while probably incorrect, is what the banner font expects; as far as I know,
there are no other fonts for katakana, other than the katakana.flf in the
international figlet fonts tarball [available upstream]; which doesn't use
Unicode codepoints for the katakana characters, but just maps uppercase
ASCII characters to the katakana.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-10 17:25:54 -02:00
Micah Cowan
634ec7e6c8 Fix behavior of JIS0201 SHIFT-OUT and SHIFT-IN
By Micah Cowan: "the meanings of the SHIFT-OUT (0x0E) and SHIFT-IN
(0x0F) seem to be reversed: SHIFT-OUT is intended to invoke G0 into GL,
and SHIFT-IN to invoke G1 into GR; however, the command

  $ printf 'Hell\x0Er' | figlet

appears to cause figlet to interpret the final "r" as... an "r", whereas

  $ printf 'Hell\x0Fr' | figlet

causes figlet to interpret the final "r" to be interpreted as SMALL
LETTER o WITH GRAVE ACCENT. I would expect exactly the opposite results.
A quick look at iso2022() seems to verify that character code 14 is
invoking G0 to GL, rather than G1."

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-10 17:07:59 -02:00
Claudio Matsuoka
fd06fbe143 Handle memory allocation errors
Exit with return code 1 if memory allocation fails instead of just
issuing a warning and resume execution with bogus pointer values.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-10 08:12:28 -02:00
Claudio Matsuoka
27cd08716a Address compiler warnings
Add missing headers, remove unused variables, specify implicit types.
Ensure compatibility with ancient systems is maintained.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-10 08:04:29 -02:00
Claudio Matsuoka
47c9d2db33 Import FIGlet 2.2.2
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2011-01-10 07:37:04 -02:00