1 /***************************************************************************/ 2 /* */ 3 /* cidriver.c */ 4 /* */ 5 /* CID driver interface (body). */ 6 /* */ 7 /* Copyright 1996-2001, 2002 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 #include FT_INTERNAL_STREAM_H 24 #include FT_INTERNAL_POSTSCRIPT_NAMES_H 25 26 #include "ciderrs.h" 27 28 29 /*************************************************************************/ 30 /* */ 31 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ 32 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ 33 /* messages during execution. */ 34 /* */ 35 #undef FT_COMPONENT 36 #define FT_COMPONENT trace_ciddriver 37 38 39 static const char* cid_get_postscript_name(CID_Face face)40 cid_get_postscript_name( CID_Face face ) 41 { 42 const char* result = face->cid.cid_font_name; 43 44 45 if ( result && result[0] == '/' ) 46 result++; 47 48 return result; 49 } 50 51 52 static FT_Module_Interface cid_get_interface(FT_Driver driver,const FT_String * cid_interface)53 cid_get_interface( FT_Driver driver, 54 const FT_String* cid_interface ) 55 { 56 FT_UNUSED( driver ); 57 FT_UNUSED( cid_interface ); 58 59 if ( ft_strcmp( (const char*)cid_interface, "postscript_name" ) == 0 ) 60 return (FT_Module_Interface)cid_get_postscript_name; 61 62 return 0; 63 } 64 65 66 67 FT_CALLBACK_TABLE_DEF 68 const FT_Driver_ClassRec t1cid_driver_class = 69 { 70 /* first of all, the FT_Module_Class fields */ 71 { 72 ft_module_font_driver | 73 ft_module_driver_scalable | 74 ft_module_driver_has_hinter , 75 76 sizeof( FT_DriverRec ), 77 "t1cid", /* module name */ 78 0x10000L, /* version 1.0 of driver */ 79 0x20000L, /* requires FreeType 2.0 */ 80 81 0, 82 83 (FT_Module_Constructor)cid_driver_init, 84 (FT_Module_Destructor) cid_driver_done, 85 (FT_Module_Requester) cid_get_interface 86 }, 87 88 /* then the other font drivers fields */ 89 sizeof( CID_FaceRec ), 90 sizeof( CID_SizeRec ), 91 sizeof( CID_GlyphSlotRec ), 92 93 (FT_Face_InitFunc) cid_face_init, 94 (FT_Face_DoneFunc) cid_face_done, 95 96 (FT_Size_InitFunc) cid_size_init, 97 (FT_Size_DoneFunc) cid_size_done, 98 (FT_Slot_InitFunc) cid_slot_init, 99 (FT_Slot_DoneFunc) cid_slot_done, 100 101 (FT_Size_ResetPointsFunc)cid_size_reset, 102 (FT_Size_ResetPixelsFunc)cid_size_reset, 103 104 (FT_Slot_LoadFunc) cid_slot_load_glyph, 105 106 (FT_Face_GetKerningFunc) 0, 107 (FT_Face_AttachFunc) 0, 108 109 (FT_Face_GetAdvancesFunc)0, 110 }; 111 112 113 /* END */ 114