00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <ft2build.h>
00020 #include "cidriver.h"
00021 #include "cidgload.h"
00022 #include FT_INTERNAL_DEBUG_H
00023
00024 #include "ciderrs.h"
00025
00026 #include FT_SERVICE_POSTSCRIPT_NAME_H
00027 #include FT_SERVICE_XFREE86_NAME_H
00028 #include FT_SERVICE_POSTSCRIPT_INFO_H
00029 #include FT_SERVICE_CID_H
00030
00031
00032
00033
00034
00035
00036
00037
00038 #undef FT_COMPONENT
00039 #define FT_COMPONENT trace_ciddriver
00040
00041
00042
00043
00044
00045
00046
00047 static const char*
00048 cid_get_postscript_name( CID_Face face )
00049 {
00050 const char* result = face->cid.cid_font_name;
00051
00052
00053 if ( result && result[0] == '/' )
00054 result++;
00055
00056 return result;
00057 }
00058
00059
00060 static const FT_Service_PsFontNameRec cid_service_ps_name =
00061 {
00062 (FT_PsName_GetFunc) cid_get_postscript_name
00063 };
00064
00065
00066
00067
00068
00069
00070
00071 static FT_Error
00072 cid_ps_get_font_info( FT_Face face,
00073 PS_FontInfoRec* afont_info )
00074 {
00075 *afont_info = ((CID_Face)face)->cid.font_info;
00076
00077 return CID_Err_Ok;
00078 }
00079
00080 static FT_Error
00081 cid_ps_get_font_extra( FT_Face face,
00082 PS_FontExtraRec* afont_extra )
00083 {
00084 *afont_extra = ((CID_Face)face)->font_extra;
00085
00086 return CID_Err_Ok;
00087 }
00088
00089 static const FT_Service_PsInfoRec cid_service_ps_info =
00090 {
00091 (PS_GetFontInfoFunc) cid_ps_get_font_info,
00092 (PS_GetFontExtraFunc) cid_ps_get_font_extra,
00093 (PS_HasGlyphNamesFunc) NULL,
00094 (PS_GetFontPrivateFunc)NULL
00095 };
00096
00097
00098
00099
00100
00101
00102 static FT_Error
00103 cid_get_ros( CID_Face face,
00104 const char* *registry,
00105 const char* *ordering,
00106 FT_Int *supplement )
00107 {
00108 CID_FaceInfo cid = &face->cid;
00109
00110
00111 if ( registry )
00112 *registry = cid->registry;
00113
00114 if ( ordering )
00115 *ordering = cid->ordering;
00116
00117 if ( supplement )
00118 *supplement = cid->supplement;
00119
00120 return CID_Err_Ok;
00121 }
00122
00123
00124 static FT_Error
00125 cid_get_is_cid( CID_Face face,
00126 FT_Bool *is_cid )
00127 {
00128 FT_Error error = CID_Err_Ok;
00129 FT_UNUSED( face );
00130
00131
00132 if ( is_cid )
00133 *is_cid = 1;
00134
00135 return error;
00136 }
00137
00138
00139 static FT_Error
00140 cid_get_cid_from_glyph_index( CID_Face face,
00141 FT_UInt glyph_index,
00142 FT_UInt *cid )
00143 {
00144 FT_Error error = CID_Err_Ok;
00145 FT_UNUSED( face );
00146
00147
00148 if ( cid )
00149 *cid = glyph_index;
00150
00151 return error;
00152 }
00153
00154
00155 static const FT_Service_CIDRec cid_service_cid_info =
00156 {
00157 (FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros,
00158 (FT_CID_GetIsInternallyCIDKeyedFunc) cid_get_is_cid,
00159 (FT_CID_GetCIDFromGlyphIndexFunc) cid_get_cid_from_glyph_index
00160 };
00161
00162
00163
00164
00165
00166
00167
00168 static const FT_ServiceDescRec cid_services[] =
00169 {
00170 { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID },
00171 { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
00172 { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info },
00173 { FT_SERVICE_ID_CID, &cid_service_cid_info },
00174 { NULL, NULL }
00175 };
00176
00177
00178 FT_CALLBACK_DEF( FT_Module_Interface )
00179 cid_get_interface( FT_Module module,
00180 const char* cid_interface )
00181 {
00182 FT_UNUSED( module );
00183
00184 return ft_service_list_lookup( cid_services, cid_interface );
00185 }
00186
00187
00188
00189 FT_CALLBACK_TABLE_DEF
00190 const FT_Driver_ClassRec t1cid_driver_class =
00191 {
00192
00193 {
00194 FT_MODULE_FONT_DRIVER |
00195 FT_MODULE_DRIVER_SCALABLE |
00196 FT_MODULE_DRIVER_HAS_HINTER,
00197
00198 sizeof( FT_DriverRec ),
00199 "t1cid",
00200 0x10000L,
00201 0x20000L,
00202
00203 0,
00204
00205 cid_driver_init,
00206 cid_driver_done,
00207 cid_get_interface
00208 },
00209
00210
00211 sizeof( CID_FaceRec ),
00212 sizeof( CID_SizeRec ),
00213 sizeof( CID_GlyphSlotRec ),
00214
00215 cid_face_init,
00216 cid_face_done,
00217
00218 cid_size_init,
00219 cid_size_done,
00220 cid_slot_init,
00221 cid_slot_done,
00222
00223 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00224 ft_stub_set_char_sizes,
00225 ft_stub_set_pixel_sizes,
00226 #endif
00227
00228 cid_slot_load_glyph,
00229
00230 0,
00231 0,
00232
00233 0,
00234
00235 cid_size_request,
00236 0
00237 };
00238
00239
00240