Debian Codegraph @

texk/web2c/mfluadir/otfcc/lib/table/LTSH.c

raw
1 #include "LTSH.h"
2
3 #include "support/util.h"
4
5
6 static INLINE void disposeLTSH(MOVE table_LTSH *ltsh) {
7 if (ltsh) { FREE(ltsh->yPels); }
8 }
9 caryll_standardRefType(table_LTSH, table_iLTSH, disposeLTSH);
10
11 table_LTSH *otfcc_readLTSH(const otfcc_Packet packet, const otfcc_Options *options) {
12 FOR_TABLE(OTFCC_CHR('L','T','S','H'), table) {
13 font_file_pointer data = table.data;
14
15 table_LTSH *LTSH;
16 NEW(LTSH);
17 LTSH->version = read_16u(data);
18 LTSH->numGlyphs = read_16u(data + 2);
19 NEW(LTSH->yPels, LTSH->numGlyphs);
20 memcpy(LTSH->yPels, data + 4, LTSH->numGlyphs);
21
22 return LTSH;
23 }
24 return NULL;
25 }
26 caryll_Buffer *otfcc_buildLTSH(const table_LTSH *ltsh, const otfcc_Options *options) {
27 if (!ltsh) return NULL;
28 caryll_Buffer *buf = bufnew();
29 bufwrite16b(buf, 0);
30 bufwrite16b(buf, ltsh->numGlyphs);
31 for (uint16_t j = 0; j < ltsh->numGlyphs; j++) {
32 bufwrite8(buf, ltsh->yPels[j]);
33 }
34 return buf;
35 }