ftbdf.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /***************************************************************************/
  2. /* */
  3. /* ftbdf.h */
  4. /* */
  5. /* FreeType API for accessing BDF-specific strings (specification). */
  6. /* */
  7. /* Copyright 2002, 2003, 2004, 2006 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 Files */
  34. /* */
  35. /* <Abstract> */
  36. /* BDF specific API. */
  37. /* */
  38. /* <Description> */
  39. /* This section contains the declaration of BDF specific functions. */
  40. /* */
  41. /*************************************************************************/
  42. /**********************************************************************
  43. *
  44. * @enum:
  45. * FT_PropertyType
  46. *
  47. * @description:
  48. * A list of BDF property types.
  49. *
  50. * @values:
  51. * BDF_PROPERTY_TYPE_NONE ::
  52. * Value 0 is used to indicate a missing property.
  53. *
  54. * BDF_PROPERTY_TYPE_ATOM ::
  55. * Property is a string atom.
  56. *
  57. * BDF_PROPERTY_TYPE_INTEGER ::
  58. * Property is a 32-bit signed integer.
  59. *
  60. * BDF_PROPERTY_TYPE_CARDINAL ::
  61. * Property is a 32-bit unsigned integer.
  62. */
  63. typedef enum BDF_PropertyType_
  64. {
  65. BDF_PROPERTY_TYPE_NONE = 0,
  66. BDF_PROPERTY_TYPE_ATOM = 1,
  67. BDF_PROPERTY_TYPE_INTEGER = 2,
  68. BDF_PROPERTY_TYPE_CARDINAL = 3
  69. } BDF_PropertyType;
  70. /**********************************************************************
  71. *
  72. * @type:
  73. * BDF_Property
  74. *
  75. * @description:
  76. * A handle to a @BDF_PropertyRec structure to model a given
  77. * BDF/PCF property.
  78. */
  79. typedef struct BDF_PropertyRec_* BDF_Property;
  80. /**********************************************************************
  81. *
  82. * @struct:
  83. * BDF_PropertyRec
  84. *
  85. * @description:
  86. * This structure models a given BDF/PCF property.
  87. *
  88. * @fields:
  89. * type ::
  90. * The property type.
  91. *
  92. * u.atom ::
  93. * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM.
  94. *
  95. * u.integer ::
  96. * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.
  97. *
  98. * u.cardinal ::
  99. * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.
  100. */
  101. typedef struct BDF_PropertyRec_
  102. {
  103. BDF_PropertyType type;
  104. union {
  105. const char* atom;
  106. FT_Int32 integer;
  107. FT_UInt32 cardinal;
  108. } u;
  109. } BDF_PropertyRec;
  110. /**********************************************************************
  111. *
  112. * @function:
  113. * FT_Get_BDF_Charset_ID
  114. *
  115. * @description:
  116. * Retrieves a BDF font character set identity, according to
  117. * the BDF specification.
  118. *
  119. * @input:
  120. * face ::
  121. * A handle to the input face.
  122. *
  123. * @output:
  124. * acharset_encoding ::
  125. * Charset encoding, as a C string, owned by the face.
  126. *
  127. * acharset_registry ::
  128. * Charset registry, as a C string, owned by the face.
  129. *
  130. * @return:
  131. * FreeType error code. 0 means success.
  132. *
  133. * @note:
  134. * This function only works with BDF faces, returning an error otherwise.
  135. */
  136. FT_EXPORT( FT_Error )
  137. FT_Get_BDF_Charset_ID( FT_Face face,
  138. const char* *acharset_encoding,
  139. const char* *acharset_registry );
  140. /**********************************************************************
  141. *
  142. * @function:
  143. * FT_Get_BDF_Property
  144. *
  145. * @description:
  146. * Retrieves a BDF property from a BDF or PCF font file.
  147. *
  148. * @input:
  149. * face :: A handle to the input face.
  150. *
  151. * name :: The property name.
  152. *
  153. * @output:
  154. * aproperty :: The property.
  155. *
  156. * @return:
  157. * FreeType error code. 0 means success.
  158. *
  159. * @note:
  160. * This function works with BDF _and_ PCF fonts. It returns an error
  161. * otherwise. It also returns an error if the property is not in the
  162. * font.
  163. *
  164. * In case of error, `aproperty->type' is always set to
  165. * @BDF_PROPERTY_TYPE_NONE.
  166. */
  167. FT_EXPORT( FT_Error )
  168. FT_Get_BDF_Property( FT_Face face,
  169. const char* prop_name,
  170. BDF_PropertyRec *aproperty );
  171. /* */
  172. FT_END_HEADER
  173. #endif /* __FTBDF_H__ */
  174. /* END */