| 1 |
#ifndef CARYLL_cff_CHARSET_H |
| 2 |
#define CARYLL_cff_CHARSET_H |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
#include <stdio.h> |
| 6 |
#include <stdlib.h> |
| 7 |
#include <string.h> |
| 8 |
#include "support/util.h" |
| 9 |
#include "cff-util.h" |
| 10 |
#include "cff-value.h" |
| 11 |
|
| 12 |
enum { |
| 13 |
cff_CHARSET_ISOADOBE = 0, |
| 14 |
cff_CHARSET_UNSPECED = 0, |
| 15 |
cff_CHARSET_EXPERT = 1, |
| 16 |
cff_CHARSET_EXPERTSUBSET = 2, |
| 17 |
cff_CHARSET_FORMAT0 = 3, |
| 18 |
cff_CHARSET_FORMAT1 = 4, |
| 19 |
cff_CHARSET_FORMAT2 = 5, |
| 20 |
}; |
| 21 |
|
| 22 |
// CFF Charset Structures |
| 23 |
typedef struct { |
| 24 |
uint8_t format; |
| 25 |
uint16_t *glyph; |
| 26 |
} cff_CharsetFormat0; |
| 27 |
|
| 28 |
typedef struct { |
| 29 |
uint16_t first; |
| 30 |
uint8_t nleft; |
| 31 |
} cff_CharsetRangeFormat1; |
| 32 |
|
| 33 |
typedef struct { |
| 34 |
uint8_t format; |
| 35 |
cff_CharsetRangeFormat1 *range1; |
| 36 |
} cff_CharsetFormat1; |
| 37 |
|
| 38 |
typedef struct { |
| 39 |
uint16_t first; |
| 40 |
uint16_t nleft; |
| 41 |
} cff_CharsetRangeFormat2; |
| 42 |
|
| 43 |
typedef struct { |
| 44 |
uint8_t format; |
| 45 |
cff_CharsetRangeFormat2 *range2; |
| 46 |
} cff_CharsetFormat2; |
| 47 |
|
| 48 |
typedef struct { |
| 49 |
uint32_t t; |
| 50 |
uint32_t s; // size |
| 51 |
union { |
| 52 |
cff_CharsetFormat0 f0; |
| 53 |
cff_CharsetFormat1 f1; |
| 54 |
cff_CharsetFormat2 f2; |
| 55 |
}; |
| 56 |
} cff_Charset; |
| 57 |
|
| 58 |
void cff_close_Charset(cff_Charset cset); |
| 59 |
void cff_extract_Charset(uint8_t *data, int32_t offset, uint16_t nchars, cff_Charset *charsets); |
| 60 |
caryll_Buffer *cff_build_Charset(cff_Charset cset); |
| 61 |
|
| 62 |
#endif |