Add rotated fonts
This commit is contained in:
+7
-2
@@ -1,8 +1,9 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O2 -Wall -W -g
|
#CFLAGS = -O2 -Wall -W -g
|
||||||
|
CFLAGS = -O0 -Wall -W -g
|
||||||
|
|
||||||
FONTDEFS = $(wildcard *.txt)
|
FONTDEFS = $(wildcard *.txt)
|
||||||
FONTS = $(FONTDEFS:.txt=.h)
|
FONTS = $(FONTDEFS:.txt=.h) $(FONTDEFS:.txt=_r.h)
|
||||||
|
|
||||||
|
|
||||||
all: fontgen $(FONTS)
|
all: fontgen $(FONTS)
|
||||||
@@ -11,6 +12,10 @@ all: fontgen $(FONTS)
|
|||||||
%.h: %.txt fontgen
|
%.h: %.txt fontgen
|
||||||
./fontgen $(@:.h=) < $^ > $@
|
./fontgen $(@:.h=) < $^ > $@
|
||||||
|
|
||||||
|
%_r.h: %.txt fontgen
|
||||||
|
./fontgen $(@:.h=) --rotate < $^ > $@
|
||||||
|
|
||||||
|
|
||||||
fontgen: fontgen.c
|
fontgen: fontgen.c
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/** @file font3x5_1.h
|
/** @file font3x5_1.h
|
||||||
@author fontgen
|
@author fontgen
|
||||||
@date 28 Sep 2010
|
@date 24 Sep 2011
|
||||||
|
|
||||||
@defgroup font3x5_1 This is a tiny 3x5 font with uppercase, digits, and symbols only.
|
@defgroup font3x5_1 This is a tiny 3x5 font with uppercase, digits, and symbols only.
|
||||||
M.P. Hayes 2 Sep 2010
|
M.P. Hayes 2 Sep 2010
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
/** @file font3x5_1_r.h
|
||||||
|
@author fontgen
|
||||||
|
@date 24 Sep 2011
|
||||||
|
|
||||||
|
@defgroup font3x5_1_r This is a tiny 3x5 font with uppercase, digits, and symbols only.
|
||||||
|
M.P. Hayes 2 Sep 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FONT3X5_1_R_H_
|
||||||
|
#define FONT3X5_1_R_H_
|
||||||
|
|
||||||
|
#define FONT3X5_1_R_WIDTH 5
|
||||||
|
#define FONT3X5_1_R_HEIGHT 3
|
||||||
|
#define FONT3X5_1_R_OFFSET 32
|
||||||
|
#define FONT3X5_1_R_SIZE 59
|
||||||
|
|
||||||
|
#ifndef FONT_WIDTH
|
||||||
|
#define FONT_WIDTH 5
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_HEIGHT
|
||||||
|
#define FONT_HEIGHT 3
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_OFFSET
|
||||||
|
#define FONT_OFFSET 32
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_SIZE_MAX
|
||||||
|
#define FONT_SIZE_MAX 59
|
||||||
|
#endif
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
static font_t font3x5_1_r =
|
||||||
|
{
|
||||||
|
.flags = 1, /* (packed) */
|
||||||
|
.width = 5,
|
||||||
|
.height = 3,
|
||||||
|
.offset = 32,
|
||||||
|
.size = 59,
|
||||||
|
.bytes = 2,
|
||||||
|
.data =
|
||||||
|
{
|
||||||
|
/* */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* ! */
|
||||||
|
0xe0, 0x02,
|
||||||
|
/* " */
|
||||||
|
0xbf, 0x5a,
|
||||||
|
/* # */
|
||||||
|
0x5f, 0x7d,
|
||||||
|
/* $ */
|
||||||
|
0xf6, 0x37,
|
||||||
|
/* % */
|
||||||
|
0x99, 0x4c,
|
||||||
|
/* & */
|
||||||
|
0xbe, 0x6a,
|
||||||
|
/* ' */
|
||||||
|
0x40, 0x04,
|
||||||
|
/* ( */
|
||||||
|
0x2e, 0x02,
|
||||||
|
/* ) */
|
||||||
|
0x20, 0x3a,
|
||||||
|
/* * */
|
||||||
|
0xea, 0x2b,
|
||||||
|
/* + */
|
||||||
|
0xc4, 0x11,
|
||||||
|
/* , */
|
||||||
|
0x10, 0x01,
|
||||||
|
/* - */
|
||||||
|
0x84, 0x10,
|
||||||
|
/* . */
|
||||||
|
0x00, 0x02,
|
||||||
|
/* / */
|
||||||
|
0x98, 0x0c,
|
||||||
|
/* 0 */
|
||||||
|
0x2e, 0x3a,
|
||||||
|
/* 1 */
|
||||||
|
0xf2, 0x43,
|
||||||
|
/* 2 */
|
||||||
|
0xb9, 0x4a,
|
||||||
|
/* 3 */
|
||||||
|
0xb1, 0x2a,
|
||||||
|
/* 4 */
|
||||||
|
0x87, 0x7c,
|
||||||
|
/* 5 */
|
||||||
|
0xb3, 0x26,
|
||||||
|
/* 6 */
|
||||||
|
0xae, 0x26,
|
||||||
|
/* 7 */
|
||||||
|
0xb9, 0x0c,
|
||||||
|
/* 8 */
|
||||||
|
0xaa, 0x2a,
|
||||||
|
/* 9 */
|
||||||
|
0xa2, 0x7c,
|
||||||
|
/* : */
|
||||||
|
0x40, 0x01,
|
||||||
|
/* ; */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* < */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* = */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* > */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* ? */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* @ */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* A */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* B */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* C */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* D */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* E */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* F */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* G */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* H */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* I */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* J */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* K */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* L */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* M */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* N */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* O */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* P */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* Q */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* R */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* S */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* T */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* U */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* V */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* W */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* X */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* Y */
|
||||||
|
0x00, 0x00,
|
||||||
|
/* Z */
|
||||||
|
0x00, 0x00,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif /* FONT3X5_1_R_H_ */
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
/** @file font5x7_1.h
|
/** @file font5x7_1.h
|
||||||
@author fontgen
|
@author fontgen
|
||||||
@date 28 Sep 2010
|
@date 24 Sep 2011
|
||||||
|
|
||||||
@defgroup font5x7_1 This is a 5x7 font with uppercase, lowercase, digits, and symbols.
|
@defgroup font5x7_1 This is a 5x7 font with uppercase, lowercase, digits, and symbols.
|
||||||
M.P. Hayes 2 Sep 2010
|
M.P. Hayes 2 Sep 2010
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
static const font_t font5x7_1 =
|
static font_t font5x7_1 =
|
||||||
{
|
{
|
||||||
.flags = 1, /* (packed) */
|
.flags = 1, /* (packed) */
|
||||||
.width = 5,
|
.width = 5,
|
||||||
|
|||||||
@@ -0,0 +1,234 @@
|
|||||||
|
/** @file font5x7_1_r.h
|
||||||
|
@author fontgen
|
||||||
|
@date 24 Sep 2011
|
||||||
|
|
||||||
|
@defgroup font5x7_1_r This is a 5x7 font with uppercase, lowercase, digits, and symbols.
|
||||||
|
M.P. Hayes 2 Sep 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FONT5X7_1_R_H_
|
||||||
|
#define FONT5X7_1_R_H_
|
||||||
|
|
||||||
|
#define FONT5X7_1_R_WIDTH 7
|
||||||
|
#define FONT5X7_1_R_HEIGHT 5
|
||||||
|
#define FONT5X7_1_R_OFFSET 32
|
||||||
|
#define FONT5X7_1_R_SIZE 95
|
||||||
|
|
||||||
|
#ifndef FONT_WIDTH
|
||||||
|
#define FONT_WIDTH 7
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_HEIGHT
|
||||||
|
#define FONT_HEIGHT 5
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_OFFSET
|
||||||
|
#define FONT_OFFSET 32
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_SIZE_MAX
|
||||||
|
#define FONT_SIZE_MAX 95
|
||||||
|
#endif
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
static font_t font5x7_1_r =
|
||||||
|
{
|
||||||
|
.flags = 1, /* (packed) */
|
||||||
|
.width = 7,
|
||||||
|
.height = 5,
|
||||||
|
.offset = 32,
|
||||||
|
.size = 95,
|
||||||
|
.bytes = 5,
|
||||||
|
.data =
|
||||||
|
{
|
||||||
|
/* */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ! */
|
||||||
|
0x80, 0xef, 0x17, 0x00, 0x00,
|
||||||
|
/* " */
|
||||||
|
0x80, 0x03, 0xe0, 0x00, 0x00,
|
||||||
|
/* # */
|
||||||
|
0x94, 0x3f, 0xe5, 0x4f, 0x01,
|
||||||
|
/* $ */
|
||||||
|
0x24, 0xd5, 0x5f, 0x25, 0x01,
|
||||||
|
/* % */
|
||||||
|
0xa3, 0x09, 0x82, 0x2c, 0x06,
|
||||||
|
/* & */
|
||||||
|
0xb6, 0x64, 0x55, 0x04, 0x05,
|
||||||
|
/* ' */
|
||||||
|
0x80, 0xc2, 0x00, 0x00, 0x00,
|
||||||
|
/* ( */
|
||||||
|
0x00, 0x8e, 0x28, 0x08, 0x00,
|
||||||
|
/* ) */
|
||||||
|
0x80, 0xa0, 0x88, 0x03, 0x00,
|
||||||
|
/* * */
|
||||||
|
0x14, 0x84, 0x0f, 0x41, 0x01,
|
||||||
|
/* + */
|
||||||
|
0x08, 0x84, 0x0f, 0x81, 0x00,
|
||||||
|
/* , */
|
||||||
|
0x00, 0x28, 0x0c, 0x00, 0x00,
|
||||||
|
/* - */
|
||||||
|
0x08, 0x04, 0x02, 0x81, 0x00,
|
||||||
|
/* . */
|
||||||
|
0x00, 0x30, 0x18, 0x00, 0x00,
|
||||||
|
/* / */
|
||||||
|
0x20, 0x08, 0x82, 0x20, 0x00,
|
||||||
|
/* 0 */
|
||||||
|
0xbe, 0x68, 0xb2, 0xe8, 0x03,
|
||||||
|
/* 1 */
|
||||||
|
0x00, 0xe1, 0x1f, 0x08, 0x00,
|
||||||
|
/* 2 */
|
||||||
|
0xc2, 0x70, 0x34, 0x69, 0x04,
|
||||||
|
/* 3 */
|
||||||
|
0xa2, 0x64, 0x32, 0x69, 0x03,
|
||||||
|
/* 4 */
|
||||||
|
0x18, 0x8a, 0xe4, 0x0f, 0x01,
|
||||||
|
/* 5 */
|
||||||
|
0xaf, 0x64, 0x32, 0x19, 0x03,
|
||||||
|
/* 6 */
|
||||||
|
0xbe, 0x64, 0x32, 0x29, 0x03,
|
||||||
|
/* 7 */
|
||||||
|
0x83, 0x40, 0x3c, 0x71, 0x00,
|
||||||
|
/* 8 */
|
||||||
|
0xb6, 0x64, 0x32, 0x69, 0x03,
|
||||||
|
/* 9 */
|
||||||
|
0xa6, 0x64, 0x32, 0xe9, 0x03,
|
||||||
|
/* : */
|
||||||
|
0x00, 0x9b, 0x0d, 0x00, 0x00,
|
||||||
|
/* ; */
|
||||||
|
0x00, 0xab, 0x0d, 0x00, 0x00,
|
||||||
|
/* < */
|
||||||
|
0x08, 0x8a, 0x28, 0x08, 0x00,
|
||||||
|
/* = */
|
||||||
|
0x14, 0x0a, 0x85, 0x42, 0x01,
|
||||||
|
/* > */
|
||||||
|
0x80, 0xa0, 0x88, 0x82, 0x00,
|
||||||
|
/* ? */
|
||||||
|
0x82, 0x40, 0x34, 0x61, 0x00,
|
||||||
|
/* @ */
|
||||||
|
0xb2, 0x64, 0x3e, 0xe8, 0x03,
|
||||||
|
/* A */
|
||||||
|
0x7c, 0x45, 0x42, 0xc1, 0x07,
|
||||||
|
/* B */
|
||||||
|
0xff, 0x64, 0x32, 0x69, 0x03,
|
||||||
|
/* C */
|
||||||
|
0xbe, 0x60, 0x30, 0x28, 0x02,
|
||||||
|
/* D */
|
||||||
|
0xff, 0x60, 0x30, 0xe8, 0x03,
|
||||||
|
/* E */
|
||||||
|
0xff, 0x64, 0x32, 0x19, 0x04,
|
||||||
|
/* F */
|
||||||
|
0xff, 0x44, 0x22, 0x11, 0x00,
|
||||||
|
/* G */
|
||||||
|
0xbe, 0x60, 0x32, 0xa9, 0x07,
|
||||||
|
/* H */
|
||||||
|
0x7f, 0x04, 0x02, 0xf1, 0x07,
|
||||||
|
/* I */
|
||||||
|
0x80, 0xe0, 0x3f, 0x08, 0x00,
|
||||||
|
/* J */
|
||||||
|
0x30, 0x20, 0x10, 0xf8, 0x03,
|
||||||
|
/* K */
|
||||||
|
0x7f, 0x04, 0x45, 0x14, 0x04,
|
||||||
|
/* L */
|
||||||
|
0x7f, 0x20, 0x10, 0x08, 0x04,
|
||||||
|
/* M */
|
||||||
|
0x7f, 0x01, 0x43, 0xf0, 0x07,
|
||||||
|
/* N */
|
||||||
|
0x7f, 0x01, 0x01, 0xf1, 0x07,
|
||||||
|
/* O */
|
||||||
|
0xbe, 0x60, 0x30, 0xe8, 0x03,
|
||||||
|
/* P */
|
||||||
|
0xff, 0x44, 0x22, 0x61, 0x00,
|
||||||
|
/* Q */
|
||||||
|
0xbe, 0x60, 0x34, 0xe4, 0x05,
|
||||||
|
/* R */
|
||||||
|
0xff, 0x44, 0x22, 0x61, 0x07,
|
||||||
|
/* S */
|
||||||
|
0xa6, 0x64, 0x32, 0x29, 0x03,
|
||||||
|
/* T */
|
||||||
|
0x81, 0xc0, 0x3f, 0x10, 0x00,
|
||||||
|
/* U */
|
||||||
|
0x3f, 0x20, 0x10, 0xf8, 0x03,
|
||||||
|
/* V */
|
||||||
|
0x1f, 0x10, 0x10, 0xf4, 0x01,
|
||||||
|
/* W */
|
||||||
|
0x3f, 0x20, 0x0e, 0xf8, 0x03,
|
||||||
|
/* X */
|
||||||
|
0x63, 0x0a, 0x82, 0x32, 0x06,
|
||||||
|
/* Y */
|
||||||
|
0x03, 0x02, 0x9e, 0x30, 0x00,
|
||||||
|
/* Z */
|
||||||
|
0xe1, 0x68, 0xb2, 0x38, 0x04,
|
||||||
|
/* [ */
|
||||||
|
0xff, 0x60, 0x10, 0x00, 0x00,
|
||||||
|
/* \ */
|
||||||
|
0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
|
/* ] */
|
||||||
|
0x80, 0x60, 0xf0, 0x0f, 0x00,
|
||||||
|
/* ^ */
|
||||||
|
0x04, 0x41, 0x40, 0x40, 0x00,
|
||||||
|
/* _ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ` */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* a */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* b */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* c */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* d */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* e */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* f */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* g */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* h */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* i */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* j */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* k */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* l */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* m */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* n */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* o */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* p */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* q */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* r */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* s */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* t */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* u */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* v */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* w */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* x */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* y */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* z */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* { */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* | */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* } */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ~ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif /* FONT5X7_1_R_H_ */
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/** @file font5x7_2.h
|
/** @file font5x7_2.h
|
||||||
@author fontgen
|
@author fontgen
|
||||||
@date 28 Sep 2010
|
@date 24 Sep 2011
|
||||||
|
|
||||||
@defgroup font5x7_2 This is a 5x7 font with uppercase, digits, and some symbols.
|
@defgroup font5x7_2 This is a 5x7 font with uppercase, digits, and some symbols.
|
||||||
M.P. Hayes 2 Sep 2010
|
M.P. Hayes 2 Sep 2010
|
||||||
|
|||||||
@@ -0,0 +1,186 @@
|
|||||||
|
/** @file font5x7_2_r.h
|
||||||
|
@author fontgen
|
||||||
|
@date 24 Sep 2011
|
||||||
|
|
||||||
|
@defgroup font5x7_2_r This is a 5x7 font with uppercase, digits, and some symbols.
|
||||||
|
M.P. Hayes 2 Sep 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FONT5X7_2_R_H_
|
||||||
|
#define FONT5X7_2_R_H_
|
||||||
|
|
||||||
|
#define FONT5X7_2_R_WIDTH 7
|
||||||
|
#define FONT5X7_2_R_HEIGHT 5
|
||||||
|
#define FONT5X7_2_R_OFFSET 32
|
||||||
|
#define FONT5X7_2_R_SIZE 71
|
||||||
|
|
||||||
|
#ifndef FONT_WIDTH
|
||||||
|
#define FONT_WIDTH 7
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_HEIGHT
|
||||||
|
#define FONT_HEIGHT 5
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_OFFSET
|
||||||
|
#define FONT_OFFSET 32
|
||||||
|
#endif
|
||||||
|
#ifndef FONT_SIZE_MAX
|
||||||
|
#define FONT_SIZE_MAX 71
|
||||||
|
#endif
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
static font_t font5x7_2_r =
|
||||||
|
{
|
||||||
|
.flags = 1, /* (packed) */
|
||||||
|
.width = 7,
|
||||||
|
.height = 5,
|
||||||
|
.offset = 32,
|
||||||
|
.size = 71,
|
||||||
|
.bytes = 5,
|
||||||
|
.data =
|
||||||
|
{
|
||||||
|
/* */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ! */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* " */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* # */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* $ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* % */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* & */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ' */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ( */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ) */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* * */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* + */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* , */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* - */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* . */
|
||||||
|
0x00, 0x00, 0x02, 0x00, 0x00,
|
||||||
|
/* / */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* 0 */
|
||||||
|
0xbe, 0x68, 0xb2, 0xe8, 0x03,
|
||||||
|
/* 1 */
|
||||||
|
0x00, 0xe1, 0x1f, 0x08, 0x00,
|
||||||
|
/* 2 */
|
||||||
|
0xc2, 0x70, 0x34, 0x69, 0x04,
|
||||||
|
/* 3 */
|
||||||
|
0xa1, 0x60, 0x71, 0x19, 0x03,
|
||||||
|
/* 4 */
|
||||||
|
0x18, 0x8a, 0xe4, 0x0f, 0x01,
|
||||||
|
/* 5 */
|
||||||
|
0xa7, 0x62, 0xb1, 0x98, 0x03,
|
||||||
|
/* 6 */
|
||||||
|
0x3c, 0x65, 0x32, 0x09, 0x03,
|
||||||
|
/* 7 */
|
||||||
|
0x81, 0x40, 0xbe, 0x30, 0x00,
|
||||||
|
/* 8 */
|
||||||
|
0xb7, 0x64, 0x32, 0x69, 0x03,
|
||||||
|
/* 9 */
|
||||||
|
0x86, 0x64, 0x32, 0xe5, 0x01,
|
||||||
|
/* : */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ; */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* < */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* = */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* > */
|
||||||
|
0x41, 0x11, 0x05, 0x01, 0x00,
|
||||||
|
/* ? */
|
||||||
|
0x82, 0x40, 0x34, 0x61, 0x00,
|
||||||
|
/* @ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* A */
|
||||||
|
0xfe, 0x48, 0x24, 0xe2, 0x07,
|
||||||
|
/* B */
|
||||||
|
0xc1, 0x7f, 0x32, 0x69, 0x03,
|
||||||
|
/* C */
|
||||||
|
0xbe, 0x60, 0x30, 0x28, 0x02,
|
||||||
|
/* D */
|
||||||
|
0xc1, 0x7f, 0x30, 0xe8, 0x03,
|
||||||
|
/* E */
|
||||||
|
0xff, 0x64, 0x32, 0x99, 0x04,
|
||||||
|
/* F */
|
||||||
|
0xff, 0x44, 0x22, 0x11, 0x00,
|
||||||
|
/* G */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* H */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* I */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* J */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* K */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* L */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* M */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* N */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* O */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* P */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* Q */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* R */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* S */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* T */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* U */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* V */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* W */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* X */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* Y */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* Z */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* [ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* \ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ] */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ^ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* _ */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* ` */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* a */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* b */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* c */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* d */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* e */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* f */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif /* FONT5X7_2_R_H_ */
|
||||||
+51
-5
@@ -11,7 +11,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
/* FIXME. This is not robust. */
|
/* FIXME. This is not robust. It's an ugly hack. Rewrite in python! */
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -127,6 +127,7 @@ int font_scan (font_t *font)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
font->comment = 0;
|
font->comment = 0;
|
||||||
|
font->interlaced = 0;
|
||||||
|
|
||||||
/* FIXME, use more robust key-value pair parsing. */
|
/* FIXME, use more robust key-value pair parsing. */
|
||||||
while (1)
|
while (1)
|
||||||
@@ -138,7 +139,8 @@ int font_scan (font_t *font)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ungetc (c, stdin);
|
ungetc (c, stdin);
|
||||||
|
|
||||||
|
/* Ignore lines starting with #, w, h, i. */
|
||||||
if (!strchr ("#whi", c))
|
if (!strchr ("#whi", c))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -308,6 +310,39 @@ static void font_print_1 (font_t *font, uint8_t symbol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void font_rotate (font_t *font, font_t *rotate_font)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
*rotate_font = *font;
|
||||||
|
rotate_font->width = font->height;
|
||||||
|
rotate_font->height = font->width;
|
||||||
|
rotate_font->data = calloc (FONT_SIZE_MAX, font->bytes);
|
||||||
|
|
||||||
|
for (i = 0; i < font->size; i++)
|
||||||
|
{
|
||||||
|
for (y = 0; y < font->height; y++)
|
||||||
|
{
|
||||||
|
for (x = 0; x < font->width; x++)
|
||||||
|
{
|
||||||
|
int bit;
|
||||||
|
int newbit;
|
||||||
|
|
||||||
|
bit = y * font->width + x;
|
||||||
|
newbit = x * font->height + y;
|
||||||
|
|
||||||
|
if (font->data[i * font->bytes + bit / CHAR_BIT]
|
||||||
|
& (1 << (bit % CHAR_BIT)))
|
||||||
|
rotate_font->data[i * font->bytes + newbit / CHAR_BIT]
|
||||||
|
|= (1 << (newbit % CHAR_BIT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void font_print (font_t *font)
|
static void font_print (font_t *font)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -316,7 +351,7 @@ static void font_print (font_t *font)
|
|||||||
char name_upper[128];
|
char name_upper[128];
|
||||||
char timestr[32];
|
char timestr[32];
|
||||||
|
|
||||||
bytes_per_char = (font->width * font->height + 8 - 1) >> 3;
|
bytes_per_char = (font->width * font->height + CHAR_BIT - 1) / CHAR_BIT;
|
||||||
|
|
||||||
for (i= 0; font->name[i]; i++)
|
for (i= 0; font->name[i]; i++)
|
||||||
name_upper[i] = toupper (font->name[i]);
|
name_upper[i] = toupper (font->name[i]);
|
||||||
@@ -441,7 +476,7 @@ int main (int argc, char **argv)
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
if (argc > 2 && !strcmp (argv[1], "-zoom"))
|
if (argc > 2 && !strcmp (argv[1], "--zoom"))
|
||||||
{
|
{
|
||||||
int zoom;
|
int zoom;
|
||||||
font_t zoom_font;
|
font_t zoom_font;
|
||||||
@@ -454,7 +489,18 @@ int main (int argc, char **argv)
|
|||||||
font = zoom_font;
|
font = zoom_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 1 && !strcmp (argv[1], "-ascii"))
|
if (argc > 1 && !strcmp (argv[1], "--rotate"))
|
||||||
|
{
|
||||||
|
font_t rotate_font;
|
||||||
|
|
||||||
|
argc -= 1;
|
||||||
|
argv += 1;
|
||||||
|
|
||||||
|
font_rotate (&font, &rotate_font);
|
||||||
|
font = rotate_font;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc > 1 && !strcmp (argv[1], "--ascii"))
|
||||||
font_draw (&font);
|
font_draw (&font);
|
||||||
else
|
else
|
||||||
font_print (&font);
|
font_print (&font);
|
||||||
|
|||||||
Reference in New Issue
Block a user