Mercurial > repos > blastem
annotate nuklear_ui/sfnt.h @ 1965:3a46ff899fa6
More correct implementation of byte printing in builtin debugger. Fix GDB debugger to use helper in backend.c for reading bytes
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 03 May 2020 23:28:42 -0700 |
parents | 4f6e8acd7b6a |
children | 369a52e302e2 |
rev | line source |
---|---|
1527
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #ifndef SFNT_H_ |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #define SFNT_H_ |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #include <stdint.h> |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 enum { |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 CONTAINER_TTF, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 CONTAINER_TTC, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 CONTAINER_DFONT |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 }; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 enum { |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 SFNT_COPYRIGHT, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 SFNT_FAMILY, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 SFNT_SUBFAMILY, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 SFNT_SUBFAMILY_UNIQUE, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 SFNT_FULL_NAME, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 SFNT_VERSION, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 SFNT_POSTSCRIPT, |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 //TODO: add the rest of the name IDs |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 }; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 typedef struct sfnt_container sfnt_container; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 typedef struct { |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 uint8_t *data; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 sfnt_container *container; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 uint32_t offset; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 uint16_t num_entries; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 } sfnt_table; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 struct sfnt_container { |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 uint8_t *blob; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 sfnt_table *tables; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 uint32_t size; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 uint8_t num_fonts; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 uint8_t container_type; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 }; |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 sfnt_container *load_sfnt(uint8_t *buffer, uint32_t size); |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 char *sfnt_name(sfnt_table *sfnt, uint16_t name_type); |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 uint8_t *sfnt_flatten(sfnt_table *sfnt, uint32_t *size_out); |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 sfnt_table *sfnt_subfamily_by_names(sfnt_container *sfnt, const char **names); |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 void sfnt_free(sfnt_container *sfnt); |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 |
4f6e8acd7b6a
Added support for TTC and dfont format true type fonts. More robust font selection on Windows
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 #endif // SFNT_H_ |