| 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 |
Copyright (C) 1998, 1999 by Mark A. Wicks <[email protected]> |
| 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 _SPECIALS_H_ |
| 24 |
#define _SPECIALS_H_ |
| 25 |
|
| 26 |
#include "pdfobj.h" |
| 27 |
#include "pdfdev.h" |
| 28 |
|
| 29 |
struct spc_env { |
| 30 |
double x_user, y_user; |
| 31 |
double mag; |
| 32 |
int pg; /* current page in PDF */ |
| 33 |
struct { |
| 34 |
int is_drawable; |
| 35 |
pdf_rect rect; |
| 36 |
} info; |
| 37 |
}; |
| 38 |
|
| 39 |
struct spc_arg { |
| 40 |
const char *curptr; |
| 41 |
const char *endptr; |
| 42 |
const char *base; |
| 43 |
|
| 44 |
const char *command; |
| 45 |
}; |
| 46 |
|
| 47 |
typedef int (*spc_handler_fn_ptr) (struct spc_env *, struct spc_arg *); |
| 48 |
|
| 49 |
struct spc_handler { |
| 50 |
const char *key; |
| 51 |
spc_handler_fn_ptr exec; |
| 52 |
}; |
| 53 |
|
| 54 |
|
| 55 |
#include <stdarg.h> |
| 56 |
extern void spc_warn (struct spc_env *spe, const char *fmt, ...); |
| 57 |
|
| 58 |
extern pdf_obj *spc_lookup_reference (const char *ident); |
| 59 |
extern pdf_obj *spc_lookup_object (const char *ident); |
| 60 |
|
| 61 |
extern int spc_begin_annot (struct spc_env *spe, pdf_obj *annot_dict); |
| 62 |
extern int spc_end_annot (struct spc_env *spe); |
| 63 |
extern int spc_resume_annot (struct spc_env *spe); |
| 64 |
extern int spc_suspend_annot (struct spc_env *spe); |
| 65 |
|
| 66 |
extern int spc_begin_form (struct spc_env *spe, const char *ident, pdf_coord cp, pdf_rect *cropbox); |
| 67 |
extern int spc_end_form (struct spc_env *spe, pdf_obj *attr); |
| 68 |
|
| 69 |
extern int spc_is_tracking_boxes (struct spc_env *spe); |
| 70 |
|
| 71 |
/* linkmode 0: normal, 1: capture phantom texts */ |
| 72 |
extern void spc_set_linkmode (struct spc_env *spe, int mode); |
| 73 |
/* set default height of phantom texts */ |
| 74 |
extern void spc_set_phantom (struct spc_env *spe, double height, double depth); |
| 75 |
|
| 76 |
extern void spc_push_object (struct spc_env *spe, const char *key, pdf_obj *value); |
| 77 |
extern void spc_flush_object (struct spc_env *spe, const char *key); |
| 78 |
extern void spc_clear_objects (struct spc_env *spe); |
| 79 |
|
| 80 |
extern void spc_put_image (struct spc_env *spe, int res_id, transform_info *ti, double xpos, double ypos); |
| 81 |
|
| 82 |
extern void spc_get_current_point (struct spc_env *spe, pdf_coord *cp); |
| 83 |
|
| 84 |
/* dvipdfmx pdf: special */ |
| 85 |
extern void spc_get_coord (struct spc_env *spe, double *x, double *y); |
| 86 |
extern void spc_push_coord (struct spc_env *spe, double x, double y); |
| 87 |
extern void spc_pop_coord (struct spc_env *spe); |
| 88 |
/* XeTeX */ |
| 89 |
extern void spc_set_fixed_point (struct spc_env *spe, double x, double y); |
| 90 |
extern void spc_get_fixed_point (struct spc_env *spe, double *x, double *y); |
| 91 |
extern void spc_put_fixed_point (struct spc_env *spe, double x, double y); |
| 92 |
extern void spc_dup_fixed_point (struct spc_env *spe); |
| 93 |
extern void spc_pop_fixed_point (struct spc_env *spe); |
| 94 |
extern void spc_clear_fixed_point (struct spc_env *spe); |
| 95 |
|
| 96 |
extern int spc_exec_at_begin_page (void); |
| 97 |
extern int spc_exec_at_end_page (void); |
| 98 |
extern int spc_exec_at_begin_document (void); |
| 99 |
extern int spc_exec_at_end_document (void); |
| 100 |
|
| 101 |
extern int spc_exec_special (const char *p, int32_t size, double x_user, double y_user, double mag, int *is_drawable, pdf_rect *rect); |
| 102 |
|
| 103 |
#endif /* _SPECIALS_H_ */ |