Debian Codegraph @

texk/xdvipsk/otflib/cmap_p.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 _CMAP_P_H_
25 #define _CMAP_P_H_
26
27 #include "cidsysinfo.h"
28
29 /* Mapping types, MAP_IS_NAME is not supported. */
30 #define MAP_IS_CID (1 << 0)
31 #define MAP_IS_NAME (1 << 1)
32 #define MAP_IS_CODE (1 << 2)
33 #define MAP_IS_NOTDEF (1 << 3)
34
35 #define MAP_IS_UNDEF 0
36 #define MAP_TYPE_MASK 0x00f
37
38 #define MAP_DEFINED(e) (((e) & MAP_TYPE_MASK) != MAP_IS_UNDEF ? 1 : 0)
39 #define MAP_TYPE(e) ((e) & MAP_TYPE_MASK)
40
41 /* Lookup flags */
42 #define MAP_LOOKUP_END 0
43 #define MAP_LOOKUP_CONTINUE (1 << 4)
44 #define LOOKUP_CONTINUE(f) ((f) & MAP_LOOKUP_CONTINUE)
45 #define LOOKUP_END(f) (!LOOKUP_CONTINUE((f)))
46
47 /* DEBUG */
48 #define CMAP_DEBUG_STR "CMap"
49 #define CMAP_DEBUG 3
50
51 /* Codespacerange */
52 typedef struct rangeDef {
53 int dim; /* Dimension of this codespacerange */
54 unsigned char *codeLo; /* Lower bounds of valid input code */
55 unsigned char *codeHi; /* Upper bounds of valid input code */
56 } rangeDef;
57
58 typedef struct mapDef {
59 int flag;
60 int len; /* 2 for CID, variable for Code.. */
61 unsigned char *code; /* CID (as 16-bit BE), Code ... */
62 struct mapDef *next; /* Next Subtbl for LOOKUP_CONTINUE */
63 } mapDef;
64
65 #define MEM_ALLOC_SIZE 4096
66 typedef struct mapData {
67 long pos; /* Position of next free data segment */
68 unsigned char *data; /* CID, Code... MEM_ALLOC_SIZE bytes */
69 struct mapData *prev; /* Previous mapData data segment */
70 } mapData;
71
72 struct CMap {
73 char *name;
74 int type; /* CMapType: 1 for usual CMaps,
75 * 2 for ToUnicode CMaps,
76 * 0 for IDENTITY is also defined for convenience.
77 */
78 int wmode; /* WMode: 0 for Horizontal, 1 for Vertical. */
79 CIDSysInfo *CSI; /* CIDSystemInfo */
80
81 struct CMap *useCMap;
82
83 struct {
84 int num;
85 int max;
86 rangeDef *ranges;
87 } codespace;
88
89 mapDef *mapTbl; /* First 256 segment of mapping table */
90 mapData *mapData; /* Storage for actual CMap data */
91
92 /* Additional data used by cmap.c, etc. */
93
94 int flags; /* Decoder flags Not used yet. */
95
96 struct {
97 int minBytesIn;
98 int maxBytesIn;
99 int minBytesOut;
100 int maxBytesOut;
101 } profile;
102
103 int *reverseMap;
104 };
105
106 #endif /* _CMAP_P_H_ */