annotate nuklear_ui/sfnt.h @ 2009:4ace0fef6f8f

Add support for the parts of the KMod debug ports used by SGDK
author Mike Pavone <pavone@retrodev.com>
date Mon, 19 Oct 2020 15:46:16 -0700
parents 4f6e8acd7b6a
children 369a52e302e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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_