2 // Automatically generated from "/usr/share/gir-1.0/PangoCairo-1.0.gir"
5 public import gtk2
.glib2
;
6 alias gtk2
.glib2 GLib2
;
7 public import gtk2
.gobject2
;
8 alias gtk2
.gobject2 GObject2
;
9 public import gtk2
.pango
;
10 alias gtk2
.pango Pango
;
11 public import gtk2
.pangoft2
;
12 alias gtk2
.pangoft2 PangoFT2
;
13 public import gtk2
.cairo
;
14 alias gtk2
.cairo cairo
;
15 public import gtk2
.fontconfig2
;
16 alias gtk2
.fontconfig2 fontconfig2
;
17 public import gtk2
.freetype22
;
18 alias gtk2
.freetype22 freetype22
;
22 // package: "gobject-2.0";
24 // c:symbol-prefixes: ["pango_cairo"]
25 // c:identifier-prefixes: ["PangoCairo"]
29 struct FcFontMap
/* : Pango.FontMap */ {
30 PangoFcFontMap parent_instance
;
32 freetype2
.Library library
;
36 // #PangoCairoFont is an interface exported by fonts for
37 // use with Cairo. The actual type of the font will depend
38 // on the particular font technology Cairo was compiled to use.
39 struct Font
/* Version 1.18 */ {
41 // Gets the #cairo_scaled_font_t used by @font.
42 // The scaled font can be referenced and kept using
43 // cairo_scaled_font_reference().
44 // or %NULL if @font is %NULL.
45 // RETURNS: the #cairo_scaled_font_t used by @font,
46 cairo
.ScaledFont
* /*new*/ get_scaled_font() {
47 return pango_cairo_font_get_scaled_font(&this);
52 // #PangoCairoFontMap is an interface exported by font maps for
53 // use with Cairo. The actual type of the font map will depend
54 // on the particular font technology Cairo was compiled to use.
55 struct FontMap
/* Version 1.10 */ {
57 // Unintrospectable method: create_context() / pango_cairo_font_map_create_context()
58 // Create a #PangoContext for the given fontmap.
59 // RETURNS: the newly created context; free with g_object_unref().
60 Pango
.Context
* create_context() {
61 return pango_cairo_font_map_create_context(&this);
64 // Gets the type of Cairo font backend that @fontmap uses.
65 // RETURNS: the #cairo_font_type_t cairo font backend type
66 cairo
.FontType
/*new*/ get_font_type() {
67 return pango_cairo_font_map_get_font_type(&this);
70 // Gets the resolution for the fontmap. See pango_cairo_font_map_set_resolution()
71 // RETURNS: the resolution in "dots per inch"
72 double get_resolution() {
73 return pango_cairo_font_map_get_resolution(&this);
76 // Sets a default #PangoCairoFontMap to use with Cairo.
77 // This can be used to change the Cairo font backend that the
78 // default fontmap uses for example. The old default font map
79 // is unreffed and the new font map referenced.
80 // A value of %NULL for @fontmap will cause the current default
81 // font map to be released and a new default font
82 // map to be created on demand, using pango_cairo_font_map_new().
84 pango_cairo_font_map_set_default(&this);
87 // Sets the resolution for the fontmap. This is a scale factor between
88 // points specified in a #PangoFontDescription and Cairo units. The
89 // default value is 96, meaning that a 10 point font will be 13
90 // units high. (10 * 96. / 72. = 13.3).
91 // <dpi>: the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)
92 void set_resolution(double dpi
) {
93 pango_cairo_font_map_set_resolution(&this, dpi
);
97 extern (C
) alias void function (cairo
.Context
* cr
, Pango
.AttrShape
* attr
, int do_path
, void* data
) ShapeRendererFunc
;
100 // Retrieves any font rendering options previously set with
101 // pango_cairo_font_map_set_font_options(). This function does not report options
102 // that are derived from the target surface by pango_cairo_update_context()
103 // if no options have been set. This value is owned by the context
104 // and must not be modified or freed.
105 // RETURNS: the font options previously set on the context, or %NULL
106 // <context>: a #PangoContext, from a pangocairo font map
107 static cairo
.FontOptions
* context_get_font_options(Pango
.Context
* context
) {
108 return pango_cairo_context_get_font_options(context
);
112 // Gets the resolution for the context. See pango_cairo_context_set_resolution()
113 // be returned if no resolution has previously been set.
114 // RETURNS: the resolution in "dots per inch". A negative value will
115 // <context>: a #PangoContext, from a pangocairo font map
116 static double context_get_resolution(Pango
.Context
* context
) {
117 return pango_cairo_context_get_resolution(context
);
121 // Unintrospectable function: context_get_shape_renderer() / pango_cairo_context_get_shape_renderer()
122 // Sets callback function for context to use for rendering attributes
123 // of type %PANGO_ATTR_SHAPE. See #PangoCairoShapeRendererFunc for
125 // Retrieves callback function and associated user data for rendering
126 // attributes of type %PANGO_ATTR_SHAPE as set by
127 // pango_cairo_context_set_shape_renderer(), if any.
128 // if no shape rendering callback have been set.
129 // RETURNS: the shape rendering callback previously set on the context, or %NULL
130 // <context>: a #PangoContext, from a pangocairo font map
131 // <data>: Pointer to #gpointer to return user data
132 static ShapeRendererFunc
context_get_shape_renderer(Pango
.Context
* context
, void** data
) {
133 return pango_cairo_context_get_shape_renderer(context
, data
);
137 // Sets the font options used when rendering text with this context.
138 // These options override any options that pango_cairo_update_context()
139 // derives from the target surface.
140 // <context>: a #PangoContext, from a pangocairo font map
141 // <options>: a #cairo_font_options_t, or %NULL to unset any previously set options. A copy is made.
142 static void context_set_font_options(Pango
.Context
* context
, cairo
.FontOptions
* options
) {
143 pango_cairo_context_set_font_options(context
, options
);
147 // Sets the resolution for the context. This is a scale factor between
148 // points specified in a #PangoFontDescription and Cairo units. The
149 // default value is 96, meaning that a 10 point font will be 13
150 // units high. (10 * 96. / 72. = 13.3).
151 // <context>: a #PangoContext, from a pangocairo font map
152 // <dpi>: the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.
153 static void context_set_resolution(Pango
.Context
* context
, double dpi
) {
154 pango_cairo_context_set_resolution(context
, dpi
);
158 // Sets callback function for context to use for rendering attributes
159 // of type %PANGO_ATTR_SHAPE. See #PangoCairoShapeRendererFunc for
161 // <context>: a #PangoContext, from a pangocairo font map
162 // <func>: Callback function for rendering attributes of type %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.
163 // <data>: User data that will be passed to @func.
164 // <dnotify>: Callback that will be called when the context is freed to release @data, or %NULL.
165 static void context_set_shape_renderer(Pango
.Context
* context
, ShapeRendererFunc func
, void* data
, GLib2
.DestroyNotify dnotify
) {
166 pango_cairo_context_set_shape_renderer(context
, func
, data
, dnotify
);
170 // Unintrospectable function: create_context() / pango_cairo_create_context()
171 // Creates a context object set up to match the current transformation
172 // and target surface of the Cairo context. This context can then be
173 // used to create a layout using pango_layout_new().
174 // This function is a convenience function that creates a context using
175 // the default font map, then updates it to @cr. If you just need to
176 // create a layout for use with @cr and do not need to access #PangoContext
177 // directly, you can use pango_cairo_create_layout() instead.
179 // RETURNS: the newly created #PangoContext. Free with
180 // <cr>: a Cairo context
181 static Pango
.Context
* create_context(cairo
.Context
* cr
) {
182 return pango_cairo_create_context(cr
);
186 // Unintrospectable function: create_layout() / pango_cairo_create_layout()
187 // Creates a layout object set up to match the current transformation
188 // and target surface of the Cairo context. This layout can then be
189 // used for text measurement with functions like
190 // pango_layout_get_size() or drawing with functions like
191 // pango_cairo_show_layout(). If you change the transformation
192 // or target surface for @cr, you need to call pango_cairo_update_layout()
193 // This function is the most convenient way to use Cairo with Pango,
194 // however it is slightly inefficient since it creates a separate
195 // #PangoContext object for each layout. This might matter in an
196 // application that was laying out large amounts of text.
198 // RETURNS: the newly created #PangoLayout. Free with
199 // <cr>: a Cairo context
200 static Pango
.Layout
* create_layout(cairo
.Context
* cr
) {
201 return pango_cairo_create_layout(cr
);
205 // Add a squiggly line to the current path in the specified cairo context that
206 // approximately covers the given rectangle in the style of an underline used
207 // to indicate a spelling error. (The width of the underline is rounded to an
208 // integer number of up/down segments and the resulting rectangle is centered
209 // in the original rectangle)
210 // <cr>: a Cairo context
211 // <x>: The X coordinate of one corner of the rectangle
212 // <y>: The Y coordinate of one corner of the rectangle
213 // <width>: Non-negative width of the rectangle
214 // <height>: Non-negative height of the rectangle
215 static void error_underline_path(cairo
.Context
* cr
, double x
, double y
, double width
, double height
) {
216 pango_cairo_error_underline_path(cr
, x
, y
, width
, height
);
220 // Unintrospectable function: font_map_get_default() / pango_cairo_font_map_get_default()
221 // Gets a default #PangoCairoFontMap to use with Cairo.
222 // Note that the type of the returned object will depend
223 // on the particular font backend Cairo was compiled to use;
224 // You generally should only use the #PangoFontMap and
225 // #PangoCairoFontMap interfaces on the returned object.
226 // The default Cairo fontmap can be changed by using
227 // pango_cairo_font_map_set_default(). This can be used to
228 // change the Cairo font backend that the default fontmap
230 // object is owned by Pango and must not be freed.
231 // RETURNS: the default Cairo fontmap for Pango. This
232 static Pango
.FontMap
* font_map_get_default() {
233 return pango_cairo_font_map_get_default();
237 // Unintrospectable function: font_map_new() / pango_cairo_font_map_new()
238 // Creates a new #PangoCairoFontMap object; a fontmap is used
239 // to cache information about available fonts, and holds
240 // certain global parameters such as the resolution.
241 // In most cases, you can use pango_cairo_font_map_get_default()
243 // Note that the type of the returned object will depend
244 // on the particular font backend Cairo was compiled to use;
245 // You generally should only use the #PangoFontMap and
246 // #PangoCairoFontMap interfaces on the returned object.
247 // be freed with g_object_unref().
248 // RETURNS: the newly allocated #PangoFontMap, which should
249 static Pango
.FontMap
* font_map_new() {
250 return pango_cairo_font_map_new();
254 // Unintrospectable function: font_map_new_for_font_type() / pango_cairo_font_map_new_for_font_type()
255 // Creates a new #PangoCairoFontMap object of the type suitable
256 // to be used with cairo font backend of type @fonttype.
257 // In most cases one should simply use @pango_cairo_font_map_new(),
258 // or in fact in most of those cases, just use
259 // which should be freed with g_object_unref(),
260 // or %NULL if the requested cairo font backend is
261 // not supported / compiled in.
262 // RETURNS: the newly allocated #PangoFontMap of suitable type
263 // <fonttype>: desired #cairo_font_type_t
264 static Pango
.FontMap
* font_map_new_for_font_type(cairo
.FontType fonttype
) {
265 return pango_cairo_font_map_new_for_font_type(fonttype
);
269 // Adds the glyphs in @glyphs to the current path in the specified
270 // cairo context. The origin of the glyphs (the left edge of the baseline)
271 // will be at the current point of the cairo context.
272 // <cr>: a Cairo context
273 // <font>: a #PangoFont from a #PangoCairoFontMap
274 // <glyphs>: a #PangoGlyphString
275 static void glyph_string_path(cairo
.Context
* cr
, Pango
.Font
* font
, Pango
.GlyphString
* glyphs
) {
276 pango_cairo_glyph_string_path(cr
, font
, glyphs
);
280 // Adds the text in #PangoLayoutLine to the current path in the
281 // specified cairo context. The origin of the glyphs (the left edge
282 // of the line) will be at the current point of the cairo context.
283 // <cr>: a Cairo context
284 // <line>: a #PangoLayoutLine
285 static void layout_line_path(cairo
.Context
* cr
, Pango
.LayoutLine
* line
) {
286 pango_cairo_layout_line_path(cr
, line
);
290 // Adds the text in a #PangoLayout to the current path in the
291 // specified cairo context. The top-left corner of the #PangoLayout
292 // will be at the current point of the cairo context.
293 // <cr>: a Cairo context
294 // <layout>: a Pango layout
295 static void layout_path(cairo
.Context
* cr
, Pango
.Layout
* layout
) {
296 pango_cairo_layout_path(cr
, layout
);
300 // Draw a squiggly line in the specified cairo context that approximately
301 // covers the given rectangle in the style of an underline used to indicate a
302 // spelling error. (The width of the underline is rounded to an integer
303 // number of up/down segments and the resulting rectangle is centered in the
304 // original rectangle)
305 // <cr>: a Cairo context
306 // <x>: The X coordinate of one corner of the rectangle
307 // <y>: The Y coordinate of one corner of the rectangle
308 // <width>: Non-negative width of the rectangle
309 // <height>: Non-negative height of the rectangle
310 static void show_error_underline(cairo
.Context
* cr
, double x
, double y
, double width
, double height
) {
311 pango_cairo_show_error_underline(cr
, x
, y
, width
, height
);
315 // Draws the glyphs in @glyph_item in the specified cairo context,
316 // embedding the text associated with the glyphs in the output if the
317 // output format supports it (PDF for example), otherwise it acts
318 // similar to pango_cairo_show_glyph_string().
319 // The origin of the glyphs (the left edge of the baseline) will
320 // be drawn at the current point of the cairo context.
321 // Note that @text is the start of the text for layout, which is then
322 // indexed by <literal>@glyph_item->item->offset</literal>.
323 // <cr>: a Cairo context
324 // <text>: the UTF-8 text that @glyph_item refers to
325 // <glyph_item>: a #PangoGlyphItem
326 static void show_glyph_item(cairo
.Context
* cr
, char* text
, Pango
.GlyphItem
* glyph_item
) {
327 pango_cairo_show_glyph_item(cr
, text
, glyph_item
);
331 // Draws the glyphs in @glyphs in the specified cairo context.
332 // The origin of the glyphs (the left edge of the baseline) will
333 // be drawn at the current point of the cairo context.
334 // <cr>: a Cairo context
335 // <font>: a #PangoFont from a #PangoCairoFontMap
336 // <glyphs>: a #PangoGlyphString
337 static void show_glyph_string(cairo
.Context
* cr
, Pango
.Font
* font
, Pango
.GlyphString
* glyphs
) {
338 pango_cairo_show_glyph_string(cr
, font
, glyphs
);
342 // Draws a #PangoLayout in the specified cairo context.
343 // The top-left corner of the #PangoLayout will be drawn
344 // at the current point of the cairo context.
345 // <cr>: a Cairo context
346 // <layout>: a Pango layout
347 static void show_layout(cairo
.Context
* cr
, Pango
.Layout
* layout
) {
348 pango_cairo_show_layout(cr
, layout
);
352 // Draws a #PangoLayoutLine in the specified cairo context.
353 // The origin of the glyphs (the left edge of the line) will
354 // be drawn at the current point of the cairo context.
355 // <cr>: a Cairo context
356 // <line>: a #PangoLayoutLine
357 static void show_layout_line(cairo
.Context
* cr
, Pango
.LayoutLine
* line
) {
358 pango_cairo_show_layout_line(cr
, line
);
362 // Updates a #PangoContext previously created for use with Cairo to
363 // match the current transformation and target surface of a Cairo
364 // context. If any layouts have been created for the context,
365 // it's necessary to call pango_layout_context_changed() on those
367 // <cr>: a Cairo context
368 // <context>: a #PangoContext, from a pangocairo font map
369 static void update_context(cairo
.Context
* cr
, Pango
.Context
* context
) {
370 pango_cairo_update_context(cr
, context
);
374 // Updates the private #PangoContext of a #PangoLayout created with
375 // pango_cairo_create_layout() to match the current transformation
376 // and target surface of a Cairo context.
377 // <cr>: a Cairo context
378 // <layout>: a #PangoLayout, from pango_cairo_create_layout()
379 static void update_layout(cairo
.Context
* cr
, Pango
.Layout
* layout
) {
380 pango_cairo_update_layout(cr
, layout
);
387 cairo
.ScaledFont
* /*new*/ pango_cairo_font_get_scaled_font(Font
* this_
);
388 Pango
.Context
* pango_cairo_font_map_create_context(FontMap
* this_
);
389 cairo
.FontType
/*new*/ pango_cairo_font_map_get_font_type(FontMap
* this_
);
390 double pango_cairo_font_map_get_resolution(FontMap
* this_
);
391 void pango_cairo_font_map_set_default(FontMap
* this_
);
392 void pango_cairo_font_map_set_resolution(FontMap
* this_
, double dpi
);
393 cairo
.FontOptions
* pango_cairo_context_get_font_options(Pango
.Context
* context
);
394 double pango_cairo_context_get_resolution(Pango
.Context
* context
);
395 ShapeRendererFunc
pango_cairo_context_get_shape_renderer(Pango
.Context
* context
, void** data
);
396 void pango_cairo_context_set_font_options(Pango
.Context
* context
, cairo
.FontOptions
* options
);
397 void pango_cairo_context_set_resolution(Pango
.Context
* context
, double dpi
);
398 void pango_cairo_context_set_shape_renderer(Pango
.Context
* context
, ShapeRendererFunc func
, void* data
, GLib2
.DestroyNotify dnotify
);
399 Pango
.Context
* pango_cairo_create_context(cairo
.Context
* cr
);
400 Pango
.Layout
* pango_cairo_create_layout(cairo
.Context
* cr
);
401 void pango_cairo_error_underline_path(cairo
.Context
* cr
, double x
, double y
, double width
, double height
);
402 Pango
.FontMap
* pango_cairo_font_map_get_default();
403 Pango
.FontMap
* pango_cairo_font_map_new();
404 Pango
.FontMap
* pango_cairo_font_map_new_for_font_type(cairo
.FontType fonttype
);
405 void pango_cairo_glyph_string_path(cairo
.Context
* cr
, Pango
.Font
* font
, Pango
.GlyphString
* glyphs
);
406 void pango_cairo_layout_line_path(cairo
.Context
* cr
, Pango
.LayoutLine
* line
);
407 void pango_cairo_layout_path(cairo
.Context
* cr
, Pango
.Layout
* layout
);
408 void pango_cairo_show_error_underline(cairo
.Context
* cr
, double x
, double y
, double width
, double height
);
409 void pango_cairo_show_glyph_item(cairo
.Context
* cr
, char* text
, Pango
.GlyphItem
* glyph_item
);
410 void pango_cairo_show_glyph_string(cairo
.Context
* cr
, Pango
.Font
* font
, Pango
.GlyphString
* glyphs
);
411 void pango_cairo_show_layout(cairo
.Context
* cr
, Pango
.Layout
* layout
);
412 void pango_cairo_show_layout_line(cairo
.Context
* cr
, Pango
.LayoutLine
* line
);
413 void pango_cairo_update_context(cairo
.Context
* cr
, Pango
.Context
* context
);
414 void pango_cairo_update_layout(cairo
.Context
* cr
, Pango
.Layout
* layout
);