zenilib: zenilib/jni/external/freetype2/src/cid/cidriver.c Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cidriver.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* cidriver.c */
4 /* */
5 /* CID driver interface (body). */
6 /* */
7 /* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17
18
19 #include <ft2build.h>
20 #include "cidriver.h"
21 #include "cidgload.h"
22 #include FT_INTERNAL_DEBUG_H
23
24 #include "ciderrs.h"
25
26 #include FT_SERVICE_POSTSCRIPT_NAME_H
27 #include FT_SERVICE_XFREE86_NAME_H
28 #include FT_SERVICE_POSTSCRIPT_INFO_H
29 #include FT_SERVICE_CID_H
30
31
32 /*************************************************************************/
33 /* */
34 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
35 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
36 /* messages during execution. */
37 /* */
38 #undef FT_COMPONENT
39 #define FT_COMPONENT trace_ciddriver
40
41
42 /*
43 * POSTSCRIPT NAME SERVICE
44 *
45 */
46
47 static const char*
48 cid_get_postscript_name( CID_Face face )
49 {
50 const char* result = face->cid.cid_font_name;
51
52
53 if ( result && result[0] == '/' )
54 result++;
55
56 return result;
57 }
58
59
60 static const FT_Service_PsFontNameRec cid_service_ps_name =
61 {
62 (FT_PsName_GetFunc) cid_get_postscript_name
63 };
64
65
66 /*
67 * POSTSCRIPT INFO SERVICE
68 *
69 */
70
71 static FT_Error
72 cid_ps_get_font_info( FT_Face face,
73 PS_FontInfoRec* afont_info )
74 {
75 *afont_info = ((CID_Face)face)->cid.font_info;
76
77 return CID_Err_Ok;
78 }
79
80 static FT_Error
81 cid_ps_get_font_extra( FT_Face face,
82 PS_FontExtraRec* afont_extra )
83 {
84 *afont_extra = ((CID_Face)face)->font_extra;
85
86 return CID_Err_Ok;
87 }
88
89 static const FT_Service_PsInfoRec cid_service_ps_info =
90 {
91 (PS_GetFontInfoFunc) cid_ps_get_font_info,
92 (PS_GetFontExtraFunc) cid_ps_get_font_extra,
93 (PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */
94 (PS_GetFontPrivateFunc)NULL, /* unsupported */
95 (PS_GetFontValueFunc) NULL /* not implemented */
96 };
97
98
99 /*
100 * CID INFO SERVICE
101 *
102 */
103 static FT_Error
104 cid_get_ros( CID_Face face,
105 const char* *registry,
106 const char* *ordering,
107 FT_Int *supplement )
108 {
109 CID_FaceInfo cid = &face->cid;
110
111
112 if ( registry )
113 *registry = cid->registry;
114
115 if ( ordering )
116 *ordering = cid->ordering;
117
118 if ( supplement )
119 *supplement = cid->supplement;
120
121 return CID_Err_Ok;
122 }
123
124
125 static FT_Error
126 cid_get_is_cid( CID_Face face,
127 FT_Bool *is_cid )
128 {
129 FT_Error error = CID_Err_Ok;
130 FT_UNUSED( face );
131
132
133 if ( is_cid )
134 *is_cid = 1; /* cid driver is only used for CID keyed fonts */
135
136 return error;
137 }
138
139
140 static FT_Error
141 cid_get_cid_from_glyph_index( CID_Face face,
142 FT_UInt glyph_index,
143 FT_UInt *cid )
144 {
145 FT_Error error = CID_Err_Ok;
146 FT_UNUSED( face );
147
148
149 if ( cid )
150 *cid = glyph_index; /* identity mapping */
151
152 return error;
153 }
154
155
156 static const FT_Service_CIDRec cid_service_cid_info =
157 {
158 (FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros,
159 (FT_CID_GetIsInternallyCIDKeyedFunc) cid_get_is_cid,
160 (FT_CID_GetCIDFromGlyphIndexFunc) cid_get_cid_from_glyph_index
161 };
162
163
164 /*
165 * SERVICE LIST
166 *
167 */
168
169 static const FT_ServiceDescRec cid_services[] =
170 {
171 { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID },
172 { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
173 { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info },
174 { FT_SERVICE_ID_CID, &cid_service_cid_info },
175 { NULL, NULL }
176 };
177
178
179 FT_CALLBACK_DEF( FT_Module_Interface )
180 cid_get_interface( FT_Module module,
181 const char* cid_interface )
182 {
183 FT_UNUSED( module );
184
185 return ft_service_list_lookup( cid_services, cid_interface );
186 }
187
188
189
190 FT_CALLBACK_TABLE_DEF
191 const FT_Driver_ClassRec t1cid_driver_class =
192 {
193 /* first of all, the FT_Module_Class fields */
194 {
195 FT_MODULE_FONT_DRIVER |
196 FT_MODULE_DRIVER_SCALABLE |
197 FT_MODULE_DRIVER_HAS_HINTER,
198
199 sizeof ( FT_DriverRec ),
200 "t1cid", /* module name */
201 0x10000L, /* version 1.0 of driver */
202 0x20000L, /* requires FreeType 2.0 */
203
204 0,
205
206 cid_driver_init,
207 cid_driver_done,
208 cid_get_interface
209 },
210
211 /* then the other font drivers fields */
212 sizeof ( CID_FaceRec ),
213 sizeof ( CID_SizeRec ),
214 sizeof ( CID_GlyphSlotRec ),
215
216 cid_face_init,
217 cid_face_done,
218
219 cid_size_init,
220 cid_size_done,
221 cid_slot_init,
222 cid_slot_done,
223
224 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
225 ft_stub_set_char_sizes,
226 ft_stub_set_pixel_sizes,
227 #endif
228
229 cid_slot_load_glyph,
230
231 0, /* FT_Face_GetKerningFunc */
232 0, /* FT_Face_AttachFunc */
233
234 0, /* FT_Face_GetAdvancesFunc */
235
236 cid_size_request,
237 0 /* FT_Size_SelectFunc */
238 };
239
240
241 /* END */
ft_service_list_lookup
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:47
FT_Error
int FT_Error
Definition: fttypes.h:296
CID_FaceInfoRec_::registry
FT_String * registry
Definition: t1tables.h:357
CID_Face
struct CID_FaceRec_ * CID_Face
Definition: t1types.h:195
cid_get_cid_from_glyph_index
static FT_Error cid_get_cid_from_glyph_index(CID_Face face, FT_UInt glyph_index, FT_UInt *cid)
Definition: cidriver.c:141
FT_SERVICE_ID_POSTSCRIPT_INFO
FT_SERVICE_ID_POSTSCRIPT_INFO
Definition: cffdrivr.c:581
FT_ModuleRec_
Definition: ftobjs.h:439
NULL
#define NULL
Definition: ftobjs.h:61
FT_Int
signed int FT_Int
Definition: fttypes.h:216
PS_GetFontValueFunc
FT_Long(* PS_GetFontValueFunc)(FT_Face face, PS_Dict_Keys key, FT_UInt idx, void *value, FT_Long value_len)
Definition: svpsinfo.h:48
cid_services
static const FT_ServiceDescRec cid_services[]
Definition: cidriver.c:169
cid_driver_init
cid_driver_init(FT_Module driver)
Definition: cidobjs.c:465
FT_Driver_ClassRec_
Definition: ftdriver.h:182
CID_GlyphSlotRec_
Definition: cidobjs.h:101
cid_size_done
cid_size_done(FT_Size cidsize)
Definition: cidobjs.c:111
FT_CID_GetIsInternallyCIDKeyedFunc
FT_Error(* FT_CID_GetIsInternallyCIDKeyedFunc)(FT_Face face, FT_Bool *is_cid)
Definition: svcid.h:35
FT_MODULE_DRIVER_SCALABLE
#define FT_MODULE_DRIVER_SCALABLE
Definition: ftmodapi.h:60
CID_FaceInfoRec_
Definition: t1tables.h:351
cidriver.h
PS_HasGlyphNamesFunc
FT_Int(* PS_HasGlyphNamesFunc)(FT_Face face)
Definition: svpsinfo.h:41
CID_FaceRec_
Definition: t1types.h:232
FT_Bool
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:104
PS_GetFontExtraFunc
FT_Error(* PS_GetFontExtraFunc)(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: svpsinfo.h:37
FT_XF86_FORMAT_CID
#define FT_XF86_FORMAT_CID
Definition: svxf86nm.h:41
cid_driver_done
cid_driver_done(FT_Module driver)
Definition: cidobjs.c:485
CID_FaceInfoRec_::cid_font_name
FT_String * cid_font_name
Definition: t1tables.h:353
PS_GetFontPrivateFunc
FT_Error(* PS_GetFontPrivateFunc)(FT_Face face, PS_PrivateRec *afont_private)
Definition: svpsinfo.h:44
FT_MODULE_DRIVER_HAS_HINTER
#define FT_MODULE_DRIVER_HAS_HINTER
Definition: ftmodapi.h:64
registry
const char ** registry
Definition: cffdrivr.c:443
result
GLuint64EXT * result
Definition: glew.h:12708
cid_slot_load_glyph
cid_slot_load_glyph(FT_GlyphSlot cidglyph, FT_Size cidsize, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: cidgload.c:269
cid_face_done
cid_face_done(FT_Face cidface)
Definition: cidobjs.c:194
FT_FaceRec_
Definition: freetype.h:912
error
FT_Error error
Definition: cffdrivr.c:407
FT_SERVICE_ID_XF86_NAME
#define FT_SERVICE_ID_XF86_NAME
Definition: svxf86nm.h:34
FT_CID_GetCIDFromGlyphIndexFunc
FT_Error(* FT_CID_GetCIDFromGlyphIndexFunc)(FT_Face face, FT_UInt glyph_index, FT_UInt *cid)
Definition: svcid.h:38
PS_GetFontInfoFunc
FT_Error(* PS_GetFontInfoFunc)(FT_Face face, PS_FontInfoRec *afont_info)
Definition: svpsinfo.h:33
face
GLenum face
Definition: gl2ext.h:1490
cid_service_cid_info
static const FT_Service_CIDRec cid_service_cid_info
Definition: cidriver.c:156
cid_ps_get_font_info
static FT_Error cid_ps_get_font_info(FT_Face face, PS_FontInfoRec *afont_info)
Definition: cidriver.c:72
FT_Module_Interface
FT_Pointer FT_Module_Interface
Definition: ftmodapi.h:79
cid_get_postscript_name
static const char * cid_get_postscript_name(CID_Face face)
Definition: cidriver.c:48
cid_face_init
cid_face_init(FT_Stream stream, FT_Face cidface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
Definition: cidobjs.c:278
CID_FaceInfoRec_::ordering
FT_String * ordering
Definition: t1tables.h:358
cid_service_ps_info
static const FT_Service_PsInfoRec cid_service_ps_info
Definition: cidriver.c:89
ciderrs.h
FT_CALLBACK_DEF
#define FT_CALLBACK_DEF(x)
Definition: ftconfig.h:554
FT_MODULE_FONT_DRIVER
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:55
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
Definition: cffdrivr.c:581
FT_SERVICE_ID_CID
FT_SERVICE_ID_CID
Definition: cffdrivr.c:581
cid_ps_get_font_extra
static FT_Error cid_ps_get_font_extra(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: cidriver.c:81
cid_service_ps_name
static const FT_Service_PsFontNameRec cid_service_ps_name
Definition: cidriver.c:60
FT_ServiceDescRec_
Definition: ftserv.h:157
CID_FaceRec_::cid
CID_FaceInfoRec cid
Definition: t1types.h:237
cid_get_interface
cid_get_interface(FT_Module module, const char *cid_interface)
Definition: cidriver.c:180
cid_get_is_cid
static FT_Error cid_get_is_cid(CID_Face face, FT_Bool *is_cid)
Definition: cidriver.c:126
const
#define const
Definition: zconf.h:91
ft2build.h
FT_UInt
unsigned int FT_UInt
Definition: fttypes.h:227
PS_FontExtraRec_
Definition: t1types.h:86
FT_CID_GetRegistryOrderingSupplementFunc
FT_Error(* FT_CID_GetRegistryOrderingSupplementFunc)(FT_Face face, const char **registry, const char **ordering, FT_Int *supplement)
Definition: svcid.h:30
cid_slot_done
cid_slot_done(FT_GlyphSlot slot)
Definition: cidobjs.c:50
cid_size_request
cid_size_request(FT_Size size, FT_Size_Request req)
Definition: cidobjs.c:156
CID_SizeRec
struct CID_SizeRec_ CID_SizeRec
CID_FaceInfoRec_::supplement
FT_Int supplement
Definition: t1tables.h:359
cid_size_init
cid_size_init(FT_Size cidsize)
Definition: cidobjs.c:131
cidgload.h
PS_FontInfoRec
FT_BEGIN_HEADER struct PS_FontInfoRec_ PS_FontInfoRec
cid_slot_init
cid_slot_init(FT_GlyphSlot slot)
Definition: cidobjs.c:57
FT_PsName_GetFunc
const char *(* FT_PsName_GetFunc)(FT_Face face)
Definition: svpostnm.h:41
FT_DriverRec
struct FT_DriverRec_ FT_DriverRec
supplement
const char const char FT_Int * supplement
Definition: cffdrivr.c:446
cid_get_ros
static FT_Error cid_get_ros(CID_Face face, const char **registry, const char **ordering, FT_Int *supplement)
Definition: cidriver.c:104
FT_UNUSED
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
t1cid_driver_class
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec t1cid_driver_class
Definition: cidriver.c:191
ordering
const char const char ** ordering
Definition: cffdrivr.c:443
FT_CALLBACK_TABLE_DEF
#define FT_CALLBACK_TABLE_DEF
Definition: ftconfig.h:564