Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
7638 views
1
#ifndef MUPDF_PDF_CMAP_H
2
#define MUPDF_PDF_CMAP_H
3
4
/*
5
* CMap
6
*/
7
8
typedef struct pdf_cmap_s pdf_cmap;
9
typedef struct pdf_range_s pdf_range;
10
typedef struct pdf_xrange_s pdf_xrange;
11
typedef struct pdf_mrange_s pdf_mrange;
12
13
#define PDF_MRANGE_CAP 8
14
15
struct pdf_range_s
16
{
17
unsigned short low, high, out;
18
};
19
20
struct pdf_xrange_s
21
{
22
unsigned int low, high, out;
23
};
24
25
struct pdf_mrange_s
26
{
27
unsigned int low, len, out[PDF_MRANGE_CAP];
28
};
29
30
struct pdf_cmap_s
31
{
32
fz_storable storable;
33
char cmap_name[32];
34
35
char usecmap_name[32];
36
pdf_cmap *usecmap;
37
38
int wmode;
39
40
int codespace_len;
41
struct
42
{
43
int n;
44
unsigned int low;
45
unsigned int high;
46
} codespace[40];
47
48
int rlen, rcap;
49
pdf_range *ranges;
50
51
int xlen, xcap;
52
pdf_xrange *xranges;
53
54
int mlen, mcap;
55
pdf_mrange *mranges;
56
};
57
58
pdf_cmap *pdf_new_cmap(fz_context *ctx);
59
pdf_cmap *pdf_keep_cmap(fz_context *ctx, pdf_cmap *cmap);
60
void pdf_drop_cmap(fz_context *ctx, pdf_cmap *cmap);
61
void pdf_drop_cmap_imp(fz_context *ctx, fz_storable *cmap);
62
unsigned int pdf_cmap_size(fz_context *ctx, pdf_cmap *cmap);
63
64
int pdf_cmap_wmode(fz_context *ctx, pdf_cmap *cmap);
65
void pdf_set_cmap_wmode(fz_context *ctx, pdf_cmap *cmap, int wmode);
66
void pdf_set_usecmap(fz_context *ctx, pdf_cmap *cmap, pdf_cmap *usecmap);
67
68
void pdf_add_codespace(fz_context *ctx, pdf_cmap *cmap, unsigned int low, unsigned int high, int n);
69
void pdf_map_range_to_table(fz_context *ctx, pdf_cmap *cmap, unsigned int low, int *map, int len);
70
void pdf_map_range_to_range(fz_context *ctx, pdf_cmap *cmap, unsigned int srclo, unsigned int srchi, int dstlo);
71
void pdf_map_one_to_many(fz_context *ctx, pdf_cmap *cmap, unsigned int one, int *many, int len);
72
void pdf_sort_cmap(fz_context *ctx, pdf_cmap *cmap);
73
74
int pdf_lookup_cmap(pdf_cmap *cmap, unsigned int cpt);
75
int pdf_lookup_cmap_full(pdf_cmap *cmap, unsigned int cpt, int *out);
76
int pdf_decode_cmap(pdf_cmap *cmap, unsigned char *s, unsigned char *e, unsigned int *cpt);
77
78
pdf_cmap *pdf_new_identity_cmap(fz_context *ctx, int wmode, int bytes);
79
pdf_cmap *pdf_load_cmap(fz_context *ctx, fz_stream *file);
80
pdf_cmap *pdf_load_system_cmap(fz_context *ctx, char *name);
81
pdf_cmap *pdf_load_builtin_cmap(fz_context *ctx, char *name);
82
pdf_cmap *pdf_load_embedded_cmap(fz_context *ctx, pdf_document *doc, pdf_obj *ref);
83
84
#ifndef NDEBUG
85
void pdf_print_cmap(fz_context *ctx, pdf_cmap *cmap);
86
#endif
87
88
#endif
89
90