1 /* Copyright (C) 2001-2006 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, modified
8    or distributed except as expressly authorized under the terms of that
9    license.  Refer to licensing information at http://www.artifex.com/
10    or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11    San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12 */
13 
14 /* $Id: gxttfb.h 8022 2007-06-05 22:23:38Z giles $ */
15 /* A bridge to True Type interpreter. */
16 
17 #ifndef gxttfb_INCLUDED
18 #  define gxttfb_INCLUDED
19 
20 #include "ttfoutl.h"
21 
22 #ifndef gx_ttfReader_DEFINED
23 #  define gx_ttfReader_DEFINED
24 typedef struct gx_ttfReader_s gx_ttfReader;
25 #endif
26 
27 #ifndef gs_font_type42_DEFINED
28 #  define gs_font_type42_DEFINED
29 typedef struct gs_font_type42_s gs_font_type42;
30 #endif
31 
32 struct gx_ttfReader_s {
33     ttfReader super;
34     int pos;
35     bool error;
36     int extra_glyph_index;
37     gs_font_type42 *pfont;
38     gs_memory_t *memory;
39     gs_glyph_data_t glyph_data;
40     /*  When TT interpreter is invoked, a font and the TT interpreter instance
41 	may use different memory allocators (local and global correspondingly).
42 	Since we don't want to change Free Type function prototypes,
43 	we place the gx_ttfReader instance into the global memory,
44 	to provide an access to it through TExecution_Context.
45 	Due to that, the fields 'pfont' and 'glyph_data' may contain pointers from global
46 	to local memory. They must be NULL when a garbager is invoked.
47 	We reset them whan the TT interpreter exits.
48      */
49 };
50 
51 gx_ttfReader *gx_ttfReader__create(gs_memory_t *mem);
52 void gx_ttfReader__destroy(gx_ttfReader *this);
53 void gx_ttfReader__set_font(gx_ttfReader *this, gs_font_type42 *pfont);
54 ttfFont *ttfFont__create(gs_font_dir *dir);
55 void ttfFont__destroy(ttfFont *this, gs_font_dir *dir);
56 int ttfFont__Open_aux(ttfFont *this, ttfInterpreter *tti, gx_ttfReader *r, gs_font_type42 *pfont,
57     	       const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
58 	       bool design_grid);
59 int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int glyph_index,
60 	const gs_matrix *m, const gs_log2_scale_point * pscale,
61 	gx_path *path, bool grid_fit);
62 
63 #endif /* gxttfb_INCLUDED */
64