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.c,v 1.1 2002/06/25 01:51:32 lpd Exp $ */
18 /* Miscellaneous external entry points for pdfwrite text */
19 #include "gx.h"
20 #include "memory_.h"
21 #include "gdevpdfx.h"
22 #include "gdevpdtx.h"
23 #include "gdevpdtf.h"
24 #include "gdevpdti.h"
25 #include "gdevpdts.h"
26
27 /* GC descriptors */
28 private_st_pdf_text_data();
29
30 /* ---------------- Initialization ---------------- */
31
32 /*
33 * Allocate and initialize the text data structure.
34 */
35 pdf_text_data_t *
pdf_text_data_alloc(gs_memory_t * mem)36 pdf_text_data_alloc(gs_memory_t *mem)
37 {
38 pdf_text_data_t *ptd =
39 gs_alloc_struct(mem, pdf_text_data_t, &st_pdf_text_data,
40 "pdf_text_data_alloc");
41 pdf_outline_fonts_t *pofs = pdf_outline_fonts_alloc(mem);
42 pdf_bitmap_fonts_t *pbfs = pdf_bitmap_fonts_alloc(mem);
43 pdf_text_state_t *pts = pdf_text_state_alloc(mem);
44
45 if (pts == 0 || pbfs == 0 || pofs == 0 || ptd == 0) {
46 gs_free_object(mem, pts, "pdf_text_data_alloc");
47 gs_free_object(mem, pbfs, "pdf_text_data_alloc");
48 gs_free_object(mem, pofs, "pdf_text_data_alloc");
49 gs_free_object(mem, ptd, "pdf_text_data_alloc");
50 return 0;
51 }
52 memset(ptd, 0, sizeof(*ptd));
53 ptd->outline_fonts = pofs;
54 ptd->bitmap_fonts = pbfs;
55 ptd->text_state = pts;
56 return ptd;
57 }
58