comparison nuklear_ui/sfnt.h @ 1527:4f6e8acd7b6a nuklear_ui

Added support for TTC and dfont format true type fonts. More robust font selection on Windows
author Michael Pavone <pavone@retrodev.com>
date Tue, 06 Mar 2018 21:27:12 -0800
parents
children 369a52e302e2
comparison
equal deleted inserted replaced
1526:9bea1a199f15 1527:4f6e8acd7b6a
1 #ifndef SFNT_H_
2 #define SFNT_H_
3
4 #include <stdint.h>
5 enum {
6 CONTAINER_TTF,
7 CONTAINER_TTC,
8 CONTAINER_DFONT
9 };
10
11 enum {
12 SFNT_COPYRIGHT,
13 SFNT_FAMILY,
14 SFNT_SUBFAMILY,
15 SFNT_SUBFAMILY_UNIQUE,
16 SFNT_FULL_NAME,
17 SFNT_VERSION,
18 SFNT_POSTSCRIPT,
19 //TODO: add the rest of the name IDs
20 };
21
22 typedef struct sfnt_container sfnt_container;
23 typedef struct {
24 uint8_t *data;
25 sfnt_container *container;
26 uint32_t offset;
27 uint16_t num_entries;
28 } sfnt_table;
29
30 struct sfnt_container {
31 uint8_t *blob;
32 sfnt_table *tables;
33 uint32_t size;
34 uint8_t num_fonts;
35 uint8_t container_type;
36 };
37
38 sfnt_container *load_sfnt(uint8_t *buffer, uint32_t size);
39 char *sfnt_name(sfnt_table *sfnt, uint16_t name_type);
40 uint8_t *sfnt_flatten(sfnt_table *sfnt, uint32_t *size_out);
41 sfnt_table *sfnt_subfamily_by_names(sfnt_container *sfnt, const char **names);
42 void sfnt_free(sfnt_container *sfnt);
43
44 #endif // SFNT_H_