| 1 |
#include "../meta.h" |
| 2 |
|
| 3 |
#include "support/util.h" |
| 4 |
#include "bk/bkgraph.h" |
| 5 |
|
| 6 |
caryll_Buffer *otfcc_buildMeta(const table_meta *meta, const otfcc_Options *options) { |
| 7 |
if (!meta || !meta->entries.length) return NULL; |
| 8 |
bk_Block *root = bk_new_Block(b32, meta->version, // Version |
| 9 |
b32, meta->flags, // Flags |
| 10 |
b32, 0, // RESERVED |
| 11 |
b32, (uint32_t)meta->entries.length, // dataMapsCount |
| 12 |
bkover); |
| 13 |
foreach (meta_Entry *e, meta->entries) { |
| 14 |
bk_push(root, /// begin |
| 15 |
b32, e->tag, // tag |
| 16 |
p32, bk_newBlockFromStringLen(sdslen(e->data), e->data), // dataOffset |
| 17 |
b32, sdslen(e->data), // dataLength |
| 18 |
bkover); |
| 19 |
} |
| 20 |
return bk_build_Block(root); |
| 21 |
} |