summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mfluadir/otfcc/lib/table/meta/build.c
blob: 2d9c327118b64356a88a134fcb6f435e2aaa5717 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "../meta.h"

#include "support/util.h"
#include "bk/bkgraph.h"

caryll_Buffer *otfcc_buildMeta(const table_meta *meta, const otfcc_Options *options) {
	if (!meta || !meta->entries.length) return NULL;
	bk_Block *root = bk_new_Block(b32, meta->version,                  // Version
	                              b32, meta->flags,                    // Flags
	                              b32, 0,                              // RESERVED
	                              b32, (uint32_t)meta->entries.length, // dataMapsCount
	                              bkover);
	foreach (meta_Entry *e, meta->entries) {
		bk_push(root,                                                    /// begin
		        b32, e->tag,                                             // tag
		        p32, bk_newBlockFromStringLen(sdslen(e->data), e->data), // dataOffset
		        b32, sdslen(e->data),                                    // dataLength
		        bkover);
	}
	return bk_build_Block(root);
}