New ASCII fonts based on a simple translation of the Monospace ones.
This commit is contained in:
parent
9bea723d14
commit
fb6aeb50d0
17 changed files with 88 additions and 40 deletions
27
Makefile.am
27
Makefile.am
|
@ -5,19 +5,22 @@ DIST_SUBDIRS = $(SUBDIRS)
|
||||||
EXTRA_DIST = bootstrap
|
EXTRA_DIST = bootstrap
|
||||||
AUTOMAKE_OPTIONS = dist-bzip2
|
AUTOMAKE_OPTIONS = dist-bzip2
|
||||||
|
|
||||||
|
CACA2TLF = $(top_builddir)/tools/caca2tlf
|
||||||
|
FONTDIR = $(top_builddir)/fonts
|
||||||
|
|
||||||
fonts: tools/caca2tlf FORCE
|
fonts: tools/caca2tlf FORCE
|
||||||
$(top_builddir)/tools/caca2tlf "Monospace 9" | zip \
|
$(CACA2TLF) -u "Monospace 9" | zip > $(FONTDIR)/bigmono9.tlf
|
||||||
> $(top_builddir)/fonts/bigmono9.tlf
|
$(CACA2TLF) -u "Monospace Bold 12" | zip > $(FONTDIR)/bigmono12.tlf
|
||||||
$(top_builddir)/tools/caca2tlf "Monospace Bold 12" | zip \
|
$(CACA2TLF) -h -u "Monospace 9" | zip > $(FONTDIR)/mono9.tlf
|
||||||
> $(top_builddir)/fonts/bigmono12.tlf
|
$(CACA2TLF) -h -u "Monospace Bold 12" | zip > $(FONTDIR)/mono12.tlf
|
||||||
$(top_builddir)/tools/caca2tlf --half "Monospace 9" | zip \
|
$(CACA2TLF) -q -u "Monospace 9" | zip > $(FONTDIR)/smmono9.tlf
|
||||||
> $(top_builddir)/fonts/mono9.tlf
|
$(CACA2TLF) -q -u "Monospace Bold 12" | zip > $(FONTDIR)/smmono12.tlf
|
||||||
$(top_builddir)/tools/caca2tlf --half "Monospace Bold 12" | zip \
|
$(CACA2TLF) -a "Monospace 9" | zip > $(FONTDIR)/bigascii9.tlf
|
||||||
> $(top_builddir)/fonts/mono12.tlf
|
$(CACA2TLF) -a "Monospace Bold 12" | zip > $(FONTDIR)/bigascii12.tlf
|
||||||
$(top_builddir)/tools/caca2tlf --quarter "Monospace 9" | zip \
|
$(CACA2TLF) -h -a "Monospace 9" | zip > $(FONTDIR)/ascii9.tlf
|
||||||
> $(top_builddir)/fonts/smmono9.tlf
|
$(CACA2TLF) -h -a "Monospace Bold 12" | zip > $(FONTDIR)/ascii12.tlf
|
||||||
$(top_builddir)/tools/caca2tlf --quarter "Monospace Bold 12" | zip \
|
$(CACA2TLF) -q -a "Monospace 9" | zip > $(FONTDIR)/smascii9.tlf
|
||||||
> $(top_builddir)/fonts/smmono12.tlf
|
$(CACA2TLF) -q -a "Monospace Bold 12" | zip > $(FONTDIR)/smascii12.tlf
|
||||||
|
|
||||||
webhost = poulet.zoy.org
|
webhost = poulet.zoy.org
|
||||||
webdir = /srv/libcaca.zoy.org/var/www/
|
webdir = /srv/libcaca.zoy.org/var/www/
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
|
||||||
allfonts = wideterm.tlf circle.tlf emboss.tlf emboss2.tlf future.tlf \
|
allfonts = wideterm.tlf circle.tlf emboss.tlf emboss2.tlf future.tlf \
|
||||||
|
ascii9.tlf smascii9.tlf bigascii9.tlf \
|
||||||
|
ascii12.tlf smascii12.tlf bigascii12.tlf \
|
||||||
mono9.tlf smmono9.tlf bigmono9.tlf \
|
mono9.tlf smmono9.tlf bigmono9.tlf \
|
||||||
mono12.tlf smmono12.tlf bigmono12.tlf \
|
mono12.tlf smmono12.tlf bigmono12.tlf \
|
||||||
letter.tlf smblock.tlf smbraille.tlf
|
letter.tlf smblock.tlf smbraille.tlf
|
||||||
|
|
BIN
fonts/ascii12.tlf
Normal file
BIN
fonts/ascii12.tlf
Normal file
Binary file not shown.
BIN
fonts/ascii9.tlf
Normal file
BIN
fonts/ascii9.tlf
Normal file
Binary file not shown.
BIN
fonts/bigascii12.tlf
Normal file
BIN
fonts/bigascii12.tlf
Normal file
Binary file not shown.
BIN
fonts/bigascii9.tlf
Normal file
BIN
fonts/bigascii9.tlf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,16 +1,20 @@
|
||||||
tlf2a 6 5 8 -1 13 0 0 0
|
tlf2a 6 5 8 -1 17 0 0 0
|
||||||
===============================================================================
|
===============================================================================
|
||||||
This is letter.tlf, or “Letter”, Copyright (c) 2008 Francesco Poli
|
This is letter.tlf, or “Letter”, Copyright (c) 2008 Francesco Poli
|
||||||
|
|
||||||
2008-09-21 -- Francesco Poli <frx@firenze.linux.it>
|
2008-09-21 -- Francesco Poli <frx@firenze.linux.it>
|
||||||
font creation
|
font creation
|
||||||
|
|
||||||
This font is free software; you can redistribute it and/or modify it under
|
This font is free software. It comes without any warranty, to the extent
|
||||||
|
permitted by applicable law. You can redistribute it and/or modify it under
|
||||||
the terms of the Do What The Fuck You Want To Public License, Version 2,
|
the terms of the Do What The Fuck You Want To Public License, Version 2,
|
||||||
as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
|
as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
|
||||||
details.
|
details.
|
||||||
|
|
||||||
Missing characters: many...
|
Missing characters: many...
|
||||||
|
|
||||||
|
This font is part of TOIlet’s official distribution. More information
|
||||||
|
on the TOIlet website at http://caca.zoy.org/wiki/toilet
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@
|
@
|
||||||
@
|
@
|
||||||
|
|
BIN
fonts/mono12.tlf
BIN
fonts/mono12.tlf
Binary file not shown.
BIN
fonts/mono9.tlf
BIN
fonts/mono9.tlf
Binary file not shown.
BIN
fonts/smascii12.tlf
Normal file
BIN
fonts/smascii12.tlf
Normal file
Binary file not shown.
BIN
fonts/smascii9.tlf
Normal file
BIN
fonts/smascii9.tlf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
||||||
int infocode = -1;
|
int infocode = -1;
|
||||||
|
|
||||||
cx->export = "utf8";
|
cx->export = "utf8";
|
||||||
cx->font = "smblock";
|
cx->font = "ascii9";
|
||||||
cx->dir = FONTDIR;
|
cx->dir = FONTDIR;
|
||||||
|
|
||||||
cx->term_width = 80;
|
cx->term_width = 80;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <caca.h>
|
#include <caca.h>
|
||||||
|
|
||||||
enum mode { GRAY, HALFBLOCKS, QUARTERBLOCKS } mode;
|
enum mode { GRAY, HALFBLOCKS, QUARTERBLOCKS } mode;
|
||||||
|
enum charset { ASCII, UTF8 } charset;
|
||||||
|
|
||||||
static void list_fonts(void);
|
static void list_fonts(void);
|
||||||
static void add_char(unsigned long int);
|
static void add_char(unsigned long int);
|
||||||
|
@ -39,37 +40,55 @@ unsigned int w, h, gw, fgw, gh, iw, ih;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *fontname, *extraflag;
|
char *flag1, *flag2;
|
||||||
unsigned int b, i;
|
unsigned int b, i;
|
||||||
|
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s [--half|--quarter] <font>\n", argv[0]);
|
fprintf(stderr,
|
||||||
|
"Usage: %s [--half|--quarter] [--ascii|--utf8] <font>\n",
|
||||||
|
argv[0]);
|
||||||
list_fonts();
|
list_fonts();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strcmp(argv[1], "--half") && argc >= 3)
|
if((!strcmp(argv[1], "--half") || !strcmp(argv[1], "-h")) && argc > 2)
|
||||||
{
|
{
|
||||||
extraflag = "--half ";
|
flag1 = "--half ";
|
||||||
mode = HALFBLOCKS;
|
mode = HALFBLOCKS;
|
||||||
fontname = argv[2];
|
argv++; argc--;
|
||||||
}
|
}
|
||||||
else if(!strcmp(argv[1], "--quarter") && argc >= 3)
|
else if((!strcmp(argv[1], "--quarter") || !strcmp(argv[1], "-q")) && argc > 2)
|
||||||
{
|
{
|
||||||
extraflag = "--quarter ";
|
flag1 = "--quarter ";
|
||||||
mode = QUARTERBLOCKS;
|
mode = QUARTERBLOCKS;
|
||||||
fontname = argv[2];
|
argv++; argc--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
extraflag = "";
|
flag1 = "";
|
||||||
mode = GRAY;
|
mode = GRAY;
|
||||||
fontname = argv[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
f = caca_load_font(fontname, 0);
|
if((!strcmp(argv[1], "--ascii") || !strcmp(argv[1], "-a")) && argc > 2)
|
||||||
|
{
|
||||||
|
flag2 = "--ascii ";
|
||||||
|
charset = ASCII;
|
||||||
|
argv++; argc--;
|
||||||
|
}
|
||||||
|
else if((!strcmp(argv[1], "--utf8") || !strcmp(argv[1], "-u")) && argc > 2)
|
||||||
|
{
|
||||||
|
flag2 = "--utf8 ";
|
||||||
|
charset = UTF8;
|
||||||
|
argv++; argc--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flag2 = "";
|
||||||
|
charset = ASCII;
|
||||||
|
}
|
||||||
|
|
||||||
|
f = caca_load_font(argv[1], 0);
|
||||||
if(!f)
|
if(!f)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Font \"%s\" not found.\n", argv[1]);
|
fprintf(stderr, "Font \"%s\" not found.\n", argv[1]);
|
||||||
|
@ -111,7 +130,7 @@ int main(int argc, char *argv[])
|
||||||
printf("=============================================="
|
printf("=============================================="
|
||||||
"==================================\n");
|
"==================================\n");
|
||||||
printf(" This font was automatically generated using:\n");
|
printf(" This font was automatically generated using:\n");
|
||||||
printf(" %% caca2tlf %s\"%s\"\n", extraflag, fontname);
|
printf(" %% caca2tlf %s%s\"%s\"\n", flag1, flag2, argv[1]);
|
||||||
printf("=============================================="
|
printf("=============================================="
|
||||||
"==================================\n");
|
"==================================\n");
|
||||||
|
|
||||||
|
@ -169,9 +188,23 @@ static void list_fonts(void)
|
||||||
|
|
||||||
static void add_char(unsigned long int ch)
|
static void add_char(unsigned long int ch)
|
||||||
{
|
{
|
||||||
|
static char const * chars[][16] =
|
||||||
|
{
|
||||||
|
{ "#", "$", ":", ".", " " },
|
||||||
|
{ " ", "\"", "m", "#" },
|
||||||
|
{ " ", "`", "'", "\"", ",", "[", "/", "P",
|
||||||
|
".", "\\", "]", "T", "m", "b", "d", "W" },
|
||||||
|
{ "█", "▓", "▒", "░", " " },
|
||||||
|
{ " ", "▀", "▄", "█" },
|
||||||
|
{ " ", "▘", "▝", "▀", "▖", "▌", "▞", "▛",
|
||||||
|
"▗", "▚", "▐", "▜", "▄", "▙", "▟", "█" }
|
||||||
|
};
|
||||||
|
|
||||||
|
char const **str;
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
unsigned int x, y, myw, mygw;
|
unsigned int x, y, myw, mygw;
|
||||||
|
int off = 0;
|
||||||
int full = caca_utf32_is_fullwidth(ch);
|
int full = caca_utf32_is_fullwidth(ch);
|
||||||
|
|
||||||
caca_set_canvas_size(onechar, full ? 2 : 1, 1);
|
caca_set_canvas_size(onechar, full ? 2 : 1, 1);
|
||||||
|
@ -182,33 +215,44 @@ static void add_char(unsigned long int ch)
|
||||||
mygw = full ? fgw : gw;
|
mygw = full ? fgw : gw;
|
||||||
|
|
||||||
caca_set_canvas_size(out, (full ? fgw : gw) + 2, gh);
|
caca_set_canvas_size(out, (full ? fgw : gw) + 2, gh);
|
||||||
|
caca_clear_canvas(out);
|
||||||
|
|
||||||
|
switch(charset)
|
||||||
|
{
|
||||||
|
case ASCII:
|
||||||
|
off = 0;
|
||||||
|
break;
|
||||||
|
case UTF8:
|
||||||
|
off = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case GRAY:
|
case GRAY:
|
||||||
|
str = chars[off];
|
||||||
for(y = 0; y < h; y++)
|
for(y = 0; y < h; y++)
|
||||||
for(x = 0; x < myw; x++)
|
for(x = 0; x < myw; x++)
|
||||||
{
|
{
|
||||||
uint8_t c = image[4 * (x + y * iw) + 2];
|
uint8_t c = image[4 * (x + y * iw) + 2];
|
||||||
|
|
||||||
if(c >= 0xa0)
|
if(c >= 0xa0)
|
||||||
caca_put_str(out, x, y, "█");
|
caca_put_str(out, x, y, str[0]);
|
||||||
else if(c >= 0x80)
|
else if(c >= 0x80)
|
||||||
caca_put_str(out, x, y, "▓");
|
caca_put_str(out, x, y, str[1]);
|
||||||
else if(c >= 0x40)
|
else if(c >= 0x40)
|
||||||
caca_put_str(out, x, y, "▒");
|
caca_put_str(out, x, y, str[2]);
|
||||||
else if(c >= 0x20)
|
else if(c >= 0x20)
|
||||||
caca_put_str(out, x, y, "░");
|
caca_put_str(out, x, y, str[3]);
|
||||||
else
|
else
|
||||||
caca_put_char(out, x, y, ' ');
|
caca_put_str(out, x, y, str[4]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HALFBLOCKS:
|
case HALFBLOCKS:
|
||||||
|
str = chars[off + 1];
|
||||||
for(y = 0; y < gh; y++)
|
for(y = 0; y < gh; y++)
|
||||||
for(x = 0; x < mygw; x++)
|
for(x = 0; x < mygw; x++)
|
||||||
{
|
{
|
||||||
static char const *str[] = { " ", "▀", "▄", "█" };
|
|
||||||
|
|
||||||
uint8_t p1 = image[4 * (x + y * 2 * iw) + 2];
|
uint8_t p1 = image[4 * (x + y * 2 * iw) + 2];
|
||||||
uint8_t p2 = image[4 * (x + (y * 2 + 1) * iw) + 2];
|
uint8_t p2 = image[4 * (x + (y * 2 + 1) * iw) + 2];
|
||||||
|
|
||||||
|
@ -216,15 +260,10 @@ static void add_char(unsigned long int ch)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QUARTERBLOCKS:
|
case QUARTERBLOCKS:
|
||||||
|
str = chars[off + 2];
|
||||||
for(y = 0; y < gh; y++)
|
for(y = 0; y < gh; y++)
|
||||||
for(x = 0; x < mygw; x++)
|
for(x = 0; x < mygw; x++)
|
||||||
{
|
{
|
||||||
static char const *str[] =
|
|
||||||
{
|
|
||||||
" ", "▘", "▝", "▀", "▖", "▌", "▞", "▛",
|
|
||||||
"▗", "▚", "▐", "▜", "▄", "▙", "▟", "█"
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t p1 = image[4 * (x * 2 + y * 2 * iw) + 2];
|
uint8_t p1 = image[4 * (x * 2 + y * 2 * iw) + 2];
|
||||||
uint8_t p2 = image[4 * (x * 2 + 1 + y * 2 * iw) + 2];
|
uint8_t p2 = image[4 * (x * 2 + 1 + y * 2 * iw) + 2];
|
||||||
uint8_t p3 = image[4 * (x * 2 + (y * 2 + 1) * iw) + 2];
|
uint8_t p3 = image[4 * (x * 2 + (y * 2 + 1) * iw) + 2];
|
||||||
|
|
Loading…
Reference in a new issue