Switch to a smaller default fount.
[bertos.git] / gfx / font.h
1 /*!
2  * \file
3  * <!--
4  * Copyright 2003, 2004, 2005 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See README.devlib for information.
6  * -->
7  *
8  * \version $Id$
9  *
10  * \author Stefano Fedrigo <aleph@develer.com>
11  *
12  * \brief Font 8x6 IBM-PC 8bit
13  */
14
15 /*#*
16  *#* $Log$
17  *#* Revision 1.6  2006/05/27 22:31:34  bernie
18  *#* Switch to a smaller default fount.
19  *#*
20  *#* Revision 1.5  2006/03/13 02:06:04  bernie
21  *#* FONT_HAS_GLYPH(): New macro.
22  *#*
23  *#* Revision 1.4  2006/02/15 09:10:15  bernie
24  *#* Implement prop fonts; Fix algo styles.
25  *#*
26  *#* Revision 1.3  2006/02/10 12:29:05  bernie
27  *#* Add multiple font support in bitmaps.
28  *#*
29  *#* Revision 1.2  2005/11/04 18:17:45  bernie
30  *#* Fix header guards and includes for new location of gfx module.
31  *#*
32  *#* Revision 1.1  2005/11/04 18:11:35  bernie
33  *#* Move graphics stuff from mware/ to gfx/.
34  *#*
35  *#* Revision 1.6  2005/04/11 19:10:28  bernie
36  *#* Include top-level headers from cfg/ subdir.
37  *#*
38  *#* Revision 1.5  2005/03/01 23:26:45  bernie
39  *#* Use new CPU-neutral program-memory API.
40  *#*
41  *#* Revision 1.4  2004/12/31 16:42:55  bernie
42  *#* Sanitize for non-Harvard processors.
43  *#*
44  *#* Revision 1.3  2004/08/25 14:12:09  rasky
45  *#* Aggiornato il comment block dei log RCS
46  *#*
47  *#* Revision 1.2  2004/06/03 11:27:09  bernie
48  *#* Add dual-license information.
49  *#*
50  *#* Revision 1.1  2004/05/23 15:43:16  bernie
51  *#* Import mware modules.
52  *#*
53  *#* Revision 1.2  2004/03/24 15:48:53  bernie
54  *#* Remove Copyright messages from Doxygen output
55  *#*
56  *#* Revision 1.1  2004/01/13 12:15:28  aleph
57  *#* Move font table in program memory; add font.h
58  *#*
59  *#*/
60 #ifndef GFX_FONT_H
61 #define GFX_FONT_H
62
63 #include <cfg/compiler.h> /* uint8_t */
64 #include <mware/pgm.h> /* PROGMEM */
65
66 typedef struct Font
67 {
68         /**
69          * Pointer to glyph data.
70          *
71          * Data is an array of at most 256 glyphs packed together.
72          * Raster format must be the same of the bitmap.
73          */
74         const PROGMEM uint8_t *glyph;
75
76         uint8_t width;     /**< Pixel width of character cell. */
77         uint8_t height;    /**< Pixel height of character cell. */
78
79         uint8_t first;     /**< First encoded character in glyph array. */
80         uint8_t last;      /**< Last encoded character in glyph array (inclusive). */
81
82         /** Array of glyph offsets in bytes. NULL for fixed-width fonts. */
83         const PROGMEM uint16_t *offset;
84         const PROGMEM uint8_t *widths;
85
86 } Font;
87
88
89 /** Return true if glyph \a c is available in \a font. */
90 #define FONT_HAS_GLYPH(font, c) ((c) >= (font)->first && (c) <= (font)->last)
91
92
93 /** The default font. */
94 #define default_font font_luBS14
95 extern const struct Font default_font;
96
97 #endif /* GFX_FONT_H */