Fixed FPS example, font functions moved to extras/fonts, added
possibility of using non-builtin fonts
This commit is contained in:
parent
dd546223bd
commit
75352783bb
10 changed files with 203 additions and 9888 deletions
|
|
@ -25,16 +25,12 @@ typedef enum
|
|||
FONT_FACE_TERMINUS_6X12_KOI8_R,
|
||||
FONT_FACE_TERMINUS_8X14_KOI8_R,
|
||||
FONT_FACE_TERMINUS_BOLD_8X14_KOI8_R,
|
||||
FONT_FACE_TERMINUS_8X16_KOI8_R,
|
||||
FONT_FACE_TERMINUS_BOLD_8X16_KOI8_R,
|
||||
FONT_FACE_TERMINUS_14X28_KOI8_R,
|
||||
FONT_FACE_TERMINUS_BOLD_14X28_KOI8_R,
|
||||
FONT_FACE_TERMINUS_16X32_KOI8_R,
|
||||
FONT_FACE_TERMINUS_BOLD_16X32_KOI8_R,
|
||||
} font_face_t;
|
||||
|
||||
#define FONT_FACE_MAX FONT_FACE_TERMINUS_BOLD_16X32_KOI8_R
|
||||
|
||||
/**
|
||||
* Character descriptor
|
||||
*/
|
||||
|
|
@ -60,8 +56,29 @@ typedef struct _font_info
|
|||
/**
|
||||
* Built-in fonts
|
||||
*/
|
||||
extern const font_info_t *fonts[];
|
||||
extern const size_t fonts_count;
|
||||
extern const font_info_t *font_builtin_fonts[];
|
||||
extern const size_t font_builtin_fonts_count;
|
||||
|
||||
/**
|
||||
* Find character decriptor in font
|
||||
* @param fnt Poniter to font information struct
|
||||
* @param c Character
|
||||
* @return Character descriptor or NULL if no character found
|
||||
*/
|
||||
inline const font_char_desc_t *font_get_char_desc(const font_info_t *fnt, char c)
|
||||
{
|
||||
return c < fnt->char_start || c > fnt->char_end
|
||||
? NULL
|
||||
: fnt->char_descriptors + c - fnt->char_start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate width of string in pixels
|
||||
* @param fnt Poniter to font information struct
|
||||
* @param s String
|
||||
* @return String width
|
||||
*/
|
||||
uint16_t font_measure_string(const font_info_t *fnt, const char *s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue