pangocairo.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /* Pango
  2. * pangocairo.h:
  3. *
  4. * Copyright (C) 1999, 2004 Red Hat, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef __PANGOCAIRO_H__
  22. #define __PANGOCAIRO_H__
  23. #include <pango/pango.h>
  24. #include <cairo.h>
  25. G_BEGIN_DECLS
  26. /**
  27. * PangoCairoFont:
  28. *
  29. * `PangoCairoFont` is an interface exported by fonts for
  30. * use with Cairo.
  31. *
  32. * The actual type of the font will depend on the particular
  33. * font technology Cairo was compiled to use.
  34. *
  35. * Since: 1.18
  36. **/
  37. typedef struct _PangoCairoFont PangoCairoFont;
  38. /* This is a hack because PangoCairo is hijacking the Pango namespace, but
  39. * consumers of the PangoCairo API expect these symbols to live under the
  40. * PangoCairo namespace.
  41. */
  42. #ifdef __GI_SCANNER__
  43. #define PANGO_CAIRO_TYPE_FONT (pango_cairo_font_get_type())
  44. #define PANGO_CAIRO_FONT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANGO_CAIRO_TYPE_FONT, PangoCairoFont))
  45. #define PANGO_CAIRO_IS_FONT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANGO_CAIRO_TYPE_FONT))
  46. #else
  47. #define PANGO_TYPE_CAIRO_FONT (pango_cairo_font_get_type ())
  48. #define PANGO_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT, PangoCairoFont))
  49. #define PANGO_IS_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT))
  50. #endif
  51. /**
  52. * PangoCairoFontMap:
  53. *
  54. * `PangoCairoFontMap` is an interface exported by font maps for
  55. * use with Cairo.
  56. *
  57. * The actual type of the font map will depend on the particular
  58. * font technology Cairo was compiled to use.
  59. *
  60. * Since: 1.10
  61. **/
  62. typedef struct _PangoCairoFontMap PangoCairoFontMap;
  63. #ifdef __GI_SCANNER__
  64. #define PANGO_CAIRO_TYPE_FONT_MAP (pango_cairo_font_map_get_type())
  65. #define PANGO_CAIRO_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANGO_CAIRO_TYPE_FONT_MAP, PangoCairoFontMap))
  66. #define PANGO_CAIRO_IS_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANGO_CAIRO_TYPE_FONT_MAP))
  67. #else
  68. #define PANGO_TYPE_CAIRO_FONT_MAP (pango_cairo_font_map_get_type ())
  69. #define PANGO_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMap))
  70. #define PANGO_IS_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT_MAP))
  71. #endif
  72. /**
  73. * PangoCairoShapeRendererFunc:
  74. * @cr: a Cairo context with current point set to where the shape should
  75. * be rendered
  76. * @attr: the %PANGO_ATTR_SHAPE to render
  77. * @do_path: whether only the shape path should be appended to current
  78. * path of @cr and no filling/stroking done. This will be set
  79. * to %TRUE when called from pango_cairo_layout_path() and
  80. * pango_cairo_layout_line_path() rendering functions.
  81. * @data: (closure): user data passed to pango_cairo_context_set_shape_renderer()
  82. *
  83. * Function type for rendering attributes of type %PANGO_ATTR_SHAPE
  84. * with Pango's Cairo renderer.
  85. */
  86. typedef void (* PangoCairoShapeRendererFunc) (cairo_t *cr,
  87. PangoAttrShape *attr,
  88. gboolean do_path,
  89. gpointer data);
  90. /*
  91. * PangoCairoFontMap
  92. */
  93. PANGO_AVAILABLE_IN_1_10
  94. GType pango_cairo_font_map_get_type (void) G_GNUC_CONST;
  95. PANGO_AVAILABLE_IN_1_10
  96. PangoFontMap *pango_cairo_font_map_new (void);
  97. PANGO_AVAILABLE_IN_1_18
  98. PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype);
  99. PANGO_AVAILABLE_IN_1_10
  100. PangoFontMap *pango_cairo_font_map_get_default (void);
  101. PANGO_AVAILABLE_IN_1_22
  102. void pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap);
  103. PANGO_AVAILABLE_IN_1_18
  104. cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap);
  105. PANGO_AVAILABLE_IN_1_10
  106. void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,
  107. double dpi);
  108. PANGO_AVAILABLE_IN_1_10
  109. double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap);
  110. #ifndef PANGO_DISABLE_DEPRECATED
  111. PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context)
  112. PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap);
  113. #endif
  114. /*
  115. * PangoCairoFont
  116. */
  117. PANGO_AVAILABLE_IN_1_18
  118. GType pango_cairo_font_get_type (void) G_GNUC_CONST;
  119. PANGO_AVAILABLE_IN_1_18
  120. cairo_scaled_font_t *pango_cairo_font_get_scaled_font (PangoCairoFont *font);
  121. /* Update a Pango context for the current state of a cairo context
  122. */
  123. PANGO_AVAILABLE_IN_1_10
  124. void pango_cairo_update_context (cairo_t *cr,
  125. PangoContext *context);
  126. PANGO_AVAILABLE_IN_1_10
  127. void pango_cairo_context_set_font_options (PangoContext *context,
  128. const cairo_font_options_t *options);
  129. PANGO_AVAILABLE_IN_1_10
  130. const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext *context);
  131. PANGO_AVAILABLE_IN_1_10
  132. void pango_cairo_context_set_resolution (PangoContext *context,
  133. double dpi);
  134. PANGO_AVAILABLE_IN_1_10
  135. double pango_cairo_context_get_resolution (PangoContext *context);
  136. PANGO_AVAILABLE_IN_1_18
  137. void pango_cairo_context_set_shape_renderer (PangoContext *context,
  138. PangoCairoShapeRendererFunc func,
  139. gpointer data,
  140. GDestroyNotify dnotify);
  141. PANGO_AVAILABLE_IN_1_18
  142. PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context,
  143. gpointer *data);
  144. /* Convenience
  145. */
  146. PANGO_AVAILABLE_IN_1_22
  147. PangoContext *pango_cairo_create_context (cairo_t *cr);
  148. PANGO_AVAILABLE_IN_ALL
  149. PangoLayout *pango_cairo_create_layout (cairo_t *cr);
  150. PANGO_AVAILABLE_IN_1_10
  151. void pango_cairo_update_layout (cairo_t *cr,
  152. PangoLayout *layout);
  153. /*
  154. * Rendering
  155. */
  156. PANGO_AVAILABLE_IN_1_10
  157. void pango_cairo_show_glyph_string (cairo_t *cr,
  158. PangoFont *font,
  159. PangoGlyphString *glyphs);
  160. PANGO_AVAILABLE_IN_1_22
  161. void pango_cairo_show_glyph_item (cairo_t *cr,
  162. const char *text,
  163. PangoGlyphItem *glyph_item);
  164. PANGO_AVAILABLE_IN_1_10
  165. void pango_cairo_show_layout_line (cairo_t *cr,
  166. PangoLayoutLine *line);
  167. PANGO_AVAILABLE_IN_1_10
  168. void pango_cairo_show_layout (cairo_t *cr,
  169. PangoLayout *layout);
  170. PANGO_AVAILABLE_IN_1_14
  171. void pango_cairo_show_error_underline (cairo_t *cr,
  172. double x,
  173. double y,
  174. double width,
  175. double height);
  176. /*
  177. * Rendering to a path
  178. */
  179. PANGO_AVAILABLE_IN_1_10
  180. void pango_cairo_glyph_string_path (cairo_t *cr,
  181. PangoFont *font,
  182. PangoGlyphString *glyphs);
  183. PANGO_AVAILABLE_IN_1_10
  184. void pango_cairo_layout_line_path (cairo_t *cr,
  185. PangoLayoutLine *line);
  186. PANGO_AVAILABLE_IN_1_10
  187. void pango_cairo_layout_path (cairo_t *cr,
  188. PangoLayout *layout);
  189. PANGO_AVAILABLE_IN_1_14
  190. void pango_cairo_error_underline_path (cairo_t *cr,
  191. double x,
  192. double y,
  193. double width,
  194. double height);
  195. G_END_DECLS
  196. #endif /* __PANGOCAIRO_H__ */