diff options
Diffstat (limited to 'firmware/font.h')
-rw-r--r-- | firmware/font.h | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/firmware/font.h b/firmware/font.h deleted file mode 100644 index b45fccbbde..0000000000 --- a/firmware/font.h +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2002 by Greg Haerr <greg@censoft.com> | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | /* | ||
20 | * Incore font and image definitions | ||
21 | */ | ||
22 | #include "config.h" | ||
23 | |||
24 | #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) | ||
25 | |||
26 | /* max static loadable fonts buffer*/ | ||
27 | #ifndef MAX_FONT_SIZE | ||
28 | #define MAX_FONT_SIZE 9000 /* max total fontsize allocation*/ | ||
29 | #endif | ||
30 | |||
31 | /* | ||
32 | * Fonts are specified by number, and used for display | ||
33 | * of menu information as well as mp3 filename data. | ||
34 | * At system startup, up to MAXFONTS fonts are initialized, | ||
35 | * either by being compiled-in, or loaded from disk. | ||
36 | * If the font asked for does not exist, then the | ||
37 | * system uses the next lower font number. Font 0 | ||
38 | * must be available at system startup. | ||
39 | * Fonts are specified in firmware/font.c. | ||
40 | */ | ||
41 | enum { | ||
42 | FONT_SYSFIXED, /* system fixed pitch font*/ | ||
43 | FONT_UI, /* system porportional font*/ | ||
44 | MAXFONTS | ||
45 | }; | ||
46 | |||
47 | /* | ||
48 | * .fnt loadable font file format definition | ||
49 | * | ||
50 | * format len description | ||
51 | * ------------------------- ---- ------------------------------ | ||
52 | * UCHAR version[4] 4 magic number and version bytes | ||
53 | * UCHAR name[64] 64 font name, space padded | ||
54 | * UCHAR copyright[256] 256 copyright info, space padded | ||
55 | * USHORT maxwidth 2 font max width in pixels | ||
56 | * USHORT height 2 font height in pixels | ||
57 | * USHORT ascent 2 font ascent (baseline) in pixels | ||
58 | * USHORT pad 2 unused, pad to 32-bit boundary | ||
59 | * ULONG firstchar 4 first character code in font | ||
60 | * ULONG defaultchar 4 default character code in font | ||
61 | * ULONG size 4 # characters in font | ||
62 | * ULONG nbits 4 # words imagebits data in file | ||
63 | * ULONG noffset 4 # longs offset data in file | ||
64 | * ULONG nwidth 4 # bytes width data in file | ||
65 | * MWIMAGEBITS bits nbits*2 image bits variable data | ||
66 | * [MWIMAGEBITS padded to 32-bit boundary] | ||
67 | * ULONG offset noffset*4 offset variable data | ||
68 | * UCHAR width nwidth*1 width variable data | ||
69 | */ | ||
70 | |||
71 | /* loadable font magic and version #*/ | ||
72 | #define VERSION "RB11" | ||
73 | |||
74 | typedef unsigned short bitmap_t; /* bitmap image unit size*/ | ||
75 | |||
76 | /* bitmap_t helper macros*/ | ||
77 | #define BITMAP_WORDS(x) (((x)+15)/16) /* image size in words*/ | ||
78 | #define BITMAP_BYTES(x) (BITMAP_WORDS(x)*sizeof(bitmap_t)) | ||
79 | #define BITMAP_BITSPERIMAGE (sizeof(bitmap_t) * 8) | ||
80 | #define BITMAP_BITVALUE(n) ((bitmap_t) (((bitmap_t) 1) << (n))) | ||
81 | #define BITMAP_FIRSTBIT (BITMAP_BITVALUE(BITMAP_BITSPERIMAGE - 1)) | ||
82 | #define BITMAP_TESTBIT(m) ((m) & BITMAP_FIRSTBIT) | ||
83 | #define BITMAP_SHIFTBIT(m) ((bitmap_t) ((m) << 1)) | ||
84 | |||
85 | /* builtin C-based proportional/fixed font structure */ | ||
86 | /* based on The Microwindows Project http://microwindows.org */ | ||
87 | struct font { | ||
88 | char * name; /* font name*/ | ||
89 | int maxwidth; /* max width in pixels*/ | ||
90 | unsigned int height; /* height in pixels*/ | ||
91 | int ascent; /* ascent (baseline) height*/ | ||
92 | int firstchar; /* first character in bitmap*/ | ||
93 | int size; /* font size in glyphs*/ | ||
94 | bitmap_t *bits; /* 16-bit right-padded bitmap data*/ | ||
95 | unsigned long *offset; /* offsets into bitmap data*/ | ||
96 | unsigned char *width; /* character widths or NULL if fixed*/ | ||
97 | int defaultchar; /* default char (not glyph index)*/ | ||
98 | long bits_size; /* # words of bitmap_t bits*/ | ||
99 | }; | ||
100 | |||
101 | /* font routines*/ | ||
102 | void font_init(void); | ||
103 | struct font* font_load(char *path); | ||
104 | struct font* font_get(int font); | ||
105 | void font_reset(void); | ||
106 | |||
107 | #else /* HAVE_LCD_BITMAP */ | ||
108 | |||
109 | #define font_init() | ||
110 | #define font_load(x) | ||
111 | |||
112 | #endif | ||
113 | |||
114 | /* ----------------------------------------------------------------- | ||
115 | * vim: et sw=4 ts=8 sts=4 tw=78 | ||
116 | */ | ||