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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
|
#ifndef _MUPDF_H_
#define _MUPDF_H_
#ifndef _FITZ_H_
#error "fitz.h must be included before mupdf.h"
#endif
typedef struct pdf_xref_s pdf_xref;
/*
* tokenizer and low-level object parser
*/
enum
{
PDF_TOK_ERROR, PDF_TOK_EOF,
PDF_TOK_OPEN_ARRAY, PDF_TOK_CLOSE_ARRAY,
PDF_TOK_OPEN_DICT, PDF_TOK_CLOSE_DICT,
PDF_TOK_OPEN_BRACE, PDF_TOK_CLOSE_BRACE,
PDF_TOK_NAME, PDF_TOK_INT, PDF_TOK_REAL, PDF_TOK_STRING, PDF_TOK_KEYWORD,
PDF_TOK_R, PDF_TOK_TRUE, PDF_TOK_FALSE, PDF_TOK_NULL,
PDF_TOK_OBJ, PDF_TOK_ENDOBJ,
PDF_TOK_STREAM, PDF_TOK_ENDSTREAM,
PDF_TOK_XREF, PDF_TOK_TRAILER, PDF_TOK_STARTXREF,
PDF_NUM_TOKENS
};
/* lex.c */
fz_error pdf_lex(int *tok, fz_stream *f, char *buf, int n, int *len);
/* parse.c */
fz_error pdf_parse_array(fz_obj **op, pdf_xref *xref, fz_stream *f, char *buf, int cap);
fz_error pdf_parse_dict(fz_obj **op, pdf_xref *xref, fz_stream *f, char *buf, int cap);
fz_error pdf_parse_stm_obj(fz_obj **op, pdf_xref *xref, fz_stream *f, char *buf, int cap);
fz_error pdf_parse_ind_obj(fz_obj **op, pdf_xref *xref, fz_stream *f, char *buf, int cap, int *num, int *gen, int *stm_ofs);
fz_rect pdf_to_rect(fz_obj *array);
fz_matrix pdf_to_matrix(fz_obj *array);
char *pdf_to_utf8(fz_obj *src);
unsigned short *pdf_to_ucs2(fz_obj *src);
fz_obj *pdf_to_utf8_name(fz_obj *src);
char *pdf_from_ucs2(unsigned short *str);
/*
* Encryption
*/
/* Permission flag bits */
#define PDF_PERM_PRINT (1<<2)
#define PDF_PERM_CHANGE (1<<3)
#define PDF_PERM_COPY (1<<4)
#define PDF_PERM_NOTES (1<<5)
#define PDF_PERM_FILL_FORM (1<<8)
#define PDF_PERM_ACCESSIBILITY (1<<9)
#define PDF_PERM_ASSEMBLE (1<<10)
#define PDF_PERM_HIGH_RES_PRINT (1<<11)
#define PDF_DEFAULT_PERM_FLAGS 0xfffc
typedef struct pdf_crypt_s pdf_crypt;
typedef struct pdf_crypt_filter_s pdf_crypt_filter;
enum
{
PDF_CRYPT_NONE,
PDF_CRYPT_RC4,
PDF_CRYPT_AESV2,
PDF_CRYPT_AESV3,
PDF_CRYPT_UNKNOWN,
};
struct pdf_crypt_filter_s
{
int method;
int length;
};
struct pdf_crypt_s
{
unsigned char id_string[32];
int id_length;
int v;
int length;
fz_obj *cf;
pdf_crypt_filter stmf;
pdf_crypt_filter strf;
int r;
unsigned char o[48];
unsigned char u[48];
unsigned char oe[32];
unsigned char ue[32];
int p;
int encrypt_metadata;
unsigned char key[32]; /* decryption key generated from password */
};
/* crypt.c */
fz_error pdf_new_crypt(pdf_crypt **cp, fz_obj *enc, fz_obj *id);
void pdf_free_crypt(pdf_crypt *crypt);
fz_error pdf_parse_crypt_filter(pdf_crypt_filter *cf, fz_obj *dict, int defaultlength);
fz_stream *pdf_open_crypt(fz_stream *chain, pdf_crypt *crypt, pdf_crypt_filter *cf, int num, int gen);
void pdf_crypt_obj(pdf_crypt *crypt, fz_obj *obj, int num, int gen);
int pdf_needs_password(pdf_xref *xref);
int pdf_authenticate_password(pdf_xref *xref, char *pw);
void pdf_debug_crypt(pdf_crypt *crypt);
/*
* xref and object / stream api
*/
typedef struct pdf_xref_entry_s pdf_xref_entry;
struct pdf_xref_entry_s
{
int ofs; /* file offset / objstm object number */
int gen; /* generation / objstm index */
int stm_ofs; /* on-disk stream */
fz_obj *obj; /* stored/cached object */
int type; /* 0=unset (f)ree i(n)use (o)bjstm */
};
struct pdf_xref_s
{
fz_stream *file;
int version;
int startxref;
int file_size;
pdf_crypt *crypt;
fz_obj *trailer;
int len;
pdf_xref_entry *table;
int page_len;
int page_cap;
fz_obj **page_objs;
fz_obj **page_refs;
struct pdf_store_s *store;
char scratch[65536];
};
fz_obj *pdf_resolve_indirect(fz_obj *ref);
fz_error pdf_cache_object(pdf_xref *, int num, int gen);
fz_error pdf_load_object(fz_obj **objp, pdf_xref *, int num, int gen);
void pdf_update_object( pdf_xref *xref, int num, int gen, fz_obj *newobj);
int pdf_is_stream(pdf_xref *xref, int num, int gen);
fz_stream *pdf_open_inline_stream(fz_stream *chain, pdf_xref *xref, fz_obj *stmobj, int length);
fz_error pdf_load_raw_stream(fz_buffer **bufp, pdf_xref *xref, int num, int gen);
fz_error pdf_load_stream(fz_buffer **bufp, pdf_xref *xref, int num, int gen);
fz_error pdf_open_raw_stream(fz_stream **stmp, pdf_xref *, int num, int gen);
fz_error pdf_open_stream(fz_stream **stmp, pdf_xref *, int num, int gen);
fz_error pdf_open_stream_at(fz_stream **stmp, pdf_xref *xref, int num, int gen, fz_obj *dict, int stm_ofs);
fz_error pdf_open_xref_with_stream(pdf_xref **xrefp, fz_stream *file, char *password);
fz_error pdf_open_xref(pdf_xref **xrefp, char *filename, char *password);
void pdf_free_xref(pdf_xref *);
/* private */
fz_error pdf_repair_xref(pdf_xref *xref, char *buf, int bufsize);
fz_error pdf_repair_obj_stms(pdf_xref *xref);
void pdf_debug_xref(pdf_xref *);
void pdf_resize_xref(pdf_xref *xref, int newcap);
/*
* Resource store
*/
typedef struct pdf_store_s pdf_store;
pdf_store *pdf_new_store(void);
void pdf_free_store(pdf_store *store);
void pdf_debug_store(pdf_store *store);
void pdf_store_item(pdf_store *store, void *keepfn, void *dropfn, fz_obj *key, void *val);
void *pdf_find_item(pdf_store *store, void *dropfn, fz_obj *key);
void pdf_remove_item(pdf_store *store, void *dropfn, fz_obj *key);
void pdf_age_store(pdf_store *store, int maxage);
/*
* Functions
*/
typedef struct pdf_function_s pdf_function;
fz_error pdf_load_function(pdf_function **func, pdf_xref *xref, fz_obj *ref);
void pdf_eval_function(pdf_function *func, float *in, int inlen, float *out, int outlen);
pdf_function *pdf_keep_function(pdf_function *func);
void pdf_drop_function(pdf_function *func);
/*
* Colorspace
*/
fz_error pdf_load_colorspace(fz_colorspace **csp, pdf_xref *xref, fz_obj *obj);
fz_pixmap *pdf_expand_indexed_pixmap(fz_pixmap *src);
/*
* Pattern
*/
typedef struct pdf_pattern_s pdf_pattern;
struct pdf_pattern_s
{
int refs;
int ismask;
float xstep;
float ystep;
fz_matrix matrix;
fz_rect bbox;
fz_obj *resources;
fz_buffer *contents;
};
fz_error pdf_load_pattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *obj);
pdf_pattern *pdf_keep_pattern(pdf_pattern *pat);
void pdf_drop_pattern(pdf_pattern *pat);
/*
* Shading
*/
fz_error pdf_load_shading(fz_shade **shadep, pdf_xref *xref, fz_obj *obj);
/*
* XObject
*/
typedef struct pdf_xobject_s pdf_xobject;
struct pdf_xobject_s
{
int refs;
fz_matrix matrix;
fz_rect bbox;
int isolated;
int knockout;
int transparency;
fz_colorspace *colorspace;
fz_obj *resources;
fz_buffer *contents;
};
fz_error pdf_load_xobject(pdf_xobject **xobjp, pdf_xref *xref, fz_obj *obj);
pdf_xobject *pdf_keep_xobject(pdf_xobject *xobj);
void pdf_drop_xobject(pdf_xobject *xobj);
/*
* Image
*/
fz_error pdf_load_inline_image(fz_pixmap **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, fz_stream *file);
fz_error pdf_load_image(fz_pixmap **imgp, pdf_xref *xref, fz_obj *obj);
int pdf_is_jpx_image(fz_obj *dict);
/*
* CMap
*/
typedef struct pdf_cmap_s pdf_cmap;
typedef struct pdf_range_s pdf_range;
enum { PDF_CMAP_SINGLE, PDF_CMAP_RANGE, PDF_CMAP_TABLE, PDF_CMAP_MULTI };
struct pdf_range_s
{
unsigned short low;
/* Next, we pack 2 fields into the same unsigned short. Top 14 bits
* are the extent, bottom 2 bits are flags: single, range, table,
* multi */
unsigned short extent_flags;
unsigned short offset; /* range-delta or table-index */
};
struct pdf_cmap_s
{
int refs;
char cmap_name[32];
char usecmap_name[32];
pdf_cmap *usecmap;
int wmode;
int codespace_len;
struct
{
unsigned short n;
unsigned short low;
unsigned short high;
} codespace[40];
int rlen, rcap;
pdf_range *ranges;
int tlen, tcap;
unsigned short *table;
};
pdf_cmap *pdf_new_cmap(void);
pdf_cmap *pdf_keep_cmap(pdf_cmap *cmap);
void pdf_drop_cmap(pdf_cmap *cmap);
void pdf_debug_cmap(pdf_cmap *cmap);
int pdf_get_wmode(pdf_cmap *cmap);
void pdf_set_wmode(pdf_cmap *cmap, int wmode);
void pdf_set_usecmap(pdf_cmap *cmap, pdf_cmap *usecmap);
void pdf_add_codespace(pdf_cmap *cmap, int low, int high, int n);
void pdf_map_range_to_table(pdf_cmap *cmap, int low, int *map, int len);
void pdf_map_range_to_range(pdf_cmap *cmap, int srclo, int srchi, int dstlo);
void pdf_map_one_to_many(pdf_cmap *cmap, int one, int *many, int len);
void pdf_sort_cmap(pdf_cmap *cmap);
int pdf_lookup_cmap(pdf_cmap *cmap, int cpt);
int pdf_lookup_cmap_full(pdf_cmap *cmap, int cpt, int *out);
unsigned char *pdf_decode_cmap(pdf_cmap *cmap, unsigned char *s, int *cpt);
pdf_cmap *pdf_new_identity_cmap(int wmode, int bytes);
fz_error pdf_parse_cmap(pdf_cmap **cmapp, fz_stream *file);
fz_error pdf_load_embedded_cmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *ref);
fz_error pdf_load_system_cmap(pdf_cmap **cmapp, char *name);
pdf_cmap *pdf_find_builtin_cmap(char *cmap_name);
/*
* Font
*/
enum
{
PDF_FD_FIXED_PITCH = 1 << 0,
PDF_FD_SERIF = 1 << 1,
PDF_FD_SYMBOLIC = 1 << 2,
PDF_FD_SCRIPT = 1 << 3,
PDF_FD_NONSYMBOLIC = 1 << 5,
PDF_FD_ITALIC = 1 << 6,
PDF_FD_ALL_CAP = 1 << 16,
PDF_FD_SMALL_CAP = 1 << 17,
PDF_FD_FORCE_BOLD = 1 << 18
};
enum { PDF_ROS_CNS, PDF_ROS_GB, PDF_ROS_JAPAN, PDF_ROS_KOREA };
void pdf_load_encoding(char **estrings, char *encoding);
int pdf_lookup_agl(char *name);
const char **pdf_lookup_agl_duplicates(int ucs);
extern const unsigned short pdf_doc_encoding[256];
extern const char * const pdf_mac_roman[256];
extern const char * const pdf_mac_expert[256];
extern const char * const pdf_win_ansi[256];
extern const char * const pdf_standard[256];
typedef struct pdf_font_desc_s pdf_font_desc;
typedef struct pdf_hmtx_s pdf_hmtx;
typedef struct pdf_vmtx_s pdf_vmtx;
struct pdf_hmtx_s
{
unsigned short lo;
unsigned short hi;
int w; /* type3 fonts can be big! */
};
struct pdf_vmtx_s
{
unsigned short lo;
unsigned short hi;
short x;
short y;
short w;
};
struct pdf_font_desc_s
{
int refs;
fz_font *font;
/* FontDescriptor */
int flags;
float italic_angle;
float ascent;
float descent;
float cap_height;
float x_height;
float missing_width;
/* Encoding (CMap) */
pdf_cmap *encoding;
pdf_cmap *to_ttf_cmap;
int cid_to_gid_len;
unsigned short *cid_to_gid;
/* ToUnicode */
pdf_cmap *to_unicode;
int cid_to_ucs_len;
unsigned short *cid_to_ucs;
/* Metrics (given in the PDF file) */
int wmode;
int hmtx_len, hmtx_cap;
pdf_hmtx dhmtx;
pdf_hmtx *hmtx;
int vmtx_len, vmtx_cap;
pdf_vmtx dvmtx;
pdf_vmtx *vmtx;
int is_embedded;
};
/* fontmtx.c */
void pdf_set_font_wmode(pdf_font_desc *font, int wmode);
void pdf_set_default_hmtx(pdf_font_desc *font, int w);
void pdf_set_default_vmtx(pdf_font_desc *font, int y, int w);
void pdf_add_hmtx(pdf_font_desc *font, int lo, int hi, int w);
void pdf_add_vmtx(pdf_font_desc *font, int lo, int hi, int x, int y, int w);
void pdf_end_hmtx(pdf_font_desc *font);
void pdf_end_vmtx(pdf_font_desc *font);
pdf_hmtx pdf_get_hmtx(pdf_font_desc *font, int cid);
pdf_vmtx pdf_get_vmtx(pdf_font_desc *font, int cid);
/* unicode.c */
fz_error pdf_load_to_unicode(pdf_font_desc *font, pdf_xref *xref, char **strings, char *collection, fz_obj *cmapstm);
/* fontfile.c */
unsigned char *pdf_find_builtin_font(char *name, unsigned int *len);
unsigned char *pdf_find_builtin_cjk_font(int ros, int gothic, unsigned int *len);
char *pdf_find_system_font(char *name);
char *pdf_find_system_cjk_font(char *name, int ros, int gothic);
/* type3.c */
fz_error pdf_load_type3_font(pdf_font_desc **fontp, pdf_xref *xref, fz_obj *rdb, fz_obj *obj);
/* font.c */
int pdf_font_cid_to_gid(pdf_font_desc *fontdesc, int cid);
fz_error pdf_load_font_descriptor(pdf_font_desc *font, pdf_xref *xref, fz_obj *desc, char *collection, char *basefont);
fz_error pdf_load_font(pdf_font_desc **fontp, pdf_xref *xref, fz_obj *rdb, fz_obj *obj);
pdf_font_desc *pdf_new_font_desc(void);
pdf_font_desc *pdf_keep_font(pdf_font_desc *fontdesc);
void pdf_drop_font(pdf_font_desc *font);
void pdf_debug_font(pdf_font_desc *fontdesc);
/*
* Interactive features
*/
typedef struct pdf_link_s pdf_link;
typedef struct pdf_annot_s pdf_annot;
typedef struct pdf_outline_s pdf_outline;
typedef enum pdf_link_kind_e
{
PDF_LINK_GOTO = 0,
PDF_LINK_URI,
PDF_LINK_LAUNCH,
PDF_LINK_NAMED,
PDF_LINK_ACTION,
} pdf_link_kind;
struct pdf_link_s
{
pdf_link_kind kind;
fz_rect rect;
fz_obj *dest;
pdf_link *next;
};
struct pdf_annot_s
{
fz_obj *obj;
fz_rect rect;
pdf_xobject *ap;
fz_matrix matrix;
pdf_annot *next;
};
struct pdf_outline_s
{
char *title;
pdf_link *link;
int count;
pdf_outline *child;
pdf_outline *next;
};
fz_obj *pdf_lookup_dest(pdf_xref *xref, fz_obj *needle);
fz_obj *pdf_lookup_name(pdf_xref *xref, char *which, fz_obj *needle);
fz_obj *pdf_load_name_tree(pdf_xref *xref, char *which);
pdf_outline *pdf_load_outline(pdf_xref *xref);
void pdf_debug_outline(pdf_outline *outline, int level);
void pdf_free_outline(pdf_outline *outline);
pdf_link *pdf_load_link(pdf_xref *xref, fz_obj *dict);
void pdf_load_links(pdf_link **, pdf_xref *, fz_obj *annots);
void pdf_free_link(pdf_link *link);
void pdf_load_annots(pdf_annot **, pdf_xref *, fz_obj *annots);
void pdf_free_annot(pdf_annot *link);
/*
* Page tree, pages and related objects
*/
typedef struct pdf_page_s pdf_page;
struct pdf_page_s
{
fz_rect mediabox;
int rotate;
int transparency;
fz_obj *resources;
fz_buffer *contents;
pdf_link *links;
pdf_annot *annots;
};
/* pagetree.c */
fz_error pdf_load_page_tree(pdf_xref *xref);
int pdf_find_page_number(pdf_xref *xref, fz_obj *pageobj);
int pdf_count_pages(pdf_xref *xref);
/* page.c */
fz_error pdf_load_page(pdf_page **pagep, pdf_xref *xref, int number);
void pdf_free_page(pdf_page *page);
/*
* content stream parsing
*/
typedef struct pdf_material_s pdf_material;
typedef struct pdf_gstate_s pdf_gstate;
typedef struct pdf_csi_s pdf_csi;
enum
{
PDF_FILL,
PDF_STROKE,
};
enum
{
PDF_MAT_NONE,
PDF_MAT_COLOR,
PDF_MAT_PATTERN,
PDF_MAT_SHADE,
};
struct pdf_material_s
{
int kind;
fz_colorspace *colorspace;
pdf_pattern *pattern;
fz_shade *shade;
float alpha;
float v[32];
};
struct pdf_gstate_s
{
fz_matrix ctm;
int clip_depth;
/* path stroking */
fz_stroke_state stroke_state;
/* materials */
pdf_material stroke;
pdf_material fill;
/* text state */
float char_space;
float word_space;
float scale;
float leading;
pdf_font_desc *font;
float size;
int render;
float rise;
/* transparency */
int blendmode;
pdf_xobject *softmask;
fz_matrix softmask_ctm;
float softmask_bc[FZ_MAX_COLORS];
int luminosity;
};
struct pdf_csi_s
{
fz_device *dev;
pdf_xref *xref;
/* usage mode for optional content groups */
char *target; /* "View", "Print", "Export" */
/* interpreter stack */
fz_obj *obj;
char name[256];
unsigned char string[256];
int string_len;
float stack[32];
int top;
int xbalance;
int in_text;
int in_array;
/* path object state */
fz_path *path;
int clip;
int clip_even_odd;
/* text object state */
fz_text *text;
fz_matrix tlm;
fz_matrix tm;
int text_mode;
int accumulate;
/* graphics state */
fz_matrix top_ctm;
pdf_gstate gstate[64];
int gtop;
};
/* build.c */
void pdf_init_gstate(pdf_gstate *gs, fz_matrix ctm);
void pdf_set_colorspace(pdf_csi *csi, int what, fz_colorspace *cs);
void pdf_set_color(pdf_csi *csi, int what, float *v);
void pdf_set_pattern(pdf_csi *csi, int what, pdf_pattern *pat, float *v);
void pdf_set_shade(pdf_csi *csi, int what, fz_shade *shade);
void pdf_show_path(pdf_csi*, int close, int fill, int stroke, int even_odd);
void pdf_show_space(pdf_csi *csi, float tadj);
void pdf_show_string(pdf_csi *csi, unsigned char *buf, int len);
void pdf_show_text(pdf_csi*, fz_obj *text);
void pdf_flush_text(pdf_csi*);
void pdf_show_image(pdf_csi*, fz_pixmap *image);
void pdf_show_shade(pdf_csi*, fz_shade *shade);
/* interpret.c */
void pdf_gsave(pdf_csi *csi);
void pdf_grestore(pdf_csi *csi);
fz_error pdf_run_csi_buffer(pdf_csi *csi, fz_obj *rdb, fz_buffer *contents);
fz_error pdf_run_xobject(pdf_csi *csi, fz_obj *resources, pdf_xobject *xobj, fz_matrix transform);
fz_error pdf_run_page_with_usage(pdf_xref *xref, pdf_page *page, fz_device *dev, fz_matrix ctm, char *target);
fz_error pdf_run_page(pdf_xref *xref, pdf_page *page, fz_device *dev, fz_matrix ctm);
fz_error pdf_run_glyph(pdf_xref *xref, fz_obj *resources, fz_buffer *contents, fz_device *dev, fz_matrix ctm);
pdf_material *pdf_keep_material(pdf_material *mat);
pdf_material *pdf_drop_material(pdf_material *mat);
#endif
|