1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: gdevpdts.h 8265 2007-10-02 07:31:58Z ken $ */
15
/* Text state structure and API for pdfwrite */
17
#ifndef gdevpdts_INCLUDED
18
# define gdevpdts_INCLUDED
23
* See gdevpdtt.h for a discussion of the multiple coordinate systems that
24
* the text code must use.
27
/* ================ Types and structures ================ */
29
#ifndef pdf_text_state_DEFINED
30
# define pdf_text_state_DEFINED
31
typedef struct pdf_text_state_s pdf_text_state_t;
35
* Clients pass in the text state values; the implementation decides when
36
* (and, in the case of text positioning, how) to emit PDF commands to
37
* set them in the output.
39
typedef struct pdf_text_state_values_s {
40
float character_spacing; /* Tc */
41
pdf_font_resource_t *pdfont; /* for Tf */
42
double size; /* for Tf */
44
* The matrix is the transformation from text space to user space, which
45
* in pdfwrite text output is the same as device space. Thus this
46
* matrix combines the effect of the PostScript CTM and the FontMatrix,
47
* scaled by the inverse of the font size value.
49
gs_matrix matrix; /* Tm et al */
50
int render_mode; /* Tr */
51
float word_spacing; /* Tw */
52
} pdf_text_state_values_t;
53
#define TEXT_STATE_VALUES_DEFAULT\
54
0, /* character_spacing */\
57
{ identity_matrix_body }, /* matrix */\
61
/* ================ Procedures ================ */
63
/* ------ Exported for gdevpdfu.c ------ */
66
* Transition from stream context to text context.
68
int pdf_from_stream_to_text(gx_device_pdf *pdev);
71
* Transition from string context to text context.
73
int pdf_from_string_to_text(gx_device_pdf *pdev);
76
* Close the text aspect of the current contents part.
78
void pdf_close_text_contents(gx_device_pdf *pdev); /* gdevpdts.h */
80
/* ------ Used only within the text code ------ */
83
* Test whether a change in render_mode requires resetting the stroke
86
bool pdf_render_mode_uses_stroke(const gx_device_pdf *pdev,
87
const pdf_text_state_values_t *ptsv);
90
* Read the stored client view of text state values.
92
void pdf_get_text_state_values(gx_device_pdf *pdev,
93
pdf_text_state_values_t *ptsv);
96
* Set wmode to text state.
98
void pdf_set_text_wmode(gx_device_pdf *pdev, int wmode);
102
* Set the stored client view of text state values.
104
int pdf_set_text_state_values(gx_device_pdf *pdev,
105
const pdf_text_state_values_t *ptsv);
108
* Transform a distance from unscaled text space (text space ignoring the
109
* scaling implied by the font size) to device space.
111
int pdf_text_distance_transform(floatp wx, floatp wy,
112
const pdf_text_state_t *pts,
116
* Return the current (x,y) text position as seen by the client, in
117
* unscaled text space.
119
void pdf_text_position(const gx_device_pdf *pdev, gs_point *ppt);
122
* Append characters to text being accumulated, giving their advance width
125
int pdf_append_chars(gx_device_pdf * pdev, const byte * str, uint size,
126
floatp wx, floatp wy, bool nobreak);
128
bool pdf_compare_text_state_for_charpath(pdf_text_state_t *pts, gx_device_pdf *pdev,
129
gs_imager_state *pis, gs_font *font,
130
const gs_text_params_t *text);
132
int pdf_modify_text_render_mode(pdf_text_state_t *pts, int render_mode);
134
#endif /* gdevpdts_INCLUDED */