cidriver.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. #include <ft2build.h>
  18. #include "cidriver.h"
  19. #include "cidgload.h"
  20. #include FT_INTERNAL_DEBUG_H
  21. #include FT_INTERNAL_STREAM_H
  22. #include FT_INTERNAL_POSTSCRIPT_NAMES_H
  23. #include "ciderrs.h"
  24. /*************************************************************************/
  25. /* */
  26. /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
  27. /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
  28. /* messages during execution. */
  29. /* */
  30. #undef FT_COMPONENT
  31. #define FT_COMPONENT trace_ciddriver
  32. static const char*
  33. cid_get_postscript_name( CID_Face face )
  34. {
  35. const char* result = face->cid.cid_font_name;
  36. if ( result && result[0] == '/' )
  37. result++;
  38. return result;
  39. }
  40. static FT_Module_Interface
  41. cid_get_interface( FT_Driver driver,
  42. const FT_String* cid_interface )
  43. {
  44. FT_UNUSED( driver );
  45. FT_UNUSED( cid_interface );
  46. if ( ft_strcmp( (const char*)cid_interface, "postscript_name" ) == 0 )
  47. return (FT_Module_Interface)cid_get_postscript_name;
  48. return 0;
  49. }
  50. FT_CALLBACK_TABLE_DEF
  51. const FT_Driver_ClassRec t1cid_driver_class =
  52. {
  53. /* first of all, the FT_Module_Class fields */
  54. {
  55. ft_module_font_driver |
  56. ft_module_driver_scalable |
  57. ft_module_driver_has_hinter ,
  58. sizeof( FT_DriverRec ),
  59. "t1cid", /* module name */
  60. 0x10000L, /* version 1.0 of driver */
  61. 0x20000L, /* requires FreeType 2.0 */
  62. 0,
  63. (FT_Module_Constructor)cid_driver_init,
  64. (FT_Module_Destructor) cid_driver_done,
  65. (FT_Module_Requester) cid_get_interface
  66. },
  67. /* then the other font drivers fields */
  68. sizeof( CID_FaceRec ),
  69. sizeof( CID_SizeRec ),
  70. sizeof( CID_GlyphSlotRec ),
  71. (FT_Face_InitFunc) cid_face_init,
  72. (FT_Face_DoneFunc) cid_face_done,
  73. (FT_Size_InitFunc) cid_size_init,
  74. (FT_Size_DoneFunc) cid_size_done,
  75. (FT_Slot_InitFunc) cid_slot_init,
  76. (FT_Slot_DoneFunc) cid_slot_done,
  77. (FT_Size_ResetPointsFunc)cid_size_reset,
  78. (FT_Size_ResetPixelsFunc)cid_size_reset,
  79. (FT_Slot_LoadFunc) cid_slot_load_glyph,
  80. (FT_Face_GetKerningFunc) 0,
  81. (FT_Face_AttachFunc) 0,
  82. (FT_Face_GetAdvancesFunc)0,
  83. };
  84. /* END */