~ubuntu-branches/ubuntu/utopic/texlive-bin/utopic

« back to all changes in this revision

Viewing changes to texk/dvipdfmx/dvipdfmx-20110311/src/pdfdev.h

  • Committer: Package Import Robot
  • Author(s): Norbert Preining
  • Date: 2012-05-07 10:47:49 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20120507104749-p00ot5sajjbkp1hp
Tags: 2011.20120507-1
* new upstream checkout: uptex 1.10
* drop patches for config file inclusion in (x)dvipdfmx, included upstream
* add man page for etex
* include pmpost patches and build it
* adapt/unfuzzify patches for current sources
* disable mtx building, we have prepmx package in Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  $Header: /home/cvsroot/dvipdfmx/src/pdfdev.h,v 1.25 2008/12/11 16:03:05 matthias Exp $
2
 
    
3
 
    This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
4
 
 
5
 
    Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
6
 
    the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
7
 
    
8
 
    Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
9
 
 
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.
14
 
    
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.
19
 
    
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.
23
 
*/
24
 
 
25
 
#ifndef _PDFDEV_H_
26
 
#define _PDFDEV_H_
27
 
 
28
 
#include "numbers.h"
29
 
#include "pdfobj.h"
30
 
#include "pdfcolor.h"
31
 
 
32
 
typedef signed long spt_t;
33
 
 
34
 
typedef struct pdf_tmatrix
35
 
{
36
 
  double a, b, c, d, e, f;
37
 
} pdf_tmatrix;
38
 
 
39
 
typedef struct pdf_rect
40
 
{
41
 
  double llx, lly, urx, ury;
42
 
} pdf_rect;
43
 
 
44
 
typedef struct pdf_coord
45
 
{
46
 
  double x, y;
47
 
} pdf_coord;
48
 
 
49
 
/* The name transform_info is misleading.
50
 
 * I'll put this here for a moment...
51
 
 */
52
 
typedef struct
53
 
{
54
 
  /* Physical dimensions
55
 
   *
56
 
   * If those values are given, images will be scaled
57
 
   * and/or shifted to fit within a box described by
58
 
   * those values.
59
 
   */
60
 
  double      width;
61
 
  double      height;
62
 
  double      depth;
63
 
 
64
 
  pdf_tmatrix matrix; /* transform matrix */
65
 
  pdf_rect    bbox;   /* user_bbox */
66
 
 
67
 
  int         flags;
68
 
} transform_info;
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);
75
 
 
76
 
 
77
 
extern void   pdf_dev_set_verbose (void);
78
 
 
79
 
/* Not in spt_t. */
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);
85
 
 
86
 
/* unit_conv: multiplier for input unit (spt_t) to bp conversion.
87
 
 * precision: How many fractional digits preserved in output (not real
88
 
 *            accuracy control).
89
 
 * is_bw:     Ignore color related special instructions.
90
 
 */
91
 
extern void   pdf_init_device   (double unit_conv, int precision, int is_bw);
92
 
extern void   pdf_close_device  (void);
93
 
 
94
 
/* returns 1.0/unit_conv */
95
 
extern double dev_unit_dviunit  (void);
96
 
 
97
 
#if 0
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.
102
 
 *
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().
107
 
 */
108
 
 
109
 
typedef struct
110
 
{
111
 
  int      argc;
112
 
 
113
 
  struct {
114
 
    int    is_kern; /* kern or string */
115
 
 
116
 
    spt_t  kern;    /* negative kern means space */
117
 
 
118
 
    int    offset;  /* offset to sbuf   */
119
 
    int    length;  /* length of string */
120
 
  } args[];
121
 
 
122
 
  unsigned char sbuf[PDF_STRING_LEN_MAX];
123
 
 
124
 
} pdf_text_string;
125
 
 
126
 
/* Something for handling raise, leading, etc. here. */
127
 
 
128
 
#endif
129
 
 
130
 
/* Draw texts and rules:
131
 
 *
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.
135
 
 *
136
 
 * ctype:
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.
140
 
 */
141
 
extern void   pdf_dev_set_string (spt_t xpos, spt_t ypos,
142
 
                                  const void *instr_ptr, int instr_len,
143
 
                                  spt_t text_width,
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);
147
 
 
148
 
/* Place XObject */
149
 
extern int    pdf_dev_put_image  (int xobj_id,
150
 
                                  transform_info *p, double ref_x, double ref_y);
151
 
 
152
 
/* The design_size and ptsize required by PK font support...
153
 
 */
154
 
extern int    pdf_dev_locate_font (const char *font_name, spt_t ptsize);
155
 
 
156
 
extern int    pdf_dev_setfont     (const char *font_name, spt_t ptsize);
157
 
 
158
 
/* The following two routines are NOT WORKING.
159
 
 * Dvipdfmx doesn't manage gstate well..
160
 
 */
161
 
#if 0
162
 
/* pdf_dev_translate() or pdf_dev_concat() should be used. */
163
 
extern void   pdf_dev_set_origin (double orig_x, double orig_y);
164
 
#endif
165
 
/* Always returns 1.0, please rename this. */
166
 
extern double pdf_dev_scale      (void);
167
 
 
168
 
/* Access text state parameters. */
169
 
#if 0
170
 
extern int    pdf_dev_currentfont     (void); /* returns font_id */
171
 
extern double pdf_dev_get_font_ptsize (int font_id);
172
 
#endif
173
 
extern int    pdf_dev_get_font_wmode  (int font_id); /* ps: special support want this (pTeX). */
174
 
 
175
 
/* Text composition (direction) mode
176
 
 * This affects only when auto_rotate is enabled.
177
 
 */
178
 
extern int    pdf_dev_get_dirmode     (void);
179
 
extern void   pdf_dev_set_dirmode     (int dir_mode);
180
 
 
181
 
/* Set rect to rectangle in device space.
182
 
 * Unit conversion spt_t to bp and transformation applied within it.
183
 
 */
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);
187
 
 
188
 
/* Accessor to various device parameters.
189
 
 */
190
 
#define PDF_DEV_PARAM_AUTOROTATE  1
191
 
#define PDF_DEV_PARAM_COLORMODE   2
192
 
 
193
 
extern int    pdf_dev_get_param (int param_type);
194
 
extern void   pdf_dev_set_param (int param_type, int value);
195
 
 
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.
199
 
 */
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))
202
 
 
203
 
/*
204
 
 * For pdf_doc, pdf_draw and others.
205
 
 */
206
 
 
207
 
/* Force reselecting font:
208
 
 * XFrom (content grabbing) and Metapost support want them.
209
 
 */
210
 
extern void   pdf_dev_reset_fonts (void);
211
 
 
212
 
/* Initialization of transformation matrix with M and others.
213
 
 * They are called within pdf_doc_begin_page() and pdf_doc_end_page().
214
 
 */
215
 
extern void   pdf_dev_bop (const pdf_tmatrix *M);
216
 
extern void   pdf_dev_eop (void);
217
 
 
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.
221
 
 */
222
 
extern void   graphics_mode (void);
223
 
 
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);
227
 
 
228
 
#endif /* _PDFDEV_H_ */