1/* Pango
2 * pangocairo-private.h: private symbols for the Cairo backend
3 *
4 * Copyright (C) 2000,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
22#ifndef __PANGOCAIRO_PRIVATE_H__
23#define __PANGOCAIRO_PRIVATE_H__
24
25#include <pango/pangocairo.h>
26#include <pango/pango-renderer.h>
27
28G_BEGIN_DECLS
29
30
31#define PANGO_CAIRO_FONT_MAP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMapIface))
32
33typedef struct _PangoCairoFontMapIface PangoCairoFontMapIface;
34
35struct _PangoCairoFontMapIface
36{
37 GTypeInterface g_iface;
38
39 void (*set_resolution) (PangoCairoFontMap *fontmap,
40 double dpi);
41 double (*get_resolution) (PangoCairoFontMap *fontmap);
42
43 cairo_font_type_t (*get_font_type) (PangoCairoFontMap *fontmap);
44};
45
46
47#define PANGO_CAIRO_FONT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PANGO_TYPE_CAIRO_FONT, PangoCairoFontIface))
48
49typedef struct _PangoCairoFontIface PangoCairoFontIface;
50typedef struct _PangoCairoFontPrivate PangoCairoFontPrivate;
51typedef struct _PangoCairoFontHexBoxInfo PangoCairoFontHexBoxInfo;
52typedef struct _PangoCairoFontPrivateScaledFontData PangoCairoFontPrivateScaledFontData;
53typedef struct _PangoCairoFontGlyphExtentsCacheEntry PangoCairoFontGlyphExtentsCacheEntry;
54
55struct _PangoCairoFontHexBoxInfo
56{
57 PangoCairoFont *font;
58 int rows;
59 double digit_width;
60 double digit_height;
61 double pad_x;
62 double pad_y;
63 double line_width;
64 double box_descent;
65 double box_height;
66};
67
68struct _PangoCairoFontPrivateScaledFontData
69{
70 cairo_matrix_t font_matrix;
71 cairo_matrix_t ctm;
72 cairo_font_options_t *options;
73};
74
75struct _PangoCairoFontPrivate
76{
77 PangoCairoFont *cfont;
78
79 PangoCairoFontPrivateScaledFontData *data;
80
81 cairo_scaled_font_t *scaled_font;
82 PangoCairoFontHexBoxInfo *hbi;
83
84 gboolean is_hinted;
85 PangoGravity gravity;
86
87 PangoRectangle font_extents;
88 PangoCairoFontGlyphExtentsCacheEntry *glyph_extents_cache;
89
90 GSList *metrics_by_lang;
91};
92
93struct _PangoCairoFontIface
94{
95 GTypeInterface g_iface;
96
97 cairo_font_face_t *(*create_font_face) (PangoCairoFont *cfont);
98 PangoFontMetrics *(*create_base_metrics_for_context) (PangoCairoFont *cfont,
99 PangoContext *context);
100
101 gssize cf_priv_offset;
102};
103
104gboolean _pango_cairo_font_install (PangoFont *font,
105 cairo_t *cr);
106PangoFontMetrics * _pango_cairo_font_get_metrics (PangoFont *font,
107 PangoLanguage *language);
108PangoCairoFontHexBoxInfo *_pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont);
109
110void _pango_cairo_font_private_initialize (PangoCairoFontPrivate *cf_priv,
111 PangoCairoFont *font,
112 PangoGravity gravity,
113 const cairo_font_options_t *font_options,
114 const PangoMatrix *pango_ctm,
115 const cairo_matrix_t *font_matrix);
116void _pango_cairo_font_private_finalize (PangoCairoFontPrivate *cf_priv);
117cairo_scaled_font_t *_pango_cairo_font_private_get_scaled_font (PangoCairoFontPrivate *cf_priv);
118gboolean _pango_cairo_font_private_is_metrics_hinted (PangoCairoFontPrivate *cf_priv);
119void _pango_cairo_font_private_get_glyph_extents (PangoCairoFontPrivate *cf_priv,
120 PangoGlyph glyph,
121 PangoRectangle *ink_rect,
122 PangoRectangle *logical_rect);
123
124#define PANGO_TYPE_CAIRO_RENDERER (pango_cairo_renderer_get_type())
125#define PANGO_CAIRO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_RENDERER, PangoCairoRenderer))
126#define PANGO_IS_CAIRO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_RENDERER))
127
128typedef struct _PangoCairoRenderer PangoCairoRenderer;
129
130_PANGO_EXTERN
131GType pango_cairo_renderer_get_type (void) G_GNUC_CONST;
132
133
134const cairo_font_options_t *_pango_cairo_context_get_merged_font_options (PangoContext *context);
135
136
137G_END_DECLS
138
139#endif /* __PANGOCAIRO_PRIVATE_H__ */
140

source code of gtk/subprojects/pango/pango/pangocairo-private.h