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