ftsnames.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /***************************************************************************/
  2. /* */
  3. /* ftsnames.h */
  4. /* */
  5. /* Simple interface to access SFNT name tables (which are used */
  6. /* to hold font names, copyright info, notices, etc.) (specification). */
  7. /* */
  8. /* This is _not_ used to retrieve glyph names! */
  9. /* */
  10. /* Copyright 1996-2003, 2006, 2009, 2010, 2013 by */
  11. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  12. /* */
  13. /* This file is part of the FreeType project, and may only be used, */
  14. /* modified, and distributed under the terms of the FreeType project */
  15. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  16. /* this file you indicate that you have read the license and */
  17. /* understand and accept it fully. */
  18. /* */
  19. /***************************************************************************/
  20. #ifndef __FT_SFNT_NAMES_H__
  21. #define __FT_SFNT_NAMES_H__
  22. #include <ft2build.h>
  23. #include FT_FREETYPE_H
  24. #ifdef FREETYPE_H
  25. #error "freetype.h of FreeType 1 has been loaded!"
  26. #error "Please fix the directory search order for header files"
  27. #error "so that freetype.h of FreeType 2 is found first."
  28. #endif
  29. FT_BEGIN_HEADER
  30. /*************************************************************************/
  31. /* */
  32. /* <Section> */
  33. /* sfnt_names */
  34. /* */
  35. /* <Title> */
  36. /* SFNT Names */
  37. /* */
  38. /* <Abstract> */
  39. /* Access the names embedded in TrueType and OpenType files. */
  40. /* */
  41. /* <Description> */
  42. /* The TrueType and OpenType specifications allow the inclusion of */
  43. /* a special `names table' in font files. This table contains */
  44. /* textual (and internationalized) information regarding the font, */
  45. /* like family name, copyright, version, etc. */
  46. /* */
  47. /* The definitions below are used to access them if available. */
  48. /* */
  49. /* Note that this has nothing to do with glyph names! */
  50. /* */
  51. /*************************************************************************/
  52. /*************************************************************************/
  53. /* */
  54. /* <Struct> */
  55. /* FT_SfntName */
  56. /* */
  57. /* <Description> */
  58. /* A structure used to model an SFNT `name' table entry. */
  59. /* */
  60. /* <Fields> */
  61. /* platform_id :: The platform ID for `string'. */
  62. /* */
  63. /* encoding_id :: The encoding ID for `string'. */
  64. /* */
  65. /* language_id :: The language ID for `string'. */
  66. /* */
  67. /* name_id :: An identifier for `string'. */
  68. /* */
  69. /* string :: The `name' string. Note that its format differs */
  70. /* depending on the (platform,encoding) pair. It can */
  71. /* be a Pascal String, a UTF-16 one, etc. */
  72. /* */
  73. /* Generally speaking, the string is not */
  74. /* zero-terminated. Please refer to the TrueType */
  75. /* specification for details. */
  76. /* */
  77. /* string_len :: The length of `string' in bytes. */
  78. /* */
  79. /* <Note> */
  80. /* Possible values for `platform_id', `encoding_id', `language_id', */
  81. /* and `name_id' are given in the file `ttnameid.h'. For details */
  82. /* please refer to the TrueType or OpenType specification. */
  83. /* */
  84. /* See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */
  85. /* @TT_ISO_ID_XXX, and @TT_MS_ID_XXX. */
  86. /* */
  87. typedef struct FT_SfntName_
  88. {
  89. FT_UShort platform_id;
  90. FT_UShort encoding_id;
  91. FT_UShort language_id;
  92. FT_UShort name_id;
  93. FT_Byte* string; /* this string is *not* null-terminated! */
  94. FT_UInt string_len; /* in bytes */
  95. } FT_SfntName;
  96. /*************************************************************************/
  97. /* */
  98. /* <Function> */
  99. /* FT_Get_Sfnt_Name_Count */
  100. /* */
  101. /* <Description> */
  102. /* Retrieve the number of name strings in the SFNT `name' table. */
  103. /* */
  104. /* <Input> */
  105. /* face :: A handle to the source face. */
  106. /* */
  107. /* <Return> */
  108. /* The number of strings in the `name' table. */
  109. /* */
  110. FT_EXPORT( FT_UInt )
  111. FT_Get_Sfnt_Name_Count( FT_Face face );
  112. /*************************************************************************/
  113. /* */
  114. /* <Function> */
  115. /* FT_Get_Sfnt_Name */
  116. /* */
  117. /* <Description> */
  118. /* Retrieve a string of the SFNT `name' table for a given index. */
  119. /* */
  120. /* <Input> */
  121. /* face :: A handle to the source face. */
  122. /* */
  123. /* idx :: The index of the `name' string. */
  124. /* */
  125. /* <Output> */
  126. /* aname :: The indexed @FT_SfntName structure. */
  127. /* */
  128. /* <Return> */
  129. /* FreeType error code. 0~means success. */
  130. /* */
  131. /* <Note> */
  132. /* The `string' array returned in the `aname' structure is not */
  133. /* null-terminated. The application should deallocate it if it is no */
  134. /* longer in use. */
  135. /* */
  136. /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */
  137. /* `name' table entries, then do a loop until you get the right */
  138. /* platform, encoding, and name ID. */
  139. /* */
  140. FT_EXPORT( FT_Error )
  141. FT_Get_Sfnt_Name( FT_Face face,
  142. FT_UInt idx,
  143. FT_SfntName *aname );
  144. /***************************************************************************
  145. *
  146. * @constant:
  147. * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY
  148. *
  149. * @description:
  150. * A constant used as the tag of @FT_Parameter structures to make
  151. * FT_Open_Face() ignore preferred family subfamily names in `name'
  152. * table since OpenType version 1.4. For backwards compatibility with
  153. * legacy systems that have a 4-face-per-family restriction.
  154. *
  155. */
  156. #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
  157. /***************************************************************************
  158. *
  159. * @constant:
  160. * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY
  161. *
  162. * @description:
  163. * A constant used as the tag of @FT_Parameter structures to make
  164. * FT_Open_Face() ignore preferred subfamily names in `name' table since
  165. * OpenType version 1.4. For backwards compatibility with legacy
  166. * systems that have a 4-face-per-family restriction.
  167. *
  168. */
  169. #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' )
  170. /* */
  171. FT_END_HEADER
  172. #endif /* __FT_SFNT_NAMES_H__ */
  173. /* END */