Debian Codegraph @

texk/xdvipsk/otflib/cff_types.h

raw
1 /* This is xdvipsk, an eXtended version of dvips(k) by Tomas Rokicki.
2
3 Copyright (C) 2016 by VTeX Ltd (www.vtex.lt),
4 the xdvipsk project team - Sigitas Tolusis and Arunas Povilaitis.
5
6 Program original code copyright (C) 2007-2014 by Jin-Hwan Cho and
7 Shunsaku Hirata, the dvipdfmx project team.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 */
23
24 #ifndef _CFF_TYPES_H_
25 #define _CFF_TYPES_H_
26
27 /* CFF Data Types */
28
29 #define CFF_TYPE_UNKNOWN 0
30 #define CFF_TYPE_INTEGER (1 << 0)
31 #define CFF_TYPE_REAL (1 << 1)
32 #define CFF_TYPE_NUMBER (CFF_TYPE_INTEGER|CFF_TYPE_REAL)
33 #define CFF_TYPE_BOOLEAN (1 << 2)
34 #define CFF_TYPE_SID (1 << 3)
35 #define CFF_TYPE_ARRAY (1 << 4)
36 #define CFF_TYPE_DELTA (1 << 5)
37
38 /* SID SID number */
39 #define CFF_TYPE_ROS (1 << 6)
40 /* offset(0) */
41 #define CFF_TYPE_OFFSET (1 << 7)
42 /* size offset(0) */
43 #define CFF_TYPE_SZOFF (1 << 8)
44
45 typedef unsigned char card8; /* 1-byte unsigned number */
46 typedef unsigned short card16; /* 2-byte unsigned number */
47 typedef unsigned char c_offsize; /* 1-byte unsigned number specifies the size
48 of an Offset field or fields, range 1-4 */
49 typedef unsigned long l_offset; /* 1, 2, 3, or 4-byte offset */
50 typedef unsigned short s_SID; /* 2-byte string identifier */
51
52 typedef unsigned long l_size;
53
54 typedef struct {
55 card16 count; /* number of objects stored in INDEX */
56 c_offsize offsize; /* Offset array element size, 1-4 */
57 l_offset *offset; /* Offset array, count + 1 offsets */
58 card8 *data; /* Object data */
59 } cff_index;
60
61 typedef struct {
62 card8 major; /* format major version (starting at 1) */
63 card8 minor; /* format minor version (starting at 0) */
64 card8 hdr_size; /* Header size (bytes) */
65 c_offsize offsize; /* Absolute offset (0) size */
66 } cff_header;
67
68
69 /* Dictionary */
70 typedef struct {
71 int id; /* encoded data value (as card8 or card16) */
72 const char *key; /* opname */
73 int count; /* number of values */
74 double *values; /* values */
75 } cff_dict_entry;
76
77 typedef struct {
78 int max;
79 int count;
80 cff_dict_entry *entries;
81 } cff_dict;
82
83 /* Encoding, Charset and FDSelect */
84 typedef struct
85 {
86 s_SID first; /* SID or CID, or card8 for Encoding */
87 card8 n_left; /* no. of remaining gids/codes in this range */
88 } cff_range1;
89
90 typedef struct
91 {
92 s_SID first; /* SID or CID (card16) */
93 card16 n_left; /* card16-version of range1 */
94 } cff_range2;
95
96 typedef struct
97 {
98 card8 code;
99 s_SID glyph;
100 } cff_map;
101
102 typedef struct
103 {
104 card8 format; /* if (format & 0x80) then have supplement */
105 card8 num_entries; /* number of entries */
106 union {
107 card8 *codes; /* format 0 */
108 cff_range1 *range1; /* format 1 */
109 } data;
110 card8 num_supps; /* number of supplementary data */
111 cff_map *supp; /* supplement */
112 } cff_encoding;
113
114 typedef struct
115 {
116 card8 format;
117 card16 num_entries;
118 union {
119 s_SID *glyphs; /* format 0 */
120 cff_range1 *range1; /* format 1 */
121 cff_range2 *range2; /* format 2 */
122 } data;
123 } cff_charsets;
124
125 /* CID-Keyed font specific */
126 typedef struct
127 {
128 card16 first;
129 card8 fd;
130 } cff_range3;
131
132 typedef struct
133 {
134 card8 format;
135 card16 num_entries; /* number of glyphs/ranges */
136 union {
137 card8 *fds; /* format 0 */
138 cff_range3 *ranges; /* format 3 */
139 } data;
140 /* card16 sentinel; */ /* format 3 only, must be equals to num_glyphs */
141 } cff_fdselect;
142
143 #endif /* _CFF_TYPES_H_ */