-
Notifications
You must be signed in to change notification settings - Fork 0
/
font.h
50 lines (44 loc) · 1.22 KB
/
font.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* File: font.h
* Author: torsten.roemer@luniks.net
*
* Created on 24. April 2023, 21:21
*/
#ifndef FONT_H
#define FONT_H
#include "types.h"
/**
* A glyph with its pseudo UTF-8 code point, width and bitmap.
*/
typedef struct {
/** Pseudo UTF-8 code point of the glyph. */
const code_t code;
/** Width of the glyph. */
const width_t width;
/** Bitmap of the glyph. */
const __flash uint8_t *bitmap;
} Glyph;
/**
* Fonts available here. Since the height is the same for all glyphs,
* it is stored in the font instead of redundantly in each glyph.
*/
typedef struct {
/** Glyphs of this font. */
const __flash Glyph *glyphs;
/** Number of glyphs of this font. */
const length_t length;
/** Height of (the glyphs of) this font. */
const height_t height;
/** Color space of the glyph bitmap. */
const space_t space;
} Font;
/**
* Returns the flash address of the glyph at the given pseudo UTF-8 code
* point, i.e. 0x00f6 for U+00F6 from the given font.
* If there is no glyph for that code point, a question mark is returned.
* @param font
* @param code
* @return Glyph
*/
const __flash Glyph* getGlyphAddress(const __flash Font *font, code_t code);
#endif /* FONT_H */