1 /* Copyright (C) 2001-2012 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134, San Rafael,
13    CA  94903, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* Interface for pdfwrite text and fonts */
18 
19 #ifndef gdevpdt_INCLUDED
20 #  define gdevpdt_INCLUDED
21 
22 /*
23  * This file defines a largely opaque interface to the text and font
24  * handling code for pdfwrite.  This is the only file that pdfwrite code
25  * outside the text and font handling subsystem (pdftext.dev) should
26  * #include.
27  *
28  * The declarations in this file deliberately duplicate declarations in
29  * various other header files of the pdfwrite text/font subsystem.
30  * This allows the compiler to check them for consistency.
31  */
32 
33 /* ================ Procedures ================ */
34 
35 /* ---------------- Utility (for gdevpdf.c) ---------------- */
36 
37 /*
38  * Allocate and initialize text state bookkeeping.
39  */
40 pdf_text_state_t *pdf_text_state_alloc(gs_memory_t *mem);
41 
42 /*
43  * Allocate and initialize the text data structure.
44  */
45 pdf_text_data_t *pdf_text_data_alloc(gs_memory_t *mem);	/* gdevpdts.h */
46 
47 int text_data_free(gs_memory_t *mem, pdf_text_data_t *ptd);
48 
49 /*
50  * Reset the text state at the beginning of the page.
51  */
52 void pdf_reset_text_page(pdf_text_data_t *ptd);	/* gdevpdts.h */
53 
54 /*
55  * Reset the text state after a grestore.
56  */
57 void pdf_reset_text_state(pdf_text_data_t *ptd); /* gdevpdts.h */
58 
59 /*
60  * Update text state at the end of a page.
61  */
62 void pdf_close_text_page(gx_device_pdf *pdev); /* gdevpdti.h */
63 
64 #ifdef DEPRECATED_906
65 /*
66  * Close the text-related parts of a document, including writing out font
67  * and related resources.
68  */
69 int pdf_close_text_document(gx_device_pdf *pdev); /* gdevpdtw.h */
70 #endif
71 
72 /* ---------------- Contents state (for gdevpdfu.c) ---------------- */
73 
74 /*
75  * Transition from stream context to text context.
76  */
77 int pdf_from_stream_to_text(gx_device_pdf *pdev); /* gdevpdts.h */
78 
79 /*
80  * Transition from string context to text context.
81  */
82 int pdf_from_string_to_text(gx_device_pdf *pdev); /* gdevpdts.h */
83 
84 /*
85  * Close the text aspect of the current contents part.
86  */
87 void pdf_close_text_contents(gx_device_pdf *pdev); /* gdevpdts.h */
88 
89 /* ---------------- Bitmap fonts (for gdevpdfb.c) ---------------- */
90 
91 /* Return the Y offset for a bitmap character image. */
92 int pdf_char_image_y_offset(const gx_device_pdf *pdev, int x, int y, int h);/* gdevpdti.h */
93 
94 /* Begin a CharProc for an embedded (bitmap) font. */
95 int pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width,
96                         int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp,
97                         pdf_stream_position_t * ppos); /* gdevpdti.h */
98 
99 /* End a CharProc. */
100 int pdf_end_char_proc(gx_device_pdf * pdev,
101                       pdf_stream_position_t * ppos); /* gdevpdti.h */
102 
103 /* Put out a reference to an image as a character in an embedded font. */
104 int pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp,
105                       const gs_matrix * pimat);	/* gdevpdti.h */
106 
107 #endif /* gdevpdt_INCLUDED */
108