OSDN Git Service

updated with TeX Live 2014.
[putex/putex.git] / src / dvipdfmx-pu / src / cmap_p.h
1 /*  
2
3     This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
4
5     Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata,
6     the dvipdfmx project team.
7
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17
18     You should have received a copy of the GNU General Public License
19     along with this program; if not, write to the Free Software
20     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22
23 #ifndef _CMAP_P_H_
24 #define _CMAP_P_H_
25
26 #include "cid.h"
27
28 /* Mapping types, MAP_IS_NAME is not supported. */
29 #define MAP_IS_CID      (1 << 0)
30 #define MAP_IS_NAME     (1 << 1)
31 #define MAP_IS_CODE     (1 << 2)
32 #define MAP_IS_NOTDEF   (1 << 3)
33
34 #define MAP_IS_UNDEF    0
35 #define MAP_TYPE_MASK   0x00f
36
37 #define MAP_DEFINED(e)  (((e) & MAP_TYPE_MASK) != MAP_IS_UNDEF ? 1 : 0)
38 #define MAP_TYPE(e)     ((e) & MAP_TYPE_MASK)
39
40 /* Lookup flags */
41 #define MAP_LOOKUP_END      0
42 #define MAP_LOOKUP_CONTINUE (1 << 4)
43 #define LOOKUP_CONTINUE(f) ((f) & MAP_LOOKUP_CONTINUE)
44 #define LOOKUP_END(f)      (!LOOKUP_CONTINUE((f)))
45
46 /* DEBUG */
47 #define CMAP_DEBUG_STR "CMap"
48 #define CMAP_DEBUG     3
49
50 /* Codespacerange */
51 typedef struct rangeDef {
52   int dim;               /* Dimension of this codespacerange */
53   unsigned char *codeLo; /* Lower bounds of valid input code */
54   unsigned char *codeHi; /* Upper bounds of valid input code */
55 } rangeDef;
56
57 typedef struct mapDef {
58   int            flag;
59   int            len;  /* 2 for CID, variable for Code..  */
60   unsigned char *code; /* CID (as 16-bit BE), Code ...    */
61   struct mapDef *next; /* Next Subtbl for LOOKUP_CONTINUE */
62 } mapDef;
63
64 #define MEM_ALLOC_SIZE  4096
65 typedef struct mapData {
66   long            pos;  /* Position of next free data segment */
67   unsigned char  *data; /* CID, Code... MEM_ALLOC_SIZE bytes  */
68   struct mapData *prev; /* Previous mapData data segment      */
69 } mapData;
70
71 struct CMap {
72   char  *name;
73   int    type;     /* CMapType: 1 for usual CMaps,
74                     *           2 for ToUnicode CMaps,
75                     *           0 for IDENTITY is also defined for convenience.
76                     */
77   int    wmode;    /* WMode: 0 for Horizontal, 1 for Vertical. */
78   CIDSysInfo *CSI; /* CIDSystemInfo */
79
80   struct CMap *useCMap;
81
82   struct {
83     int        num;
84     int        max;
85     rangeDef  *ranges;
86   } codespace;
87
88   mapDef  *mapTbl;  /* First 256 segment of mapping table */
89   mapData *mapData; /* Storage for actual CMap data       */
90
91   /* Additional data used by cmap.c, etc. */
92
93   int flags; /* Decoder flags Not used yet. */
94
95   struct {
96     int minBytesIn;
97     int maxBytesIn;
98     int minBytesOut;
99     int maxBytesOut;
100   } profile;
101
102 };
103
104 #endif /* _CMAP_P_H_ */