diff options
Diffstat (limited to 'Build/source/texk/web2c/mfluadir/otfcc/lib/table/hdmx.c')
-rw-r--r-- | Build/source/texk/web2c/mfluadir/otfcc/lib/table/hdmx.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/mfluadir/otfcc/lib/table/hdmx.c b/Build/source/texk/web2c/mfluadir/otfcc/lib/table/hdmx.c new file mode 100644 index 00000000000..d20011ed046 --- /dev/null +++ b/Build/source/texk/web2c/mfluadir/otfcc/lib/table/hdmx.c @@ -0,0 +1,36 @@ +#include "hdmx.h" + +#include "support/util.h" + +static INLINE void disposeHdmx(MOVE table_hdmx *table) { + if (!table->records) return; + for (uint32_t i = 0; i < table->numRecords; i++) { + if (table->records[i].widths != NULL) FREE(table->records[i].widths); + } + FREE(table->records); +} + +caryll_standardRefType(table_hdmx, table_iHdmx, disposeHdmx); + +table_hdmx *otfcc_readHdmx(otfcc_Packet packet, const otfcc_Options *options, table_maxp *maxp) { + FOR_TABLE(OTFCC_CHR('h','d','m','x'), table) { + font_file_pointer data = table.data; + + table_hdmx *hdmx; + NEW(hdmx); + hdmx->version = read_16u(data); + hdmx->numRecords = read_16u(data + 2); + hdmx->sizeDeviceRecord = read_32u(data + 4); + NEW(hdmx->records, hdmx->numRecords); + + for (uint32_t i = 0; i < hdmx->numRecords; i++) { + hdmx->records[i].pixelSize = *(data + 8 + i * (2 + maxp->numGlyphs)); + hdmx->records[i].maxWidth = *(data + 8 + i * (2 + maxp->numGlyphs) + 1); + NEW(hdmx->records[i].widths, maxp->numGlyphs); + memcpy(hdmx->records[i].widths, data + 8 + i * (2 + maxp->numGlyphs) + 2, maxp->numGlyphs); + } + + return hdmx; + } + return NULL; +} |