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 /* Bitmap font interface for pdfwrite */ 18 19 #ifndef gdevpdti_INCLUDED 20 # define gdevpdti_INCLUDED 21 22 #include "gdevpdt.h" 23 24 /* 25 * Bitmap fonts are Type 3 fonts created internally by pdfwrite. Their 26 * CharProc consists of a single bitmap image at "device" resolution. 27 */ 28 29 /* ================ Types and structures ================ */ 30 31 /* Define the state structure for tracking bitmap fonts. */ 32 /*typedef struct pdf_bitmap_fonts_s pdf_bitmap_fonts_t;*/ 33 struct pdf_bitmap_fonts_s { 34 pdf_font_resource_t *open_font; /* current Type 3 synthesized font */ 35 bool use_open_font; /* if false, start new open_font */ 36 long bitmap_encoding_id; 37 int max_embedded_code; /* max Type 3 code used */ 38 }; 39 40 #ifndef pdf_bitmap_fonts_DEFINED 41 # define pdf_bitmap_fonts_DEFINED 42 typedef struct pdf_bitmap_fonts_s pdf_bitmap_fonts_t; 43 #endif 44 45 /* ================ Procedures ================ */ 46 47 /* Exported for gdevpdf.c */ 48 49 /* 50 * Update text state at the end of a page. 51 */ 52 void pdf_close_text_page(gx_device_pdf *pdev); 53 54 /* Exported for gdevpdfb.c */ 55 56 /* Return the Y offset for a bitmap character image. */ 57 int pdf_char_image_y_offset(const gx_device_pdf *pdev, int x, int y, int h); 58 59 /* Retrieve the x and y offsets for a charproc */ 60 int pdf_charproc_x_offset(pdf_char_proc_t *pcp); 61 int pdf_charproc_y_offset(pdf_char_proc_t *pcp); 62 63 /* Begin a CharProc for an embedded (bitmap) font. */ 64 int pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width, 65 int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp, 66 pdf_stream_position_t * ppos); 67 68 /* End a CharProc. */ 69 int pdf_end_char_proc(gx_device_pdf * pdev, pdf_stream_position_t * ppos); 70 71 int pdf_free_charproc_ownership(gx_device_pdf * pdev, pdf_resource_t *pres); 72 73 /* Put out a reference to an image as a character in an embedded font. */ 74 int pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp, 75 const gs_matrix * pimat); 76 77 /* Only used within text code */ 78 79 /* 80 * Allocate and initialize bookkeeping for bitmap fonts. 81 */ 82 pdf_bitmap_fonts_t *pdf_bitmap_fonts_alloc(gs_memory_t *mem); 83 84 /* 85 * Write the Encoding for bitmap fonts, if needed. 86 */ 87 int pdf_write_bitmap_fonts_Encoding(gx_device_pdf *pdev); 88 89 /* Write the contents of a Type 3 bitmap font resource. */ 90 int pdf_write_contents_bitmap(gx_device_pdf *pdev, pdf_font_resource_t *pdfont); 91 92 /* Mark glyph names for garbager. */ 93 void pdf_mark_glyph_names(const pdf_font_resource_t *pdfont, const gs_memory_t *memory); 94 95 #endif /* gdevpdti_INCLUDED */ 96