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