xref: /plan9/sys/src/cmd/gs/src/gdevpdtx.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: gdevpdtx.h,v 1.4 2005/01/24 16:03:40 igor Exp $ */
18 /* Shared implementation definitions for pdfwrite text and fonts */
19 
20 #ifndef gdevpdtx_INCLUDED
21 #  define gdevpdtx_INCLUDED
22 
23 #include "gdevpdt.h"
24 
25 /*
26  * The pdfwrite text code is designed in layers.  Each layer uses only
27  * facilities defined in that layer and those below it.  The layers and the
28  * code files that define them are:
29  *
30  * Text processing
31  *   gdevpdtt.c - main text processing and utilities
32  *   gdevpdtc.c - processing for composite and CID-based fonts
33  *   gdevpdte.c - processing for Encoding-based (i.e., all other) fonts
34  *   gdevpdts.c - text state bookkeeping
35  *   gdevpdt[st].h - definitions shared by the above
36  * Font resources
37  *   gdevpdtf.h - interface and public definitions
38  *   gdevpdtf.c - implementation of font resources, except for writing
39  *   gdevpdtw.[hc] - font resource writing
40  * Font descriptors
41  *   gdevpdtd.h - interface and public definitions
42  *   gdevpdtd.c - implementation of font descriptors
43  * Base fonts
44  *   gdevpdtb.h - interface and public definitions
45  *   gdevpdtb.c - implementation of base fonts
46  *
47  * There is also a module for bitmap font processing:
48  *   gdevpdti.h - interface and public definitions
49  *   gdevpdti.c - implementation of bitmap fonts
50  * This handles both text processing and font resource management for
51  * Type 3 bitmap fonts, which don't fit into the layer structure very well.
52  */
53 
54 /* ================ Types and structures ================ */
55 
56 /*
57  * Define the structure for managing the text and font state.  This is
58  * made up of several individually opaque components.
59  */
60 
61 #ifndef pdf_bitmap_fonts_DEFINED
62 #  define pdf_bitmap_fonts_DEFINED
63 typedef struct pdf_bitmap_fonts_s pdf_bitmap_fonts_t;
64 #endif
65 #ifndef pdf_outline_fonts_DEFINED
66 #  define pdf_outline_fonts_DEFINED
67 typedef struct pdf_outline_fonts_s pdf_outline_fonts_t;
68 #endif
69 #ifndef pdf_text_state_DEFINED
70 #  define pdf_text_state_DEFINED
71 typedef struct pdf_text_state_s pdf_text_state_t;
72 #endif
73 
74 /*typedef struct pdf_text_data_s pdf_text_data_t;*/  /* gdevpdfx.h */
75 struct pdf_text_data_s {
76     pdf_outline_fonts_t *outline_fonts;	/* gdevpdtf.c */
77     pdf_bitmap_fonts_t *bitmap_fonts; /* gdevpdti.c */
78     pdf_text_state_t *text_state; /* gdevpdts.c */
79 };
80 #define private_st_pdf_text_data() /* gdevpdt.c */\
81   gs_private_st_ptrs3(st_pdf_text_data, pdf_text_data_t, "pdf_text_data_t",\
82     pdf_text_data_enum_ptrs, pdf_text_data_reloc_ptrs,\
83     outline_fonts, bitmap_fonts, text_state)
84 
85 /* ================ Procedures (internal utilities) ================ */
86 
87 /* The typedef will eventually move to gdevpdfx.h. */
88 typedef struct pdf_font_resource_s pdf_font_resource_t;
89 
90 /* ---------------- Font accessing ---------------- */
91 
92 /* Get the object ID of a font resource. */
93 long pdf_font_id(const pdf_font_resource_t *pdfont);
94 /* Register charproc fonts with the page or substream. */
95 int pdf_used_charproc_resources(gx_device_pdf *pdev, pdf_font_resource_t *pdfont);
96 
97 #endif /* gdevpdtx_INCLUDED */
98