1 /* Copyright (C) 2000 artofcode LLC. All rights reserved. 2 3 This program is free software; you can redistribute it and/or modify it 4 under the terms of the GNU General Public License as published by the 5 Free Software Foundation; either version 2 of the License, or (at your 6 option) any later version. 7 8 This program is distributed in the hope that it will be useful, but 9 WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along 14 with this program; if not, write to the Free Software Foundation, Inc., 15 59 Temple Place, Suite 330, Boston, MA, 02111-1307. 16 17 */ 18 19 /*$Id: gxfcid.h,v 1.6.6.1.2.1 2003/01/17 00:49:03 giles Exp $ */ 20 /* Definitions for CID-keyed fonts */ 21 22 #ifndef gxfcid_INCLUDED 23 # define gxfcid_INCLUDED 24 25 #include "gxcid.h" /* for CIDSystemInfo */ 26 #include "gxfont.h" 27 #include "gxfont42.h" 28 29 /* ---------------- Structures ---------------- */ 30 31 /* 32 * Define the data common to CIDFontType 0 (FontType 9, analogous to 1) 33 * and 2 (FontType 11, analogous to 42). 34 */ 35 #define MAX_GDBytes 4 36 typedef struct gs_font_cid_data_s { 37 gs_cid_system_info_t CIDSystemInfo; 38 int CIDCount; 39 int GDBytes; /* optional, for standard glyph_data */ 40 /*int PaintType;*/ 41 /*float StrokeWidth;*/ 42 } gs_font_cid_data; 43 44 extern_st(st_gs_font_cid_data); 45 #define public_st_gs_font_cid_data() /* in gsfcid.c */\ 46 gs_public_st_suffix_add0_final(st_gs_font_cid_data,\ 47 gs_font_cid_data, "gs_font_cid_data",\ 48 font_cid_data_enum_ptrs, font_cid_data_reloc_ptrs,\ 49 gs_font_finalize, st_cid_system_info) 50 #define st_gs_font_cid_data_num_ptrs\ 51 st_cid_system_info_num_ptrs 52 53 /* 54 * Define the structures for CIDFontType 0, 1, and 2 fonts. In principle, 55 * each of these should be in its own header file, but they're so small 56 * that we include them here. 57 */ 58 59 /* CIDFontType 0 references an array of (partial) FontType 1 fonts. */ 60 61 #ifndef gs_font_type1_DEFINED 62 # define gs_font_type1_DEFINED 63 typedef struct gs_font_type1_s gs_font_type1; 64 #endif 65 66 #ifndef gs_font_cid0_DEFINED 67 # define gs_font_cid0_DEFINED 68 typedef struct gs_font_cid0_s gs_font_cid0; 69 #endif 70 71 #define MAX_FDBytes 4 72 typedef struct gs_font_cid0_data_s { 73 gs_font_cid_data common; 74 ulong CIDMapOffset; /* optional, for standard glyph_data */ 75 gs_font_type1 **FDArray; 76 uint FDArray_size; 77 int FDBytes; /* optional, for standard glyph_data */ 78 /* 79 * The third argument of glyph_data may be NULL if only the font number 80 * is wanted. glyph_data returns 1 if the string is newly allocated 81 * (using the font's allocator) and can be freed by the client. 82 */ 83 int (*glyph_data)(P4(gs_font_base *, gs_glyph, gs_const_string *, 84 int *)); 85 void *proc_data; 86 } gs_font_cid0_data; 87 struct gs_font_cid0_s { 88 gs_font_base_common; 89 gs_font_cid0_data cidata; 90 }; 91 92 extern_st(st_gs_font_cid0); 93 #define public_st_gs_font_cid0() /* in gsfcid.c */\ 94 gs_public_st_composite_use_final(st_gs_font_cid0,\ 95 gs_font_cid0, "gs_font_cid0",\ 96 font_cid0_enum_ptrs, font_cid0_reloc_ptrs, gs_font_finalize) 97 #define st_gs_font_cid0_max_ptrs\ 98 (st_gs_font_max_ptrs + st_gs_font_cid_data_num_ptrs + 2) 99 100 /* CIDFontType 1 doesn't reference any additional structures. */ 101 102 typedef struct gs_font_cid1_data_s { 103 gs_cid_system_info_t CIDSystemInfo; 104 } gs_font_cid1_data; 105 typedef struct gs_font_cid1_s { 106 gs_font_base_common; 107 gs_font_cid1_data cidata; 108 } gs_font_cid1; 109 110 extern_st(st_gs_font_cid1); 111 #define public_st_gs_font_cid1() /* in gsfcid.c */\ 112 gs_public_st_composite_use_final(st_gs_font_cid1,\ 113 gs_font_cid1, "gs_font_cid1",\ 114 font_cid1_enum_ptrs, font_cid1_reloc_ptrs, gs_font_finalize) 115 #define st_gs_font_cid1_max_ptrs\ 116 (st_gs_font_max_ptrs + st_cid_system_info_num_ptrs) 117 118 /* CIDFontType 2 is a subclass of FontType 42. */ 119 120 #ifndef gs_font_cid2_DEFINED 121 # define gs_font_cid2_DEFINED 122 typedef struct gs_font_cid2_s gs_font_cid2; 123 #endif 124 typedef struct gs_font_cid2_data_s { 125 gs_font_cid_data common; 126 int MetricsCount; 127 int (*CIDMap_proc)(P2(gs_font_cid2 *, gs_glyph)); 128 /* 129 * "Wrapper" get_outline and glyph_info procedures are needed, to 130 * handle MetricsCount. Save the original ones here. 131 */ 132 struct o_ { 133 int (*get_outline)(P3(gs_font_type42 *, uint, gs_const_string *)); 134 int (*get_metrics)(P4(gs_font_type42 *, uint, int, float [4])); 135 } orig_procs; 136 } gs_font_cid2_data; 137 struct gs_font_cid2_s { 138 gs_font_type42_common; 139 gs_font_cid2_data cidata; 140 }; 141 142 extern_st(st_gs_font_cid2); 143 #define public_st_gs_font_cid2() /* in gsfcid.c */\ 144 gs_public_st_composite_use_final(st_gs_font_cid2,\ 145 gs_font_cid2, "gs_font_cid2",\ 146 font_cid2_enum_ptrs, font_cid2_reloc_ptrs, gs_font_finalize) 147 #define st_gs_font_cid2_max_ptrs\ 148 (st_gs_font_type42_max_ptrs + st_gs_font_cid_data_num_ptrs) 149 150 /* ---------------- Procedures ---------------- */ 151 152 /* 153 * Get the CIDSystemInfo of a font. If the font is not a CIDFont, 154 * return NULL. 155 */ 156 const gs_cid_system_info_t *gs_font_cid_system_info(P1(const gs_font *)); 157 158 /* 159 * Provide a default enumerate_glyph procedure for CIDFontType 0 fonts. 160 * Built for simplicity, not for speed. 161 */ 162 font_proc_enumerate_glyph(gs_font_cid0_enumerate_glyph); 163 164 #endif /* gxfcid_INCLUDED */ 165