hb-cairo.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright © 2022 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): Matthias Clasen
  25. */
  26. #ifndef HB_CAIRO_H
  27. #define HB_CAIRO_H
  28. #include "hb.h"
  29. #include <cairo.h>
  30. HB_BEGIN_DECLS
  31. HB_EXTERN cairo_font_face_t *
  32. hb_cairo_font_face_create_for_font (hb_font_t *font);
  33. HB_EXTERN hb_font_t *
  34. hb_cairo_font_face_get_font (cairo_font_face_t *font_face);
  35. HB_EXTERN cairo_font_face_t *
  36. hb_cairo_font_face_create_for_face (hb_face_t *face);
  37. HB_EXTERN hb_face_t *
  38. hb_cairo_font_face_get_face (cairo_font_face_t *font_face);
  39. /**
  40. * hb_cairo_font_init_func_t:
  41. * @font: The #hb_font_t being created
  42. * @scaled_font: The respective #cairo_scaled_font_t
  43. * @user_data: User data accompanying this method
  44. *
  45. * The type of a virtual method to be called when a cairo
  46. * face created using hb_cairo_font_face_create_for_face()
  47. * creates an #hb_font_t for a #cairo_scaled_font_t.
  48. *
  49. * Return value: the #hb_font_t value to use; in most cases same as @font
  50. *
  51. * Since: 7.0.0
  52. */
  53. typedef hb_font_t * (*hb_cairo_font_init_func_t) (hb_font_t *font,
  54. cairo_scaled_font_t *scaled_font,
  55. void *user_data);
  56. HB_EXTERN void
  57. hb_cairo_font_face_set_font_init_func (cairo_font_face_t *font_face,
  58. hb_cairo_font_init_func_t func,
  59. void *user_data,
  60. hb_destroy_func_t destroy);
  61. HB_EXTERN hb_font_t *
  62. hb_cairo_scaled_font_get_font (cairo_scaled_font_t *scaled_font);
  63. HB_EXTERN void
  64. hb_cairo_font_face_set_scale_factor (cairo_font_face_t *font_face,
  65. unsigned int scale_factor);
  66. HB_EXTERN unsigned int
  67. hb_cairo_font_face_get_scale_factor (cairo_font_face_t *font_face);
  68. HB_EXTERN void
  69. hb_cairo_glyphs_from_buffer (hb_buffer_t *buffer,
  70. hb_bool_t utf8_clusters,
  71. double x_scale_factor,
  72. double y_scale_factor,
  73. double x,
  74. double y,
  75. const char *utf8,
  76. int utf8_len,
  77. cairo_glyph_t **glyphs,
  78. unsigned int *num_glyphs,
  79. cairo_text_cluster_t **clusters,
  80. unsigned int *num_clusters,
  81. cairo_text_cluster_flags_t *cluster_flags);
  82. HB_END_DECLS
  83. #endif /* HB_CAIRO_H */