summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdf-x/cmap.h
blob: f63372821960a57880c99e97e7869c952e66d5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*  

    This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.

    Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata,
    the dvipdfmx project team.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

#ifndef _CMAP_H_
#define _CMAP_H_

#include "cid.h"

#include <sys/types.h>

typedef unsigned short CID;
typedef unsigned short UCV16;

/* Limits */
#define CID_MAX_CID  65535
#define CID_MAX      CID_MAX_CID

#define CID_NOTDEF_CHAR   "\0\0"
#define CID_NOTDEF        0

#define UCS_NOTDEF_CHAR   "\377\375"
#define UCS_NOTDEF        0xfffd

/*
 * TYPE_IDENTITY and TYPE_CID_TO_CODE is not defined in the CMap spec.
 */
#define CMAP_TYPE_IDENTITY    0
#define CMAP_TYPE_CODE_TO_CID 1
#define CMAP_TYPE_TO_UNICODE  2
#define CMAP_TYPE_CID_TO_CODE 3

#define CMAP_PROF_TYPE_INBYTES_MIN  0
#define CMAP_PROF_TYPE_INBYTES_MAX  1
#define CMAP_PROF_TYPE_OUTBYTES_MIN 2
#define CMAP_PROF_TYPE_OUTBYTES_MAX 3

typedef struct CMap CMap;


/************************** CMAP_MAIN **************************/

extern void CMap_set_verbose (void);
extern void CMap_set_silent  (int value);

extern CMap  *CMap_new     (void);
extern void   CMap_release (CMap *cmap);

extern int    CMap_is_valid    (CMap *cmap);
extern int    CMap_is_Identity (CMap *cmap);
extern int    CMap_get_profile (CMap *cmap, int type);

extern char       *CMap_get_name (CMap *cmap);
extern int         CMap_get_type (CMap *cmap);
extern int         CMap_get_wmode(CMap *cmap);
extern CIDSysInfo *CMap_get_CIDSysInfo(CMap *cmap);

extern void   CMap_set_name   (CMap *cmap, const char *name);
extern void   CMap_set_type   (CMap *cmap, int type);
extern void   CMap_set_wmode  (CMap *cmap, int wmode);
extern void   CMap_set_usecmap(CMap *cmap, CMap *ucmap);
extern void   CMap_set_CIDSysInfo (CMap *cmap, const CIDSysInfo *csi);

/* charName not supported */
extern int   CMap_add_bfchar  (CMap *cmap,
			       const unsigned char *src, int srcdim,
			       const unsigned char *dest, int destdim);
extern int   CMap_add_cidchar (CMap *cmap,
			       const unsigned char *src, int srcdim, CID dest);
extern int   CMap_add_bfrange (CMap *cmap,
			       const unsigned char *srclo, const unsigned char *srchi, int srcdim,
			       const unsigned char *dest, int destdim);
extern int   CMap_add_cidrange(CMap *cmap,
			       const unsigned char *srclo, const unsigned char *hi, int srcdim,
			       CID base);

extern int CMap_add_notdefchar  (CMap *cmap, const unsigned char *src, int srcdim, CID dst);
extern int CMap_add_notdefrange (CMap *cmap,
				 const unsigned char *srclo, const unsigned char *srchi, int srcdim,
				 CID dst);

extern int  CMap_add_codespacerange (CMap *cmap,
				     const unsigned char *codelo, const unsigned char *codehi, int dim);
extern int  CMap_match_codespace    (CMap *cmap, const unsigned char *c, int dim);

extern void CMap_decode_char (CMap *cmap,
			      const unsigned char **inbuf, long *inbytesleft,
			      unsigned char **outbuf, long *outbytesleft);

extern long CMap_decode (CMap *cmap,
			 const unsigned char **inbuf,  long *inbytesleft,
			 unsigned char **outbuf, long *outbytesleft);

extern void  CMap_cache_init  (void);
extern CMap *CMap_cache_get   (int id);
extern int   CMap_cache_find  (const char *cmap_name);
extern void  CMap_cache_close (void);
extern int   CMap_cache_add   (CMap *cmap);

#endif /* _CMAP_H_ */