ftbdf.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /***************************************************************************/
  2. /* */
  3. /* ftbdf.h */
  4. /* */
  5. /* FreeType API for accessing BDF-specific strings (specification). */
  6. /* */
  7. /* Copyright 2002-2004, 2006, 2009, 2014 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 __FTBDF_H__
  18. #define __FTBDF_H__
  19. #include <ft2build.h>
  20. #include FT_FREETYPE_H
  21. #ifdef FREETYPE_H
  22. #error "freetype.h of FreeType 1 has been loaded!"
  23. #error "Please fix the directory search order for header files"
  24. #error "so that freetype.h of FreeType 2 is found first."
  25. #endif
  26. FT_BEGIN_HEADER
  27. /*************************************************************************/
  28. /* */
  29. /* <Section> */
  30. /* bdf_fonts */
  31. /* */
  32. /* <Title> */
  33. /* BDF and PCF Files */
  34. /* */
  35. /* <Abstract> */
  36. /* BDF and PCF specific API. */
  37. /* */
  38. /* <Description> */
  39. /* This section contains the declaration of functions specific to BDF */
  40. /* and PCF fonts. */
  41. /* */
  42. /*************************************************************************/
  43. /**********************************************************************
  44. *
  45. * @enum:
  46. * FT_PropertyType
  47. *
  48. * @description:
  49. * A list of BDF property types.
  50. *
  51. * @values:
  52. * BDF_PROPERTY_TYPE_NONE ::
  53. * Value~0 is used to indicate a missing property.
  54. *
  55. * BDF_PROPERTY_TYPE_ATOM ::
  56. * Property is a string atom.
  57. *
  58. * BDF_PROPERTY_TYPE_INTEGER ::
  59. * Property is a 32-bit signed integer.
  60. *
  61. * BDF_PROPERTY_TYPE_CARDINAL ::
  62. * Property is a 32-bit unsigned integer.
  63. */
  64. typedef enum BDF_PropertyType_
  65. {
  66. BDF_PROPERTY_TYPE_NONE = 0,
  67. BDF_PROPERTY_TYPE_ATOM = 1,
  68. BDF_PROPERTY_TYPE_INTEGER = 2,
  69. BDF_PROPERTY_TYPE_CARDINAL = 3
  70. } BDF_PropertyType;
  71. /**********************************************************************
  72. *
  73. * @type:
  74. * BDF_Property
  75. *
  76. * @description:
  77. * A handle to a @BDF_PropertyRec structure to model a given
  78. * BDF/PCF property.
  79. */
  80. typedef struct BDF_PropertyRec_* BDF_Property;
  81. /**********************************************************************
  82. *
  83. * @struct:
  84. * BDF_PropertyRec
  85. *
  86. * @description:
  87. * This structure models a given BDF/PCF property.
  88. *
  89. * @fields:
  90. * type ::
  91. * The property type.
  92. *
  93. * u.atom ::
  94. * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be
  95. * NULL, indicating an empty string.
  96. *
  97. * u.integer ::
  98. * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.
  99. *
  100. * u.cardinal ::
  101. * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.
  102. */
  103. typedef struct BDF_PropertyRec_
  104. {
  105. BDF_PropertyType type;
  106. union {
  107. const char* atom;
  108. FT_Int32 integer;
  109. FT_UInt32 cardinal;
  110. } u;
  111. } BDF_PropertyRec;
  112. /**********************************************************************
  113. *
  114. * @function:
  115. * FT_Get_BDF_Charset_ID
  116. *
  117. * @description:
  118. * Retrieve a BDF font character set identity, according to
  119. * the BDF specification.
  120. *
  121. * @input:
  122. * face ::
  123. * A handle to the input face.
  124. *
  125. * @output:
  126. * acharset_encoding ::
  127. * Charset encoding, as a C~string, owned by the face.
  128. *
  129. * acharset_registry ::
  130. * Charset registry, as a C~string, owned by the face.
  131. *
  132. * @return:
  133. * FreeType error code. 0~means success.
  134. *
  135. * @note:
  136. * This function only works with BDF faces, returning an error otherwise.
  137. */
  138. FT_EXPORT( FT_Error )
  139. FT_Get_BDF_Charset_ID( FT_Face face,
  140. const char* *acharset_encoding,
  141. const char* *acharset_registry );
  142. /**********************************************************************
  143. *
  144. * @function:
  145. * FT_Get_BDF_Property
  146. *
  147. * @description:
  148. * Retrieve a BDF property from a BDF or PCF font file.
  149. *
  150. * @input:
  151. * face :: A handle to the input face.
  152. *
  153. * name :: The property name.
  154. *
  155. * @output:
  156. * aproperty :: The property.
  157. *
  158. * @return:
  159. * FreeType error code. 0~means success.
  160. *
  161. * @note:
  162. * This function works with BDF _and_ PCF fonts. It returns an error
  163. * otherwise. It also returns an error if the property is not in the
  164. * font.
  165. *
  166. * A `property' is a either key-value pair within the STARTPROPERTIES
  167. * ... ENDPROPERTIES block of a BDF font or a key-value pair from the
  168. * `info->props' array within a `FontRec' structure of a PCF font.
  169. *
  170. * Integer properties are always stored as `signed' within PCF fonts;
  171. * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value
  172. * for BDF fonts only.
  173. *
  174. * In case of error, `aproperty->type' is always set to
  175. * @BDF_PROPERTY_TYPE_NONE.
  176. */
  177. FT_EXPORT( FT_Error )
  178. FT_Get_BDF_Property( FT_Face face,
  179. const char* prop_name,
  180. BDF_PropertyRec *aproperty );
  181. /* */
  182. FT_END_HEADER
  183. #endif /* __FTBDF_H__ */
  184. /* END */