ftsnames.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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-2001, 2002 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. FT_BEGIN_HEADER
  25. /*************************************************************************/
  26. /* */
  27. /* <Section> */
  28. /* sfnt_names */
  29. /* */
  30. /* <Title> */
  31. /* SFNT Names */
  32. /* */
  33. /* <Abstract> */
  34. /* Access the names embedded in TrueType and OpenType files. */
  35. /* */
  36. /* <Description> */
  37. /* The TrueType and OpenType specification allow the inclusion of */
  38. /* a special `names table' in font files. This table contains */
  39. /* textual (and internationalized) information regarding the font, */
  40. /* like family name, copyright, version, etc. */
  41. /* */
  42. /* The definitions below are used to access them if available. */
  43. /* */
  44. /* Note that this has nothing to do with glyph names! */
  45. /* */
  46. /*************************************************************************/
  47. /*************************************************************************/
  48. /* */
  49. /* <Struct> */
  50. /* FT_SfntName */
  51. /* */
  52. /* <Description> */
  53. /* A structure used to model an SFNT `name' table entry. */
  54. /* */
  55. /* <Fields> */
  56. /* platform_id :: The platform ID for `string'. */
  57. /* */
  58. /* encoding_id :: The encoding ID for `string'. */
  59. /* */
  60. /* language_id :: The language ID for `string'. */
  61. /* */
  62. /* name_id :: An identifier for `string'. */
  63. /* */
  64. /* string :: The `name' string. Note that its format differs */
  65. /* depending on the (platform,encoding) pair. It can */
  66. /* be a Pascal String, a UTF-16 one, etc.. */
  67. /* */
  68. /* Generally speaking, the string is not */
  69. /* zero-terminated. Please refer to the TrueType */
  70. /* specification for details.. */
  71. /* */
  72. /* string_len :: The length of `string' in bytes. */
  73. /* */
  74. /* <Note> */
  75. /* Possible values for `platform_id', `encoding_id', `language_id', */
  76. /* and `name_id' are given in the file `ttnameid.h'. For details */
  77. /* please refer to the TrueType or OpenType specification. */
  78. /* */
  79. typedef struct FT_SfntName_
  80. {
  81. FT_UShort platform_id;
  82. FT_UShort encoding_id;
  83. FT_UShort language_id;
  84. FT_UShort name_id;
  85. FT_Byte* string; /* this string is *not* null-terminated! */
  86. FT_UInt string_len; /* in bytes */
  87. } FT_SfntName;
  88. /*************************************************************************/
  89. /* */
  90. /* <Function> */
  91. /* FT_Get_Sfnt_Name_Count */
  92. /* */
  93. /* <Description> */
  94. /* Retrieves the number of name strings in the SFNT `name' table. */
  95. /* */
  96. /* <Input> */
  97. /* face :: A handle to the source face. */
  98. /* */
  99. /* <Return> */
  100. /* The number of strings in the `name' table. */
  101. /* */
  102. FT_EXPORT( FT_UInt )
  103. FT_Get_Sfnt_Name_Count( FT_Face face );
  104. /*************************************************************************/
  105. /* */
  106. /* <Function> */
  107. /* FT_Get_Sfnt_Name */
  108. /* */
  109. /* <Description> */
  110. /* Retrieves a string of the SFNT `name' table for a given index. */
  111. /* */
  112. /* <Input> */
  113. /* face :: A handle to the source face. */
  114. /* */
  115. /* idx :: The index of the `name' string. */
  116. /* */
  117. /* <Output> */
  118. /* aname :: The indexed FT_SfntName structure. */
  119. /* */
  120. /* <Return> */
  121. /* FreeType error code. 0 means success. */
  122. /* */
  123. /* <Note> */
  124. /* The `string' array returned in the `aname' structure is not */
  125. /* null-terminated. */
  126. /* */
  127. /* Use FT_Get_Sfnt_Name_Count() to get the total number of available */
  128. /* `name' table entries, then do a loop until you get the right */
  129. /* platform, encoding, and name ID. */
  130. /* */
  131. FT_EXPORT( FT_Error )
  132. FT_Get_Sfnt_Name( FT_Face face,
  133. FT_UInt idx,
  134. FT_SfntName *aname );
  135. /* */
  136. FT_END_HEADER
  137. #endif /* __FT_SFNT_NAMES_H__ */
  138. /* END */