xref: /plan9/sys/src/cmd/gs/src/gdevpdti.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: gdevpdti.h,v 1.3 2003/04/08 16:31:56 igor Exp $ */
18 /* Bitmap font interface for pdfwrite */
19 
20 #ifndef gdevpdti_INCLUDED
21 #  define gdevpdti_INCLUDED
22 
23 #include "gdevpdt.h"
24 
25 /*
26  * Bitmap fonts are Type 3 fonts created internally by pdfwrite.  Their
27  * CharProc consists of a single bitmap image at "device" resolution.
28  */
29 
30 /* ================ Types and structures ================ */
31 
32 #ifndef pdf_bitmap_fonts_DEFINED
33 #  define pdf_bitmap_fonts_DEFINED
34 typedef struct pdf_bitmap_fonts_s pdf_bitmap_fonts_t;
35 #endif
36 
37 /* ================ Procedures ================ */
38 
39 /* Exported for gdevpdf.c */
40 
41 /*
42  * Update text state at the end of a page.
43  */
44 void pdf_close_text_page(gx_device_pdf *pdev);
45 
46 /* Exported for gdevpdfb.c */
47 
48 /* Return the Y offset for a bitmap character image. */
49 int pdf_char_image_y_offset(const gx_device_pdf *pdev, int x, int y, int h);
50 
51 /* Begin a CharProc for an embedded (bitmap) font. */
52 int pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width,
53 			int y_offset, gs_id id, pdf_char_proc_t **ppcp,
54 			pdf_stream_position_t * ppos);
55 
56 /* End a CharProc. */
57 int pdf_end_char_proc(gx_device_pdf * pdev, pdf_stream_position_t * ppos);
58 
59 /* Put out a reference to an image as a character in an embedded font. */
60 int pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp,
61 		      const gs_matrix * pimat);
62 
63 /* Only used within text code */
64 
65 /*
66  * Allocate and initialize bookkeeping for bitmap fonts.
67  */
68 pdf_bitmap_fonts_t *pdf_bitmap_fonts_alloc(gs_memory_t *mem);
69 
70 /*
71  * Write the Encoding for bitmap fonts, if needed.
72  */
73 int pdf_write_bitmap_fonts_Encoding(gx_device_pdf *pdev);
74 
75 /* Write the contents of a Type 3 bitmap font resource. */
76 int pdf_write_contents_bitmap(gx_device_pdf *pdev, pdf_font_resource_t *pdfont);
77 
78 #endif /* gdevpdti_INCLUDED */
79