svpscmap.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /***************************************************************************/
  2. /* */
  3. /* svpscmap.h */
  4. /* */
  5. /* The FreeType PostScript charmap service (specification). */
  6. /* */
  7. /* Copyright 2003, 2006, 2009, 2012 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. #ifndef __SVPSCMAP_H__
  18. #define __SVPSCMAP_H__
  19. #include FT_INTERNAL_OBJECTS_H
  20. FT_BEGIN_HEADER
  21. #define FT_SERVICE_ID_POSTSCRIPT_CMAPS "postscript-cmaps"
  22. /*
  23. * Adobe glyph name to unicode value.
  24. */
  25. typedef FT_UInt32
  26. (*PS_Unicode_ValueFunc)( const char* glyph_name );
  27. /*
  28. * Macintosh name id to glyph name. NULL if invalid index.
  29. */
  30. typedef const char*
  31. (*PS_Macintosh_NameFunc)( FT_UInt name_index );
  32. /*
  33. * Adobe standard string ID to glyph name. NULL if invalid index.
  34. */
  35. typedef const char*
  36. (*PS_Adobe_Std_StringsFunc)( FT_UInt string_index );
  37. /*
  38. * Simple unicode -> glyph index charmap built from font glyph names
  39. * table.
  40. */
  41. typedef struct PS_UniMap_
  42. {
  43. FT_UInt32 unicode; /* bit 31 set: is glyph variant */
  44. FT_UInt glyph_index;
  45. } PS_UniMap;
  46. typedef struct PS_UnicodesRec_* PS_Unicodes;
  47. typedef struct PS_UnicodesRec_
  48. {
  49. FT_CMapRec cmap;
  50. FT_UInt num_maps;
  51. PS_UniMap* maps;
  52. } PS_UnicodesRec;
  53. /*
  54. * A function which returns a glyph name for a given index. Returns
  55. * NULL if invalid index.
  56. */
  57. typedef const char*
  58. (*PS_GetGlyphNameFunc)( FT_Pointer data,
  59. FT_UInt string_index );
  60. /*
  61. * A function used to release the glyph name returned by
  62. * PS_GetGlyphNameFunc, when needed
  63. */
  64. typedef void
  65. (*PS_FreeGlyphNameFunc)( FT_Pointer data,
  66. const char* name );
  67. typedef FT_Error
  68. (*PS_Unicodes_InitFunc)( FT_Memory memory,
  69. PS_Unicodes unicodes,
  70. FT_UInt num_glyphs,
  71. PS_GetGlyphNameFunc get_glyph_name,
  72. PS_FreeGlyphNameFunc free_glyph_name,
  73. FT_Pointer glyph_data );
  74. typedef FT_UInt
  75. (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes,
  76. FT_UInt32 unicode );
  77. typedef FT_UInt32
  78. (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes,
  79. FT_UInt32 *unicode );
  80. FT_DEFINE_SERVICE( PsCMaps )
  81. {
  82. PS_Unicode_ValueFunc unicode_value;
  83. PS_Unicodes_InitFunc unicodes_init;
  84. PS_Unicodes_CharIndexFunc unicodes_char_index;
  85. PS_Unicodes_CharNextFunc unicodes_char_next;
  86. PS_Macintosh_NameFunc macintosh_name;
  87. PS_Adobe_Std_StringsFunc adobe_std_strings;
  88. const unsigned short* adobe_std_encoding;
  89. const unsigned short* adobe_expert_encoding;
  90. };
  91. #ifndef FT_CONFIG_OPTION_PIC
  92. #define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
  93. unicode_value_, \
  94. unicodes_init_, \
  95. unicodes_char_index_, \
  96. unicodes_char_next_, \
  97. macintosh_name_, \
  98. adobe_std_strings_, \
  99. adobe_std_encoding_, \
  100. adobe_expert_encoding_ ) \
  101. static const FT_Service_PsCMapsRec class_ = \
  102. { \
  103. unicode_value_, unicodes_init_, \
  104. unicodes_char_index_, unicodes_char_next_, macintosh_name_, \
  105. adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \
  106. };
  107. #else /* FT_CONFIG_OPTION_PIC */
  108. #define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
  109. unicode_value_, \
  110. unicodes_init_, \
  111. unicodes_char_index_, \
  112. unicodes_char_next_, \
  113. macintosh_name_, \
  114. adobe_std_strings_, \
  115. adobe_std_encoding_, \
  116. adobe_expert_encoding_ ) \
  117. void \
  118. FT_Init_Class_ ## class_( FT_Library library, \
  119. FT_Service_PsCMapsRec* clazz ) \
  120. { \
  121. FT_UNUSED( library ); \
  122. \
  123. clazz->unicode_value = unicode_value_; \
  124. clazz->unicodes_init = unicodes_init_; \
  125. clazz->unicodes_char_index = unicodes_char_index_; \
  126. clazz->unicodes_char_next = unicodes_char_next_; \
  127. clazz->macintosh_name = macintosh_name_; \
  128. clazz->adobe_std_strings = adobe_std_strings_; \
  129. clazz->adobe_std_encoding = adobe_std_encoding_; \
  130. clazz->adobe_expert_encoding = adobe_expert_encoding_; \
  131. }
  132. #endif /* FT_CONFIG_OPTION_PIC */
  133. /* */
  134. FT_END_HEADER
  135. #endif /* __SVPSCMAP_H__ */
  136. /* END */