pangocairo.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. GType pango_cairo_font_map_get_type (void) G_GNUC_CONST;
  74. PangoFontMap *pango_cairo_font_map_new (void);
  75. PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype);
  76. PangoFontMap *pango_cairo_font_map_get_default (void);
  77. void pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap);
  78. cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap);
  79. void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,
  80. double dpi);
  81. double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap);
  82. #ifndef PANGO_DISABLE_DEPRECATED
  83. G_DEPRECATED_FOR(pango_font_map_create_context)
  84. PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap);
  85. #endif
  86. /*
  87. * PangoCairoFont
  88. */
  89. GType pango_cairo_font_get_type (void) G_GNUC_CONST;
  90. cairo_scaled_font_t *pango_cairo_font_get_scaled_font (PangoCairoFont *font);
  91. /* Update a Pango context for the current state of a cairo context
  92. */
  93. void pango_cairo_update_context (cairo_t *cr,
  94. PangoContext *context);
  95. void pango_cairo_context_set_font_options (PangoContext *context,
  96. const cairo_font_options_t *options);
  97. const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext *context);
  98. void pango_cairo_context_set_resolution (PangoContext *context,
  99. double dpi);
  100. double pango_cairo_context_get_resolution (PangoContext *context);
  101. void pango_cairo_context_set_shape_renderer (PangoContext *context,
  102. PangoCairoShapeRendererFunc func,
  103. gpointer data,
  104. GDestroyNotify dnotify);
  105. PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context,
  106. gpointer *data);
  107. /* Convenience
  108. */
  109. PangoContext *pango_cairo_create_context (cairo_t *cr);
  110. PangoLayout *pango_cairo_create_layout (cairo_t *cr);
  111. void pango_cairo_update_layout (cairo_t *cr,
  112. PangoLayout *layout);
  113. /*
  114. * Rendering
  115. */
  116. void pango_cairo_show_glyph_string (cairo_t *cr,
  117. PangoFont *font,
  118. PangoGlyphString *glyphs);
  119. void pango_cairo_show_glyph_item (cairo_t *cr,
  120. const char *text,
  121. PangoGlyphItem *glyph_item);
  122. void pango_cairo_show_layout_line (cairo_t *cr,
  123. PangoLayoutLine *line);
  124. void pango_cairo_show_layout (cairo_t *cr,
  125. PangoLayout *layout);
  126. void pango_cairo_show_error_underline (cairo_t *cr,
  127. double x,
  128. double y,
  129. double width,
  130. double height);
  131. /*
  132. * Rendering to a path
  133. */
  134. void pango_cairo_glyph_string_path (cairo_t *cr,
  135. PangoFont *font,
  136. PangoGlyphString *glyphs);
  137. void pango_cairo_layout_line_path (cairo_t *cr,
  138. PangoLayoutLine *line);
  139. void pango_cairo_layout_path (cairo_t *cr,
  140. PangoLayout *layout);
  141. void pango_cairo_error_underline_path (cairo_t *cr,
  142. double x,
  143. double y,
  144. double width,
  145. double height);
  146. G_END_DECLS
  147. #endif /* __PANGOCAIRO_H__ */