Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (1.38 KB)

1
#ifndef FONT_H_INCLUDED
2
#define FONT_H_INCLUDED
3

    
4
/**
5
 * @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
 */
13

    
14
/**
15
 * @brief Font.
16
 */
17
typedef struct font font_t;
18
/**
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
font_t* (font_ctor)(const char *s);
29
/**
30
 * @brief Destruct font.
31
 * @param   p   Pointer to font to be destroyed
32
 */
33
void    (font_dtor)(font_t *p);
34

    
35
/**
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
int (font_init)(void);
42
/**
43
 * @brief Get default font.
44
 *
45
 * Currently, the default font is Consolas.
46
 * @return  Pointer to default font
47
 */
48
const font_t* font_get_default(void);
49
/**
50
 * @brief Get Consolas font.
51
 * @return Pointer to Consolas font
52
 */
53
const font_t* font_get_consolas(void);
54
/**
55
 * @brief Free resources used on initialization of fonts.
56
 */
57
void (font_free)(void);
58

    
59
/**
60
 * @}
61
 */
62

    
63
#endif //FONT_H_INCLUDED