1
/* $Header: /home/cvsroot/dvipdfmx/src/pdfdev.h,v 1.25 2008/12/11 16:03:05 matthias Exp $
3
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
5
Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
6
the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
8
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
10
This program is free software; you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation; either version 2 of the License, or
13
(at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
32
typedef signed long spt_t;
34
typedef struct pdf_tmatrix
36
double a, b, c, d, e, f;
39
typedef struct pdf_rect
41
double llx, lly, urx, ury;
44
typedef struct pdf_coord
49
/* The name transform_info is misleading.
50
* I'll put this here for a moment...
54
/* Physical dimensions
56
* If those values are given, images will be scaled
57
* and/or shifted to fit within a box described by
64
pdf_tmatrix matrix; /* transform matrix */
65
pdf_rect bbox; /* user_bbox */
69
#define INFO_HAS_USER_BBOX (1 << 0)
70
#define INFO_HAS_WIDTH (1 << 1)
71
#define INFO_HAS_HEIGHT (1 << 2)
72
#define INFO_DO_CLIP (1 << 3)
73
#define INFO_DO_HIDE (1 << 4)
74
extern void transform_info_clear (transform_info *info);
77
extern void pdf_dev_set_verbose (void);
80
extern int pdf_sprint_matrix (char *buf, const pdf_tmatrix *p);
81
extern int pdf_sprint_rect (char *buf, const pdf_rect *p);
82
extern int pdf_sprint_coord (char *buf, const pdf_coord *p);
83
extern int pdf_sprint_length (char *buf, double value);
84
extern int pdf_sprint_number (char *buf, double value);
86
/* unit_conv: multiplier for input unit (spt_t) to bp conversion.
87
* precision: How many fractional digits preserved in output (not real
89
* is_bw: Ignore color related special instructions.
91
extern void pdf_init_device (double unit_conv, int precision, int is_bw);
92
extern void pdf_close_device (void);
94
/* returns 1.0/unit_conv */
95
extern double dev_unit_dviunit (void);
98
/* DVI interpreter knows text positioning in relative motion.
99
* However, pdf_dev_set_string() recieves text string with placement
100
* in absolute position in user space, and it convert absolute
101
* positioning back to relative positioning. It is quite wasteful.
103
* TeX using DVI register stack operation to do CR and then use down
104
* command for LF. DVI interpreter knows hint for current leading
105
* and others (raised or lowered), but they are mostly lost in
106
* pdf_dev_set_string().
114
int is_kern; /* kern or string */
116
spt_t kern; /* negative kern means space */
118
int offset; /* offset to sbuf */
119
int length; /* length of string */
122
unsigned char sbuf[PDF_STRING_LEN_MAX];
126
/* Something for handling raise, leading, etc. here. */
130
/* Draw texts and rules:
132
* xpos, ypos, width, and height are all fixed-point numbers
133
* converted to big-points by multiplying unit_conv (dvi2pts).
134
* They must be position in the user space.
137
* 0 - input string is in multi-byte encoding.
138
* 1 - input string is in 8-bit encoding.
139
* 2 - input string is in 16-bit encoding.
141
extern void pdf_dev_set_string (spt_t xpos, spt_t ypos,
142
const void *instr_ptr, int instr_len,
144
int font_id, int ctype);
145
extern void pdf_dev_set_rule (spt_t xpos, spt_t ypos,
146
spt_t width, spt_t height);
149
extern int pdf_dev_put_image (int xobj_id,
150
transform_info *p, double ref_x, double ref_y);
152
/* The design_size and ptsize required by PK font support...
154
extern int pdf_dev_locate_font (const char *font_name, spt_t ptsize);
156
extern int pdf_dev_setfont (const char *font_name, spt_t ptsize);
158
/* The following two routines are NOT WORKING.
159
* Dvipdfmx doesn't manage gstate well..
162
/* pdf_dev_translate() or pdf_dev_concat() should be used. */
163
extern void pdf_dev_set_origin (double orig_x, double orig_y);
165
/* Always returns 1.0, please rename this. */
166
extern double pdf_dev_scale (void);
168
/* Access text state parameters. */
170
extern int pdf_dev_currentfont (void); /* returns font_id */
171
extern double pdf_dev_get_font_ptsize (int font_id);
173
extern int pdf_dev_get_font_wmode (int font_id); /* ps: special support want this (pTeX). */
175
/* Text composition (direction) mode
176
* This affects only when auto_rotate is enabled.
178
extern int pdf_dev_get_dirmode (void);
179
extern void pdf_dev_set_dirmode (int dir_mode);
181
/* Set rect to rectangle in device space.
182
* Unit conversion spt_t to bp and transformation applied within it.
184
extern void pdf_dev_set_rect (pdf_rect *rect,
185
spt_t x_pos, spt_t y_pos,
186
spt_t width, spt_t height, spt_t depth);
188
/* Accessor to various device parameters.
190
#define PDF_DEV_PARAM_AUTOROTATE 1
191
#define PDF_DEV_PARAM_COLORMODE 2
193
extern int pdf_dev_get_param (int param_type);
194
extern void pdf_dev_set_param (int param_type, int value);
196
/* Text composition mode is ignored (always same as font's
197
* writing mode) and glyph rotation is not enabled if
198
* auto_rotate is unset.
200
#define pdf_dev_set_autorotate(v) pdf_dev_set_param(PDF_DEV_PARAM_AUTOROTATE, (v))
201
#define pdf_dev_set_colormode(v) pdf_dev_set_param(PDF_DEV_PARAM_COLORMODE, (v))
204
* For pdf_doc, pdf_draw and others.
207
/* Force reselecting font:
208
* XFrom (content grabbing) and Metapost support want them.
210
extern void pdf_dev_reset_fonts (void);
212
/* Initialization of transformation matrix with M and others.
213
* They are called within pdf_doc_begin_page() and pdf_doc_end_page().
215
extern void pdf_dev_bop (const pdf_tmatrix *M);
216
extern void pdf_dev_eop (void);
218
/* Text is normal and line art is not normal in dvipdfmx. So we don't have
219
* begin_text (BT in PDF) and end_text (ET), but instead we have graphics_mode()
220
* to terminate text section. pdf_dev_flushpath() and others call this.
222
extern void graphics_mode (void);
224
extern void pdf_dev_get_coord(double *xpos, double *ypos);
225
extern void pdf_dev_push_coord(double xpos, double ypos);
226
extern void pdf_dev_pop_coord(void);
228
#endif /* _PDFDEV_H_ */