pangocairo.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. The actual type of the font will depend
  31. * on the particular font technology Cairo was compiled to use.
  32. *
  33. * Since: 1.18
  34. **/
  35. typedef struct _PangoCairoFont PangoCairoFont;
  36. #define PANGO_TYPE_CAIRO_FONT (pango_cairo_font_get_type ())
  37. #define PANGO_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT, PangoCairoFont))
  38. #define PANGO_IS_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT))
  39. /**
  40. * PangoCairoFontMap:
  41. *
  42. * #PangoCairoFontMap is an interface exported by font maps for
  43. * use with Cairo. The actual type of the font map will depend
  44. * on the particular font technology Cairo was compiled to use.
  45. *
  46. * Since: 1.10
  47. **/
  48. typedef struct _PangoCairoFontMap PangoCairoFontMap;
  49. #define PANGO_TYPE_CAIRO_FONT_MAP (pango_cairo_font_map_get_type ())
  50. #define PANGO_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMap))
  51. #define PANGO_IS_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT_MAP))
  52. /**
  53. * PangoCairoShapeRendererFunc:
  54. * @cr: a Cairo context with current point set to where the shape should
  55. * be rendered
  56. * @attr: the %PANGO_ATTR_SHAPE to render
  57. * @do_path: whether only the shape path should be appended to current
  58. * path of @cr and no filling/stroking done. This will be set
  59. * to %TRUE when called from pango_cairo_layout_path() and
  60. * pango_cairo_layout_line_path() rendering functions.
  61. * @data: user data passed to pango_cairo_context_set_shape_renderer()
  62. *
  63. * Function type for rendering attributes of type %PANGO_ATTR_SHAPE
  64. * with Pango's Cairo renderer.
  65. */
  66. typedef void (* PangoCairoShapeRendererFunc) (cairo_t *cr,
  67. PangoAttrShape *attr,
  68. gboolean do_path,
  69. gpointer data);
  70. /*
  71. * PangoCairoFontMap
  72. */
  73. PANGO_AVAILABLE_IN_1_10
  74. GType pango_cairo_font_map_get_type (void) G_GNUC_CONST;
  75. PANGO_AVAILABLE_IN_1_10
  76. PangoFontMap *pango_cairo_font_map_new (void);
  77. PANGO_AVAILABLE_IN_1_18
  78. PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype);
  79. PANGO_AVAILABLE_IN_1_10
  80. PangoFontMap *pango_cairo_font_map_get_default (void);
  81. PANGO_AVAILABLE_IN_1_22
  82. void pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap);
  83. PANGO_AVAILABLE_IN_1_18
  84. cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap);
  85. PANGO_AVAILABLE_IN_1_10
  86. void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,
  87. double dpi);
  88. PANGO_AVAILABLE_IN_1_10
  89. double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap);
  90. #ifndef PANGO_DISABLE_DEPRECATED
  91. PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context)
  92. PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap);
  93. #endif
  94. /*
  95. * PangoCairoFont
  96. */
  97. PANGO_AVAILABLE_IN_1_18
  98. GType pango_cairo_font_get_type (void) G_GNUC_CONST;
  99. PANGO_AVAILABLE_IN_1_18
  100. cairo_scaled_font_t *pango_cairo_font_get_scaled_font (PangoCairoFont *font);
  101. /* Update a Pango context for the current state of a cairo context
  102. */
  103. PANGO_AVAILABLE_IN_1_10
  104. void pango_cairo_update_context (cairo_t *cr,
  105. PangoContext *context);
  106. PANGO_AVAILABLE_IN_1_10
  107. void pango_cairo_context_set_font_options (PangoContext *context,
  108. const cairo_font_options_t *options);
  109. PANGO_AVAILABLE_IN_1_10
  110. const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext *context);
  111. PANGO_AVAILABLE_IN_1_10
  112. void pango_cairo_context_set_resolution (PangoContext *context,
  113. double dpi);
  114. PANGO_AVAILABLE_IN_1_10
  115. double pango_cairo_context_get_resolution (PangoContext *context);
  116. PANGO_AVAILABLE_IN_1_18
  117. void pango_cairo_context_set_shape_renderer (PangoContext *context,
  118. PangoCairoShapeRendererFunc func,
  119. gpointer data,
  120. GDestroyNotify dnotify);
  121. PANGO_AVAILABLE_IN_1_18
  122. PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context,
  123. gpointer *data);
  124. /* Convenience
  125. */
  126. PANGO_AVAILABLE_IN_1_22
  127. PangoContext *pango_cairo_create_context (cairo_t *cr);
  128. PANGO_AVAILABLE_IN_ALL
  129. PangoLayout *pango_cairo_create_layout (cairo_t *cr);
  130. PANGO_AVAILABLE_IN_1_10
  131. void pango_cairo_update_layout (cairo_t *cr,
  132. PangoLayout *layout);
  133. /*
  134. * Rendering
  135. */
  136. PANGO_AVAILABLE_IN_1_10
  137. void pango_cairo_show_glyph_string (cairo_t *cr,
  138. PangoFont *font,
  139. PangoGlyphString *glyphs);
  140. PANGO_AVAILABLE_IN_1_22
  141. void pango_cairo_show_glyph_item (cairo_t *cr,
  142. const char *text,
  143. PangoGlyphItem *glyph_item);
  144. PANGO_AVAILABLE_IN_1_10
  145. void pango_cairo_show_layout_line (cairo_t *cr,
  146. PangoLayoutLine *line);
  147. PANGO_AVAILABLE_IN_1_10
  148. void pango_cairo_show_layout (cairo_t *cr,
  149. PangoLayout *layout);
  150. PANGO_AVAILABLE_IN_1_14
  151. void pango_cairo_show_error_underline (cairo_t *cr,
  152. double x,
  153. double y,
  154. double width,
  155. double height);
  156. /*
  157. * Rendering to a path
  158. */
  159. PANGO_AVAILABLE_IN_1_10
  160. void pango_cairo_glyph_string_path (cairo_t *cr,
  161. PangoFont *font,
  162. PangoGlyphString *glyphs);
  163. PANGO_AVAILABLE_IN_1_10
  164. void pango_cairo_layout_line_path (cairo_t *cr,
  165. PangoLayoutLine *line);
  166. PANGO_AVAILABLE_IN_1_10
  167. void pango_cairo_layout_path (cairo_t *cr,
  168. PangoLayout *layout);
  169. PANGO_AVAILABLE_IN_1_14
  170. void pango_cairo_error_underline_path (cairo_t *cr,
  171. double x,
  172. double y,
  173. double width,
  174. double height);
  175. G_END_DECLS
  176. #endif /* __PANGOCAIRO_H__ */