Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_font.h
1/* Copyright (C) 2017 - 2024, Thornwave Labs Inc - All Rights Reserved.
2 * Unauthorized copying of this file, via any medium is strictly prohibited.
3 * Proprietary and confidential.
4 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
5*/
6
7#ifndef _DS_FONT_H
8#define _DS_FONT_H
9
10
11#include <stdint.h>
12#include <stddef.h>
13
14
15#ifndef SCREEN_ROTATION
16#define SCREEN_ROTATION 0
17#endif
18
19
20#define GET_FONT_INNER(name, size, rotation) (&font_##name##_##size##_##rotation)
21#define GET_FONT_INNER1(name, size, rotation) GET_FONT_INNER(name, size, rotation)
22
23
24#define GET_FONT(name, size) GET_FONT_INNER1(name, size, SCREEN_ROTATION)
25#define GET_FONT_ROTATE(name, size, rotation) GET_FONT_INNER(name, size, rotation)
26
27
28
29typedef struct
30{
31 int32_t w;
32 int32_t h;
33 int32_t xoff;
34 int32_t yoff;
35 int32_t xadvance;
36
37 const char* kerning_table_prev;
38 const int8_t* kerning_table_delta;
39
40 const uint8_t* pixels;
42
43
44typedef struct
45{
46 int32_t height;
47 int32_t ascender;
48 int32_t descender;
49 const ds_bitmap_font_char_t* chars[256];
51
52
57static inline int32_t DsFontHeight(const ds_bitmap_font_t* font)
58{
59 if (font)
60 return font->ascender - font->descender;
61 else
62 return 0;
63}
64
65#endif
Definition ds_font.h:30
Definition ds_font.h:45