zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
t42drivr.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* t42drivr.c */
4 /* */
5 /* High-level Type 42 driver interface (body). */
6 /* */
7 /* Copyright 2002-2004, 2006, 2007, 2009, 2011 by Roberto Alameda. */
8 /* */
9 /* This file is part of the FreeType project, and may only be used, */
10 /* modified, and distributed under the terms of the FreeType project */
11 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
12 /* this file you indicate that you have read the license and */
13 /* understand and accept it fully. */
14 /* */
15 /***************************************************************************/
16 
17 
18  /*************************************************************************/
19  /* */
20  /* This driver implements Type42 fonts as described in the */
21  /* Technical Note #5012 from Adobe, with these limitations: */
22  /* */
23  /* 1) CID Fonts are not currently supported. */
24  /* 2) Incremental fonts making use of the GlyphDirectory keyword */
25  /* will be loaded, but the rendering will be using the TrueType */
26  /* tables. */
27  /* 3) As for Type1 fonts, CDevProc is not supported. */
28  /* 4) The Metrics dictionary is not supported. */
29  /* 5) AFM metrics are not supported. */
30  /* */
31  /* In other words, this driver supports Type42 fonts derived from */
32  /* TrueType fonts in a non-CID manner, as done by usual conversion */
33  /* programs. */
34  /* */
35  /*************************************************************************/
36 
37 
38 #include "t42drivr.h"
39 #include "t42objs.h"
40 #include "t42error.h"
41 #include FT_INTERNAL_DEBUG_H
42 
43 #include FT_SERVICE_XFREE86_NAME_H
44 #include FT_SERVICE_GLYPH_DICT_H
45 #include FT_SERVICE_POSTSCRIPT_NAME_H
46 #include FT_SERVICE_POSTSCRIPT_INFO_H
47 
48 #undef FT_COMPONENT
49 #define FT_COMPONENT trace_t42
50 
51 
52  /*
53  *
54  * GLYPH DICT SERVICE
55  *
56  */
57 
58  static FT_Error
60  FT_UInt glyph_index,
62  FT_UInt buffer_max )
63  {
64  FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );
65 
66  return T42_Err_Ok;
67  }
68 
69 
70  static FT_UInt
72  FT_String* glyph_name )
73  {
74  FT_Int i;
75  FT_String* gname;
76 
77 
78  for ( i = 0; i < face->type1.num_glyphs; i++ )
79  {
80  gname = face->type1.glyph_names[i];
81 
82  if ( glyph_name[0] == gname[0] && !ft_strcmp( glyph_name, gname ) )
83  return (FT_UInt)ft_atol( (const char *)face->type1.charstrings[i] );
84  }
85 
86  return 0;
87  }
88 
89 
90  static const FT_Service_GlyphDictRec t42_service_glyph_dict =
91  {
94  };
95 
96 
97  /*
98  *
99  * POSTSCRIPT NAME SERVICE
100  *
101  */
102 
103  static const char*
105  {
106  return (const char*)face->type1.font_name;
107  }
108 
109 
110  static const FT_Service_PsFontNameRec t42_service_ps_font_name =
111  {
113  };
114 
115 
116  /*
117  *
118  * POSTSCRIPT INFO SERVICE
119  *
120  */
121 
122  static FT_Error
124  PS_FontInfoRec* afont_info )
125  {
126  *afont_info = ((T42_Face)face)->type1.font_info;
127 
128  return T42_Err_Ok;
129  }
130 
131 
132  static FT_Error
134  PS_FontExtraRec* afont_extra )
135  {
136  *afont_extra = ((T42_Face)face)->type1.font_extra;
137 
138  return T42_Err_Ok;
139  }
140 
141 
142  static FT_Int
144  {
145  FT_UNUSED( face );
146 
147  return 1;
148  }
149 
150 
151  static FT_Error
153  PS_PrivateRec* afont_private )
154  {
155  *afont_private = ((T42_Face)face)->type1.private_dict;
156 
157  return T42_Err_Ok;
158  }
159 
160 
161  static const FT_Service_PsInfoRec t42_service_ps_info =
162  {
167  (PS_GetFontValueFunc) NULL /* not implemented */
168  };
169 
170 
171  /*
172  *
173  * SERVICE LIST
174  *
175  */
176 
178  {
181  { FT_SERVICE_ID_POSTSCRIPT_INFO, &t42_service_ps_info },
183  { NULL, NULL }
184  };
185 
186 
189  const FT_String* t42_interface )
190  {
191  FT_UNUSED( module );
192 
193  return ft_service_list_lookup( t42_services, t42_interface );
194  }
195 
196 
198  {
199  {
202 #ifdef TT_USE_BYTECODE_INTERPRETER
204 #else
205  0,
206 #endif
207 
208  sizeof ( T42_DriverRec ),
209 
210  "type42",
211  0x10000L,
212  0x20000L,
213 
214  0, /* format interface */
215 
219  },
220 
221  sizeof ( T42_FaceRec ),
222  sizeof ( T42_SizeRec ),
223  sizeof ( T42_GlyphSlotRec ),
224 
231 
232 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
233  ft_stub_set_char_sizes,
234  ft_stub_set_pixel_sizes,
235 #endif
237 
238  0, /* FT_Face_GetKerningFunc */
239  0, /* FT_Face_AttachFunc */
240 
241  0, /* FT_Face_GetAdvancesFunc */
244  };
245 
246 
247 /* END */
T42_GlyphSlot_Done(FT_GlyphSlot t42slot)
Definition: t42objs.c:602
const FT_Driver_ClassRec t42_driver_class
Definition: t42drivr.c:197
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:47
int FT_Error
Definition: fttypes.h:296
T42_Driver_Init(FT_Module module)
Definition: t42objs.c:474
T42_Size_Init(FT_Size size)
Definition: t42objs.c:501
FT_SERVICE_ID_POSTSCRIPT_INFO
Definition: cffdrivr.c:581
static const FT_Service_PsFontNameRec t42_service_ps_font_name
Definition: t42drivr.c:110
static const FT_Service_PsInfoRec t42_service_ps_info
Definition: t42drivr.c:161
#define NULL
Definition: ftobjs.h:61
signed int FT_Int
Definition: fttypes.h:216
FT_Long(* PS_GetFontValueFunc)(FT_Face face, PS_Dict_Keys key, FT_UInt idx, void *value, FT_Long value_len)
Definition: svpsinfo.h:48
FT_SERVICE_ID_GLYPH_DICT
Definition: cffdrivr.c:581
static const FT_ServiceDescRec t42_services[]
Definition: t42drivr.c:177
#define FT_MODULE_DRIVER_SCALABLE
Definition: ftmodapi.h:60
T42_GlyphSlot_Load(FT_GlyphSlot glyph, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: t42objs.c:637
FT_Int(* PS_HasGlyphNamesFunc)(FT_Face face)
Definition: svpsinfo.h:41
T42_Face_Init(FT_Stream stream, FT_Face t42face, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
Definition: t42objs.c:156
FT_Error(* FT_GlyphDict_GetNameFunc)(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
Definition: svgldict.h:38
FT_Error(* PS_GetFontExtraFunc)(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: svpsinfo.h:37
FT_BEGIN_HEADER struct T42_FaceRec_ * T42_Face
FT_BEGIN_HEADER struct T42_SizeRec_ T42_SizeRec
T42_Size_Done(FT_Size t42size)
Definition: t42objs.c:559
T42_GlyphSlot_Init(FT_GlyphSlot t42slot)
Definition: t42objs.c:577
static const FT_Service_GlyphDictRec t42_service_glyph_dict
Definition: t42drivr.c:90
FT_BEGIN_HEADER struct T42_FaceRec_ T42_FaceRec
FT_Error(* PS_GetFontPrivateFunc)(FT_Face face, PS_PrivateRec *afont_private)
Definition: svpsinfo.h:44
EGLContext EGLenum EGLClientBuffer buffer
Definition: eglext.h:87
static const char * t42_get_ps_font_name(T42_Face face)
Definition: t42drivr.c:104
#define FT_MODULE_DRIVER_HAS_HINTER
Definition: ftmodapi.h:64
T42_Size_Select(FT_Size t42size, FT_ULong strike_index)
Definition: t42objs.c:539
#define FT_XF86_FORMAT_TYPE_42
Definition: svxf86nm.h:40
T42_Get_Interface(FT_Module module, const FT_String *t42_interface)
Definition: t42drivr.c:188
FT_UInt(* FT_GlyphDict_NameIndexFunc)(FT_Face face, FT_String *glyph_name)
Definition: svgldict.h:44
static FT_Int t42_ps_has_glyph_names(FT_Face face)
Definition: t42drivr.c:143
static FT_Error t42_get_glyph_name(T42_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
Definition: t42drivr.c:59
#define FT_SERVICE_ID_XF86_NAME
Definition: svxf86nm.h:34
char FT_String
Definition: fttypes.h:183
void * FT_Pointer
Definition: fttypes.h:307
FT_Error(* PS_GetFontInfoFunc)(FT_Face face, PS_FontInfoRec *afont_info)
Definition: svpsinfo.h:33
static FT_Error t42_ps_get_font_info(FT_Face face, PS_FontInfoRec *afont_info)
Definition: t42drivr.c:123
GLenum face
Definition: gl2ext.h:1490
T42_Size_Request(FT_Size t42size, FT_Size_Request req)
Definition: t42objs.c:520
FT_Pointer FT_Module_Interface
Definition: ftmodapi.h:79
#define ft_atol
Definition: ftstdlib.h:144
#define FT_CALLBACK_DEF(x)
Definition: ftconfig.h:554
struct T42_DriverRec_ T42_DriverRec
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:55
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
Definition: cffdrivr.c:581
#define const
Definition: zconf.h:91
unsigned int FT_UInt
Definition: fttypes.h:227
T42_Face_Done(FT_Face t42face)
Definition: t42objs.c:404
FT_BEGIN_HEADER struct PS_FontInfoRec_ PS_FontInfoRec
static FT_UInt t42_get_name_index(T42_Face face, FT_String *glyph_name)
Definition: t42drivr.c:71
static FT_Error t42_ps_get_font_private(FT_Face face, PS_PrivateRec *afont_private)
Definition: t42drivr.c:152
const char *(* FT_PsName_GetFunc)(FT_Face face)
Definition: svpostnm.h:41
int i
Definition: pngrutil.c:1377
#define FT_STRCPYN(dst, src, size)
Definition: ftmemory.h:369
static FT_Error t42_ps_get_font_extra(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: t42drivr.c:133
T42_Driver_Done(FT_Module module)
Definition: t42objs.c:494
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define ft_strcmp
Definition: ftstdlib.h:85