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