1 /***************************************************************************/
5 /* CID driver interface (body). */
7 /* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
22 #include FT_INTERNAL_DEBUG_H
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
32 /*************************************************************************/
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. */
39 #define FT_COMPONENT trace_ciddriver
43 * POSTSCRIPT NAME SERVICE
48 cid_get_postscript_name( CID_Face face )
50 const char* result = face->cid.cid_font_name;
53 if ( result && result[0] == '/' )
60 static const FT_Service_PsFontNameRec cid_service_ps_name =
62 (FT_PsName_GetFunc) cid_get_postscript_name
67 * POSTSCRIPT INFO SERVICE
72 cid_ps_get_font_info( FT_Face face,
73 PS_FontInfoRec* afont_info )
75 *afont_info = ((CID_Face)face)->cid.font_info;
81 cid_ps_get_font_extra( FT_Face face,
82 PS_FontExtraRec* afont_extra )
84 *afont_extra = ((CID_Face)face)->font_extra;
89 static const FT_Service_PsInfoRec cid_service_ps_info =
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 */
104 cid_get_ros( CID_Face face,
105 const char* *registry,
106 const char* *ordering,
109 CID_FaceInfo cid = &face->cid;
113 *registry = cid->registry;
116 *ordering = cid->ordering;
119 *supplement = cid->supplement;
126 cid_get_is_cid( CID_Face face,
129 FT_Error error = CID_Err_Ok;
134 *is_cid = 1; /* cid driver is only used for CID keyed fonts */
141 cid_get_cid_from_glyph_index( CID_Face face,
145 FT_Error error = CID_Err_Ok;
150 *cid = glyph_index; /* identity mapping */
156 static const FT_Service_CIDRec cid_service_cid_info =
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
169 static const FT_ServiceDescRec cid_services[] =
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 },
179 FT_CALLBACK_DEF( FT_Module_Interface )
180 cid_get_interface( FT_Module module,
181 const char* cid_interface )
185 return ft_service_list_lookup( cid_services, cid_interface );
190 FT_CALLBACK_TABLE_DEF
191 const FT_Driver_ClassRec t1cid_driver_class =
193 /* first of all, the FT_Module_Class fields */
195 FT_MODULE_FONT_DRIVER |
196 FT_MODULE_DRIVER_SCALABLE |
197 FT_MODULE_DRIVER_HAS_HINTER,
199 sizeof ( FT_DriverRec ),
200 "t1cid", /* module name */
201 0x10000L, /* version 1.0 of driver */
202 0x20000L, /* requires FreeType 2.0 */
211 /* then the other font drivers fields */
212 sizeof ( CID_FaceRec ),
213 sizeof ( CID_SizeRec ),
214 sizeof ( CID_GlyphSlotRec ),
224 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
225 ft_stub_set_char_sizes,
226 ft_stub_set_pixel_sizes,
231 0, /* FT_Face_GetKerningFunc */
232 0, /* FT_Face_AttachFunc */
234 0, /* FT_Face_GetAdvancesFunc */
237 0 /* FT_Size_SelectFunc */