hb-face.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * Copyright © 2009 Red Hat, Inc.
  3. *
  4. * This is part of HarfBuzz, a text shaping library.
  5. *
  6. * Permission is hereby granted, without written agreement and without
  7. * license or royalty fees, to use, copy, modify, and distribute this
  8. * software and its documentation for any purpose, provided that the
  9. * above copyright notice and the following two paragraphs appear in
  10. * all copies of this software.
  11. *
  12. * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
  13. * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  14. * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
  15. * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  16. * DAMAGE.
  17. *
  18. * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
  19. * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  20. * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
  21. * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
  22. * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  23. *
  24. * Red Hat Author(s): Behdad Esfahbod
  25. */
  26. #if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
  27. #error "Include <hb.h> instead."
  28. #endif
  29. #ifndef HB_FACE_H
  30. #define HB_FACE_H
  31. #include "hb-common.h"
  32. #include "hb-blob.h"
  33. #include "hb-set.h"
  34. HB_BEGIN_DECLS
  35. HB_EXTERN unsigned int
  36. hb_face_count (hb_blob_t *blob);
  37. /*
  38. * hb_face_t
  39. */
  40. /**
  41. * hb_face_t:
  42. *
  43. * Data type for holding font faces.
  44. *
  45. **/
  46. typedef struct hb_face_t hb_face_t;
  47. HB_EXTERN hb_face_t *
  48. hb_face_create (hb_blob_t *blob,
  49. unsigned int index);
  50. /**
  51. * hb_reference_table_func_t:
  52. * @face: an #hb_face_t to reference table for
  53. * @tag: the tag of the table to reference
  54. * @user_data: User data pointer passed by the caller
  55. *
  56. * Callback function for hb_face_create_for_tables().
  57. *
  58. * Return value: (transfer full): A pointer to the @tag table within @face
  59. *
  60. * Since: 0.9.2
  61. */
  62. typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data);
  63. /* calls destroy() when not needing user_data anymore */
  64. HB_EXTERN hb_face_t *
  65. hb_face_create_for_tables (hb_reference_table_func_t reference_table_func,
  66. void *user_data,
  67. hb_destroy_func_t destroy);
  68. HB_EXTERN hb_face_t *
  69. hb_face_get_empty (void);
  70. HB_EXTERN hb_face_t *
  71. hb_face_reference (hb_face_t *face);
  72. HB_EXTERN void
  73. hb_face_destroy (hb_face_t *face);
  74. HB_EXTERN hb_bool_t
  75. hb_face_set_user_data (hb_face_t *face,
  76. hb_user_data_key_t *key,
  77. void * data,
  78. hb_destroy_func_t destroy,
  79. hb_bool_t replace);
  80. HB_EXTERN void *
  81. hb_face_get_user_data (const hb_face_t *face,
  82. hb_user_data_key_t *key);
  83. HB_EXTERN void
  84. hb_face_make_immutable (hb_face_t *face);
  85. HB_EXTERN hb_bool_t
  86. hb_face_is_immutable (const hb_face_t *face);
  87. HB_EXTERN hb_blob_t *
  88. hb_face_reference_table (const hb_face_t *face,
  89. hb_tag_t tag);
  90. HB_EXTERN hb_blob_t *
  91. hb_face_reference_blob (hb_face_t *face);
  92. HB_EXTERN void
  93. hb_face_set_index (hb_face_t *face,
  94. unsigned int index);
  95. HB_EXTERN unsigned int
  96. hb_face_get_index (const hb_face_t *face);
  97. HB_EXTERN void
  98. hb_face_set_upem (hb_face_t *face,
  99. unsigned int upem);
  100. HB_EXTERN unsigned int
  101. hb_face_get_upem (const hb_face_t *face);
  102. HB_EXTERN void
  103. hb_face_set_glyph_count (hb_face_t *face,
  104. unsigned int glyph_count);
  105. HB_EXTERN unsigned int
  106. hb_face_get_glyph_count (const hb_face_t *face);
  107. HB_EXTERN unsigned int
  108. hb_face_get_table_tags (const hb_face_t *face,
  109. unsigned int start_offset,
  110. unsigned int *table_count, /* IN/OUT */
  111. hb_tag_t *table_tags /* OUT */);
  112. /*
  113. * Character set.
  114. */
  115. HB_EXTERN void
  116. hb_face_collect_unicodes (hb_face_t *face,
  117. hb_set_t *out);
  118. HB_EXTERN void
  119. hb_face_collect_variation_selectors (hb_face_t *face,
  120. hb_set_t *out);
  121. HB_EXTERN void
  122. hb_face_collect_variation_unicodes (hb_face_t *face,
  123. hb_codepoint_t variation_selector,
  124. hb_set_t *out);
  125. /*
  126. * Builder face.
  127. */
  128. HB_EXTERN hb_face_t *
  129. hb_face_builder_create (void);
  130. HB_EXTERN hb_bool_t
  131. hb_face_builder_add_table (hb_face_t *face,
  132. hb_tag_t tag,
  133. hb_blob_t *blob);
  134. HB_EXTERN void
  135. hb_face_builder_sort_tables (hb_face_t *face,
  136. const hb_tag_t *tags);
  137. HB_END_DECLS
  138. #endif /* HB_FACE_H */