Project

General

Profile

Statistics
| Revision:

root / proj / libs / graph / include / font.h @ 351

History | View | Annotate | Download (1.38 KB)

1 182 up20180642
#ifndef FONT_H_INCLUDED
2
#define FONT_H_INCLUDED
3
4 319 up20180642
/**
5 333 up20180642
 * @defgroup    font_t    font_t
6
 * @ingroup graph
7
 * @brief   Font module.
8
 *
9
 * Represents a set of glyphs that can be drawn for showing text.
10
 *
11
 * @{
12 319 up20180642
 */
13 333 up20180642
14
/**
15
 * @brief Font.
16
 */
17 314 up20180642
typedef struct font font_t;
18 319 up20180642
/**
19
 * @brief Construct font.
20
 *
21
 * The font is constructed from a provided path. That path is required to
22
 * contain glyphs with the name "ascii???.xpm2", files with format XPM2 where
23
 * instead of having "???" we have 3-digit ASCII codes, where the glyph with
24
 * that name map to that XPM2 file.
25
 * @param   s   Path to directory
26
 * @return      Pointer to font
27
 */
28 314 up20180642
font_t* (font_ctor)(const char *s);
29 319 up20180642
/**
30
 * @brief Destruct font.
31
 * @param   p   Pointer to font to be destroyed
32
 */
33
void    (font_dtor)(font_t *p);
34 314 up20180642
35 319 up20180642
/**
36
 * @brief Initialize font stuff.
37
 *
38
 * More specifically, this involves loading the default font, which is currently consolas.
39
 * @return  SUCCESS if initialization was successful, false otherwise
40
 */
41 314 up20180642
int (font_init)(void);
42 319 up20180642
/**
43
 * @brief Get default font.
44
 *
45
 * Currently, the default font is Consolas.
46
 * @return  Pointer to default font
47
 */
48 314 up20180642
const font_t* font_get_default(void);
49 319 up20180642
/**
50
 * @brief Get Consolas font.
51
 * @return Pointer to Consolas font
52
 */
53 314 up20180642
const font_t* font_get_consolas(void);
54 319 up20180642
/**
55
 * @brief Free resources used on initialization of fonts.
56
 */
57
void (font_free)(void);
58 314 up20180642
59 319 up20180642
/**
60 333 up20180642
 * @}
61 319 up20180642
 */
62 188 up20180642
63 182 up20180642
#endif //FONT_H_INCLUDED