Mx support.
[girtod.git] / gtk2 / pangocairo.d
blobe05fd13e09a374a6f1d6684d127a683c969c5d56
1 // *** DO NOT EDIT ***
2 // Automatically generated from "/usr/share/gir-1.0/PangoCairo-1.0.gir"
4 module PangoCairo;
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.freetype2;
18 alias gtk2.freetype2 freetype2;
20 // package: "cairo";
22 // package: "gobject-2.0";
24 // c:symbol-prefixes: ["pango_cairo"]
25 // c:identifier-prefixes: ["PangoCairo"]
27 // module PangoCairo;
29 struct FcFontMap /* : Pango.FontMap */ {
30 mixin FontMap.__interface__;
31 alias parent_instance this;
32 alias parent_instance super_;
33 alias parent_instance fontmap;
34 Pango.FontMap parent_instance;
35 double dpi;
36 freetype2.Library library;
40 // #PangoCairoFont is an interface exported by fonts for
41 // use with Cairo. The actual type of the font will depend
42 // on the particular font technology Cairo was compiled to use.
43 struct Font /* Interface */ /* Version 1.18 */ {
44 mixin template __interface__() {
45 // VERSION: 1.18
46 // Gets the #cairo_scaled_font_t used by @font.
47 // The scaled font can be referenced and kept using
48 // cairo_scaled_font_reference().
49 // or %NULL if @font is %NULL.
50 // RETURNS: the #cairo_scaled_font_t used by @font,
51 cairo.ScaledFont* /*new*/ get_scaled_font()() {
52 return pango_cairo_font_get_scaled_font(cast(Font*)&this);
55 mixin __interface__;
59 // #PangoCairoFontMap is an interface exported by font maps for
60 // use with Cairo. The actual type of the font map will depend
61 // on the particular font technology Cairo was compiled to use.
62 struct FontMap /* Interface */ /* Version 1.10 */ {
63 mixin template __interface__() {
64 // Unintrospectable method: create_context() / pango_cairo_font_map_create_context()
65 // VERSION: 1.10
66 // DEPRECATED (v1.22) method: create_context - Use pango_font_map_create_context() instead.
67 // Create a #PangoContext for the given fontmap.
68 // RETURNS: the newly created context; free with g_object_unref().
69 Pango.Context* create_context()() {
70 return pango_cairo_font_map_create_context(cast(FontMap*)&this);
73 // VERSION: 1.18
74 // Gets the type of Cairo font backend that @fontmap uses.
75 // RETURNS: the #cairo_font_type_t cairo font backend type
76 cairo.FontType /*new*/ get_font_type()() {
77 return pango_cairo_font_map_get_font_type(cast(FontMap*)&this);
80 // VERSION: 1.10
81 // Gets the resolution for the fontmap. See pango_cairo_font_map_set_resolution()
82 // RETURNS: the resolution in "dots per inch"
83 double get_resolution()() {
84 return pango_cairo_font_map_get_resolution(cast(FontMap*)&this);
87 // VERSION: 1.22
88 // Sets a default #PangoCairoFontMap to use with Cairo.
89 // This can be used to change the Cairo font backend that the
90 // default fontmap uses for example. The old default font map
91 // is unreffed and the new font map referenced.
92 // A value of %NULL for @fontmap will cause the current default
93 // font map to be released and a new default font
94 // map to be created on demand, using pango_cairo_font_map_new().
95 void set_default()() {
96 pango_cairo_font_map_set_default(cast(FontMap*)&this);
99 // VERSION: 1.10
100 // Sets the resolution for the fontmap. This is a scale factor between
101 // points specified in a #PangoFontDescription and Cairo units. The
102 // default value is 96, meaning that a 10 point font will be 13
103 // units high. (10 * 96. / 72. = 13.3).
104 // <dpi>: the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)
105 void set_resolution()(double dpi) {
106 pango_cairo_font_map_set_resolution(cast(FontMap*)&this, dpi);
109 mixin __interface__;
112 extern (C) alias void function (cairo.Context* cr, Pango.AttrShape* attr, int do_path, void* data) ShapeRendererFunc;
115 // VERSION: 1.10
116 // Retrieves any font rendering options previously set with
117 // pango_cairo_font_map_set_font_options(). This function does not report options
118 // that are derived from the target surface by pango_cairo_update_context()
119 // if no options have been set. This value is owned by the context
120 // and must not be modified or freed.
121 // RETURNS: the font options previously set on the context, or %NULL
122 // <context>: a #PangoContext, from a pangocairo font map
123 static cairo.FontOptions* context_get_font_options()(Pango.Context* context) {
124 return pango_cairo_context_get_font_options(context);
128 // VERSION: 1.10
129 // Gets the resolution for the context. See pango_cairo_context_set_resolution()
130 // be returned if no resolution has previously been set.
131 // RETURNS: the resolution in "dots per inch". A negative value will
132 // <context>: a #PangoContext, from a pangocairo font map
133 static double context_get_resolution()(Pango.Context* context) {
134 return pango_cairo_context_get_resolution(context);
138 // Unintrospectable function: context_get_shape_renderer() / pango_cairo_context_get_shape_renderer()
139 // VERSION: 1.18
140 // Sets callback function for context to use for rendering attributes
141 // of type %PANGO_ATTR_SHAPE. See #PangoCairoShapeRendererFunc for
142 // details.
143 // Retrieves callback function and associated user data for rendering
144 // attributes of type %PANGO_ATTR_SHAPE as set by
145 // pango_cairo_context_set_shape_renderer(), if any.
146 // if no shape rendering callback have been set.
147 // RETURNS: the shape rendering callback previously set on the context, or %NULL
148 // <context>: a #PangoContext, from a pangocairo font map
149 // <data>: Pointer to #gpointer to return user data
150 static ShapeRendererFunc context_get_shape_renderer()(Pango.Context* context, void** data) {
151 return pango_cairo_context_get_shape_renderer(context, data);
155 // VERSION: 1.10
156 // Sets the font options used when rendering text with this context.
157 // These options override any options that pango_cairo_update_context()
158 // derives from the target surface.
159 // <context>: a #PangoContext, from a pangocairo font map
160 // <options>: a #cairo_font_options_t, or %NULL to unset any previously set options. A copy is made.
161 static void context_set_font_options()(Pango.Context* context, cairo.FontOptions* options) {
162 pango_cairo_context_set_font_options(context, options);
166 // VERSION: 1.10
167 // Sets the resolution for the context. This is a scale factor between
168 // points specified in a #PangoFontDescription and Cairo units. The
169 // default value is 96, meaning that a 10 point font will be 13
170 // units high. (10 * 96. / 72. = 13.3).
171 // <context>: a #PangoContext, from a pangocairo font map
172 // <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.
173 static void context_set_resolution()(Pango.Context* context, double dpi) {
174 pango_cairo_context_set_resolution(context, dpi);
178 // VERSION: 1.18
179 // Sets callback function for context to use for rendering attributes
180 // of type %PANGO_ATTR_SHAPE. See #PangoCairoShapeRendererFunc for
181 // details.
182 // <context>: a #PangoContext, from a pangocairo font map
183 // <func>: Callback function for rendering attributes of type %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.
184 // <data>: User data that will be passed to @func.
185 // <dnotify>: Callback that will be called when the context is freed to release @data, or %NULL.
186 static void context_set_shape_renderer()(Pango.Context* context, ShapeRendererFunc func, void* data, GLib2.DestroyNotify dnotify) {
187 pango_cairo_context_set_shape_renderer(context, func, data, dnotify);
191 // Unintrospectable function: create_context() / pango_cairo_create_context()
192 // VERSION: 1.22
193 // Creates a context object set up to match the current transformation
194 // and target surface of the Cairo context. This context can then be
195 // used to create a layout using pango_layout_new().
196 // This function is a convenience function that creates a context using
197 // the default font map, then updates it to @cr. If you just need to
198 // create a layout for use with @cr and do not need to access #PangoContext
199 // directly, you can use pango_cairo_create_layout() instead.
200 // g_object_unref().
201 // RETURNS: the newly created #PangoContext. Free with
202 // <cr>: a Cairo context
203 static Pango.Context* create_context()(cairo.Context* cr) {
204 return pango_cairo_create_context(cr);
208 // Unintrospectable function: create_layout() / pango_cairo_create_layout()
209 // VERSION: 1.10
210 // Creates a layout object set up to match the current transformation
211 // and target surface of the Cairo context. This layout can then be
212 // used for text measurement with functions like
213 // pango_layout_get_size() or drawing with functions like
214 // pango_cairo_show_layout(). If you change the transformation
215 // or target surface for @cr, you need to call pango_cairo_update_layout()
216 // This function is the most convenient way to use Cairo with Pango,
217 // however it is slightly inefficient since it creates a separate
218 // #PangoContext object for each layout. This might matter in an
219 // application that was laying out large amounts of text.
220 // g_object_unref().
221 // RETURNS: the newly created #PangoLayout. Free with
222 // <cr>: a Cairo context
223 static Pango.Layout* create_layout()(cairo.Context* cr) {
224 return pango_cairo_create_layout(cr);
228 // VERSION: 1.14
229 // Add a squiggly line to the current path in the specified cairo context that
230 // approximately covers the given rectangle in the style of an underline used
231 // to indicate a spelling error. (The width of the underline is rounded to an
232 // integer number of up/down segments and the resulting rectangle is centered
233 // in the original rectangle)
234 // <cr>: a Cairo context
235 // <x>: The X coordinate of one corner of the rectangle
236 // <y>: The Y coordinate of one corner of the rectangle
237 // <width>: Non-negative width of the rectangle
238 // <height>: Non-negative height of the rectangle
239 static void error_underline_path()(cairo.Context* cr, double x, double y, double width, double height) {
240 pango_cairo_error_underline_path(cr, x, y, width, height);
244 // Unintrospectable function: font_map_get_default() / pango_cairo_font_map_get_default()
245 // VERSION: 1.10
246 // Gets a default #PangoCairoFontMap to use with Cairo.
247 // Note that the type of the returned object will depend
248 // on the particular font backend Cairo was compiled to use;
249 // You generally should only use the #PangoFontMap and
250 // #PangoCairoFontMap interfaces on the returned object.
251 // The default Cairo fontmap can be changed by using
252 // pango_cairo_font_map_set_default(). This can be used to
253 // change the Cairo font backend that the default fontmap
254 // uses for example.
255 // object is owned by Pango and must not be freed.
256 // RETURNS: the default Cairo fontmap for Pango. This
257 static Pango.FontMap* font_map_get_default()() {
258 return pango_cairo_font_map_get_default();
262 // Unintrospectable function: font_map_new() / pango_cairo_font_map_new()
263 // VERSION: 1.10
264 // Creates a new #PangoCairoFontMap object; a fontmap is used
265 // to cache information about available fonts, and holds
266 // certain global parameters such as the resolution.
267 // In most cases, you can use pango_cairo_font_map_get_default()
268 // instead.
269 // Note that the type of the returned object will depend
270 // on the particular font backend Cairo was compiled to use;
271 // You generally should only use the #PangoFontMap and
272 // #PangoCairoFontMap interfaces on the returned object.
273 // be freed with g_object_unref().
274 // RETURNS: the newly allocated #PangoFontMap, which should
275 static Pango.FontMap* font_map_new()() {
276 return pango_cairo_font_map_new();
280 // Unintrospectable function: font_map_new_for_font_type() / pango_cairo_font_map_new_for_font_type()
281 // VERSION: 1.18
282 // Creates a new #PangoCairoFontMap object of the type suitable
283 // to be used with cairo font backend of type @fonttype.
284 // In most cases one should simply use @pango_cairo_font_map_new(),
285 // or in fact in most of those cases, just use
286 // which should be freed with g_object_unref(),
287 // or %NULL if the requested cairo font backend is
288 // not supported / compiled in.
289 // RETURNS: the newly allocated #PangoFontMap of suitable type
290 // <fonttype>: desired #cairo_font_type_t
291 static Pango.FontMap* font_map_new_for_font_type()(cairo.FontType fonttype) {
292 return pango_cairo_font_map_new_for_font_type(fonttype);
296 // VERSION: 1.10
297 // Adds the glyphs in @glyphs to the current path in the specified
298 // cairo context. The origin of the glyphs (the left edge of the baseline)
299 // will be at the current point of the cairo context.
300 // <cr>: a Cairo context
301 // <font>: a #PangoFont from a #PangoCairoFontMap
302 // <glyphs>: a #PangoGlyphString
303 static void glyph_string_path()(cairo.Context* cr, Pango.Font* font, Pango.GlyphString* glyphs) {
304 pango_cairo_glyph_string_path(cr, font, glyphs);
308 // VERSION: 1.10
309 // Adds the text in #PangoLayoutLine to the current path in the
310 // specified cairo context. The origin of the glyphs (the left edge
311 // of the line) will be at the current point of the cairo context.
312 // <cr>: a Cairo context
313 // <line>: a #PangoLayoutLine
314 static void layout_line_path()(cairo.Context* cr, Pango.LayoutLine* line) {
315 pango_cairo_layout_line_path(cr, line);
319 // VERSION: 1.10
320 // Adds the text in a #PangoLayout to the current path in the
321 // specified cairo context. The top-left corner of the #PangoLayout
322 // will be at the current point of the cairo context.
323 // <cr>: a Cairo context
324 // <layout>: a Pango layout
325 static void layout_path()(cairo.Context* cr, Pango.Layout* layout) {
326 pango_cairo_layout_path(cr, layout);
330 // VERSION: 1.14
331 // Draw a squiggly line in the specified cairo context that approximately
332 // covers the given rectangle in the style of an underline used to indicate a
333 // spelling error. (The width of the underline is rounded to an integer
334 // number of up/down segments and the resulting rectangle is centered in the
335 // original rectangle)
336 // <cr>: a Cairo context
337 // <x>: The X coordinate of one corner of the rectangle
338 // <y>: The Y coordinate of one corner of the rectangle
339 // <width>: Non-negative width of the rectangle
340 // <height>: Non-negative height of the rectangle
341 static void show_error_underline()(cairo.Context* cr, double x, double y, double width, double height) {
342 pango_cairo_show_error_underline(cr, x, y, width, height);
346 // VERSION: 1.22
347 // Draws the glyphs in @glyph_item in the specified cairo context,
348 // embedding the text associated with the glyphs in the output if the
349 // output format supports it (PDF for example), otherwise it acts
350 // similar to pango_cairo_show_glyph_string().
351 // The origin of the glyphs (the left edge of the baseline) will
352 // be drawn at the current point of the cairo context.
353 // Note that @text is the start of the text for layout, which is then
354 // indexed by <literal>@glyph_item->item->offset</literal>.
355 // <cr>: a Cairo context
356 // <text>: the UTF-8 text that @glyph_item refers to
357 // <glyph_item>: a #PangoGlyphItem
358 static void show_glyph_item()(cairo.Context* cr, char* text, Pango.GlyphItem* glyph_item) {
359 pango_cairo_show_glyph_item(cr, text, glyph_item);
363 // VERSION: 1.10
364 // Draws the glyphs in @glyphs in the specified cairo context.
365 // The origin of the glyphs (the left edge of the baseline) will
366 // be drawn at the current point of the cairo context.
367 // <cr>: a Cairo context
368 // <font>: a #PangoFont from a #PangoCairoFontMap
369 // <glyphs>: a #PangoGlyphString
370 static void show_glyph_string()(cairo.Context* cr, Pango.Font* font, Pango.GlyphString* glyphs) {
371 pango_cairo_show_glyph_string(cr, font, glyphs);
375 // VERSION: 1.10
376 // Draws a #PangoLayout in the specified cairo context.
377 // The top-left corner of the #PangoLayout will be drawn
378 // at the current point of the cairo context.
379 // <cr>: a Cairo context
380 // <layout>: a Pango layout
381 static void show_layout()(cairo.Context* cr, Pango.Layout* layout) {
382 pango_cairo_show_layout(cr, layout);
386 // VERSION: 1.10
387 // Draws a #PangoLayoutLine in the specified cairo context.
388 // The origin of the glyphs (the left edge of the line) will
389 // be drawn at the current point of the cairo context.
390 // <cr>: a Cairo context
391 // <line>: a #PangoLayoutLine
392 static void show_layout_line()(cairo.Context* cr, Pango.LayoutLine* line) {
393 pango_cairo_show_layout_line(cr, line);
397 // VERSION: 1.10
398 // Updates a #PangoContext previously created for use with Cairo to
399 // match the current transformation and target surface of a Cairo
400 // context. If any layouts have been created for the context,
401 // it's necessary to call pango_layout_context_changed() on those
402 // layouts.
403 // <cr>: a Cairo context
404 // <context>: a #PangoContext, from a pangocairo font map
405 static void update_context()(cairo.Context* cr, Pango.Context* context) {
406 pango_cairo_update_context(cr, context);
410 // VERSION: 1.10
411 // Updates the private #PangoContext of a #PangoLayout created with
412 // pango_cairo_create_layout() to match the current transformation
413 // and target surface of a Cairo context.
414 // <cr>: a Cairo context
415 // <layout>: a #PangoLayout, from pango_cairo_create_layout()
416 static void update_layout()(cairo.Context* cr, Pango.Layout* layout) {
417 pango_cairo_update_layout(cr, layout);
421 // C prototypes:
423 extern (C) {
424 cairo.ScaledFont* /*new*/ pango_cairo_font_get_scaled_font(Font* this_);
425 Pango.Context* pango_cairo_font_map_create_context(FontMap* this_);
426 cairo.FontType /*new*/ pango_cairo_font_map_get_font_type(FontMap* this_);
427 double pango_cairo_font_map_get_resolution(FontMap* this_);
428 void pango_cairo_font_map_set_default(FontMap* this_);
429 void pango_cairo_font_map_set_resolution(FontMap* this_, double dpi);
430 cairo.FontOptions* pango_cairo_context_get_font_options(Pango.Context* context);
431 double pango_cairo_context_get_resolution(Pango.Context* context);
432 ShapeRendererFunc pango_cairo_context_get_shape_renderer(Pango.Context* context, void** data);
433 void pango_cairo_context_set_font_options(Pango.Context* context, cairo.FontOptions* options);
434 void pango_cairo_context_set_resolution(Pango.Context* context, double dpi);
435 void pango_cairo_context_set_shape_renderer(Pango.Context* context, ShapeRendererFunc func, void* data, GLib2.DestroyNotify dnotify);
436 Pango.Context* pango_cairo_create_context(cairo.Context* cr);
437 Pango.Layout* pango_cairo_create_layout(cairo.Context* cr);
438 void pango_cairo_error_underline_path(cairo.Context* cr, double x, double y, double width, double height);
439 Pango.FontMap* pango_cairo_font_map_get_default();
440 Pango.FontMap* pango_cairo_font_map_new();
441 Pango.FontMap* pango_cairo_font_map_new_for_font_type(cairo.FontType fonttype);
442 void pango_cairo_glyph_string_path(cairo.Context* cr, Pango.Font* font, Pango.GlyphString* glyphs);
443 void pango_cairo_layout_line_path(cairo.Context* cr, Pango.LayoutLine* line);
444 void pango_cairo_layout_path(cairo.Context* cr, Pango.Layout* layout);
445 void pango_cairo_show_error_underline(cairo.Context* cr, double x, double y, double width, double height);
446 void pango_cairo_show_glyph_item(cairo.Context* cr, char* text, Pango.GlyphItem* glyph_item);
447 void pango_cairo_show_glyph_string(cairo.Context* cr, Pango.Font* font, Pango.GlyphString* glyphs);
448 void pango_cairo_show_layout(cairo.Context* cr, Pango.Layout* layout);
449 void pango_cairo_show_layout_line(cairo.Context* cr, Pango.LayoutLine* line);
450 void pango_cairo_update_context(cairo.Context* cr, Pango.Context* context);
451 void pango_cairo_update_layout(cairo.Context* cr, Pango.Layout* layout);