Regenerate, restoring full UpCast functionality.
[girtod.git] / gtk2 / pango.d
blob0ee25aa9fa9eacf62c391dbd6de29c2c5d13cfb8
1 // *** DO NOT EDIT ***
2 // Automatically generated from "/usr/share/gir-1.0/Pango-1.0.gir"
4 module Pango;
5 public import gtk2.glib2;
6 alias gtk2.glib2 GLib2;
7 public import gtk2.gobject2;
8 alias gtk2.gobject2 GObject2;
9 public import gtk2.cairo;
10 alias gtk2.cairo cairo;
12 // package: "cairo";
14 // package: "freetype2";
16 // package: "gobject-2.0";
18 // c:symbol-prefixes: ["pango"]
19 // c:identifier-prefixes: ["Pango"]
21 // module Pango;
23 // --- mixin/Pango__MODULE_HEAD.d --->
25 // Missing "macros":
27 int PIXELS(T)(T d) { return (cast(int)d+512)>>10; }
28 int PIXELS_FLOOR(T)(T d) { return (cast(int)d)>>10; }
29 int PIXELS_CEIL(T)(T d) { return (cast(int)d+1023)>>10; }
31 // <--- mixin/Pango__MODULE_HEAD.d ---
33 alias uint Glyph;
34 alias int GlyphUnit;
35 alias GlyphItem LayoutRun;
36 enum int ANALYSIS_FLAG_CENTERED_BASELINE = 1;
37 enum int ATTR_INDEX_FROM_TEXT_BEGINNING = 0;
38 enum Alignment {
39 LEFT = 0,
40 CENTER = 1,
41 RIGHT = 2
43 struct Analysis {
44 EngineShape* shape_engine;
45 EngineLang* lang_engine;
46 Font* font;
47 ubyte level, gravity, flags, script;
48 Language* language;
49 GLib2.SList* extra_attrs;
52 struct AttrClass {
53 AttrType type;
54 // Unintrospectable functionp: copy() / ()
55 extern (C) Attribute* function (Attribute* attr) nothrow copy;
56 extern (C) void function (Attribute* attr) nothrow destroy;
57 extern (C) int function (Attribute* attr1, Attribute* attr2) nothrow equal;
60 struct AttrColor {
61 Attribute attr;
62 Color color;
65 // Unintrospectable callback: AttrDataCopyFunc() / ()
66 extern (C) alias void* function (const(void)* data) nothrow AttrDataCopyFunc;
68 extern (C) alias int function (Attribute* attribute, void* data) nothrow AttrFilterFunc;
70 struct AttrFloat {
71 Attribute attr;
72 double value;
75 struct AttrFontDesc {
76 Attribute attr;
77 FontDescription* desc;
80 // Unintrospectable function: new() / pango_attr_font_desc_new()
81 // Create a new font description attribute. This attribute
82 // allows setting family, style, weight, variant, stretch,
83 // and size simultaneously.
84 //
85 // freed with pango_attribute_destroy().
86 // RETURNS: the newly allocated #PangoAttribute, which should be
87 // <desc>: the font description
88 static Attribute* new_(AT0)(AT0 /*FontDescription*/ desc) nothrow {
89 return pango_attr_font_desc_new(UpCast!(FontDescription*)(desc));
93 struct AttrInt {
94 Attribute attr;
95 int value;
98 struct AttrIterator {
100 // Unintrospectable method: copy() / pango_attr_iterator_copy()
101 // Copy a #PangoAttrIterator
103 // be freed with pango_attr_iterator_destroy().
104 // RETURNS: the newly allocated #PangoAttrIterator, which should
105 AttrIterator* copy()() nothrow {
106 return pango_attr_iterator_copy(&this);
108 // Destroy a #PangoAttrIterator and free all associated memory.
109 void destroy()() nothrow {
110 pango_attr_iterator_destroy(&this);
113 // Unintrospectable method: get() / pango_attr_iterator_get()
114 // Find the current attribute of a particular type at the iterator
115 // location. When multiple attributes of the same type overlap,
116 // the attribute whose range starts closest to the current location
117 // is used.
119 // if no attribute of that type applies to the current
120 // location.
121 // RETURNS: the current attribute of the given type, or %NULL
122 // <type>: the type of attribute to find.
123 Attribute* get()(AttrType type) nothrow {
124 return pango_attr_iterator_get(&this, type);
127 // VERSION: 1.2
128 // Gets a list of all attributes at the current position of the
129 // iterator.
131 // all attributes for the current range.
132 // To free this value, call pango_attribute_destroy() on
133 // each value and g_slist_free() on the list.
134 // RETURNS: a list of
135 GLib2.SList* /*new*/ get_attrs()() nothrow {
136 return pango_attr_iterator_get_attrs(&this);
139 // Unintrospectable method: get_font() / pango_attr_iterator_get_font()
140 // Get the font and other attributes at the current iterator position.
141 // <desc>: a #PangoFontDescription to fill in with the current values. The family name in this structure will be set using pango_font_description_set_family_static() using values from an attribute in the #PangoAttrList associated with the iterator, so if you plan to keep it around, you must call: <literal>pango_font_description_set_family (desc, pango_font_description_get_family (desc))</literal>.
142 // <language>: if non-%NULL, location to store language tag for item, or %NULL if none is found.
143 // <extra_attrs>: if non-%NULL, location in which to store a list of non-font attributes at the the current position; only the highest priority value of each attribute will be added to this list. In order to free this value, you must call pango_attribute_destroy() on each member.
144 void get_font(AT0, AT1, AT2)(AT0 /*FontDescription*/ desc, AT1 /*Language**/ language, AT2 /*GLib2.SList**/ extra_attrs) nothrow {
145 pango_attr_iterator_get_font(&this, UpCast!(FontDescription*)(desc), UpCast!(Language**)(language), UpCast!(GLib2.SList**)(extra_attrs));
148 // Advance the iterator until the next change of style.
149 // RETURNS: %FALSE if the iterator is at the end of the list, otherwise %TRUE
150 int next()() nothrow {
151 return pango_attr_iterator_next(&this);
154 // Get the range of the current segment. Note that the
155 // stored return values are signed, not unsigned like
156 // the values in #PangoAttribute. To deal with this API
157 // oversight, stored return values that wouldn't fit into
158 // a signed integer are clamped to %G_MAXINT.
159 // <start>: location to store the start of the range
160 // <end>: location to store the end of the range
161 void range()(int* start, int* end) nothrow {
162 pango_attr_iterator_range(&this, start, end);
166 struct AttrLanguage {
167 Attribute attr;
168 Language* value;
171 // Unintrospectable function: new() / pango_attr_language_new()
172 // Create a new language tag attribute.
174 // freed with pango_attribute_destroy().
175 // RETURNS: the newly allocated #PangoAttribute, which should be
176 // <language>: language tag
177 static Attribute* new_(AT0)(AT0 /*Language*/ language) nothrow {
178 return pango_attr_language_new(UpCast!(Language*)(language));
182 struct AttrList {
184 // Create a new empty attribute list with a reference count of one.
186 // be freed with pango_attr_list_unref().
187 // RETURNS: the newly allocated #PangoAttrList, which should
188 static AttrList* /*new*/ new_()() nothrow {
189 return pango_attr_list_new();
191 static auto opCall()() {
192 return pango_attr_list_new();
195 // Insert the given attribute into the #PangoAttrList. It will
196 // replace any attributes of the same type on that segment
197 // and be merged with any adjoining attributes that are identical.
199 // This function is slower than pango_attr_list_insert() for
200 // creating a attribute list in order (potentially much slower
201 // for large lists). However, pango_attr_list_insert() is not
202 // suitable for continually changing a set of attributes
203 // since it never removes or combines existing attributes.
204 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
205 void change(AT0)(AT0 /*Attribute*/ attr) nothrow {
206 pango_attr_list_change(&this, UpCast!(Attribute*)(attr));
209 // Copy @list and return an identical new list.
211 // reference count of one, which should
212 // be freed with pango_attr_list_unref().
213 // Returns %NULL if @list was %NULL.
214 // RETURNS: the newly allocated #PangoAttrList, with a
215 AttrList* /*new*/ copy()() nothrow {
216 return pango_attr_list_copy(&this);
219 // Unintrospectable method: filter() / pango_attr_list_filter()
220 // VERSION: 1.2
221 // Given a #PangoAttrList and callback function, removes any elements
222 // of @list for which @func returns %TRUE and inserts them into
223 // a new list.
225 // no attributes of the given types were found.
226 // RETURNS: the new #PangoAttrList or %NULL if
227 // <func>: callback function; returns %TRUE if an attribute should be filtered out.
228 // <data>: Data to be passed to @func
229 AttrList* /*new*/ filter(AT0)(AttrFilterFunc func, AT0 /*void*/ data) nothrow {
230 return pango_attr_list_filter(&this, func, UpCast!(void*)(data));
233 // Unintrospectable method: get_iterator() / pango_attr_list_get_iterator()
234 // Create a iterator initialized to the beginning of the list.
235 // @list must not be modified until this iterator is freed.
237 // be freed with pango_attr_iterator_destroy().
238 // RETURNS: the newly allocated #PangoAttrIterator, which should
239 AttrIterator* get_iterator()() nothrow {
240 return pango_attr_list_get_iterator(&this);
243 // Insert the given attribute into the #PangoAttrList. It will
244 // be inserted after all other attributes with a matching
245 // @start_index.
246 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
247 void insert(AT0)(AT0 /*Attribute*/ attr) nothrow {
248 pango_attr_list_insert(&this, UpCast!(Attribute*)(attr));
251 // Insert the given attribute into the #PangoAttrList. It will
252 // be inserted before all other attributes with a matching
253 // @start_index.
254 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
255 void insert_before(AT0)(AT0 /*Attribute*/ attr) nothrow {
256 pango_attr_list_insert_before(&this, UpCast!(Attribute*)(attr));
259 // VERSION: 1.10
260 // Increase the reference count of the given attribute list by one.
261 // RETURNS: The attribute list passed in
262 AttrList* /*new*/ ref_()() nothrow {
263 return pango_attr_list_ref(&this);
266 // This function opens up a hole in @list, fills it in with attributes from
267 // the left, and then merges @other on top of the hole.
269 // This operation is equivalent to stretching every attribute
270 // that applies at position @pos in @list by an amount @len,
271 // and then calling pango_attr_list_change() with a copy
272 // of each attribute in @other in sequence (offset in position by @pos).
274 // This operation proves useful for, for instance, inserting
275 // a pre-edit string in the middle of an edit buffer.
276 // <other>: another #PangoAttrList
277 // <pos>: the position in @list at which to insert @other
278 // <len>: the length of the spliced segment. (Note that this must be specified since the attributes in @other may only be present at some subsection of this range)
279 void splice(AT0)(AT0 /*AttrList*/ other, int pos, int len) nothrow {
280 pango_attr_list_splice(&this, UpCast!(AttrList*)(other), pos, len);
283 // Decrease the reference count of the given attribute list by one.
284 // If the result is zero, free the attribute list and the attributes
285 // it contains.
286 void unref()() nothrow {
287 pango_attr_list_unref(&this);
291 struct AttrShape {
292 Attribute attr;
293 Rectangle ink_rect, logical_rect;
294 void* data;
295 AttrDataCopyFunc copy_func;
296 GLib2.DestroyNotify destroy_func;
299 // Unintrospectable function: new() / pango_attr_shape_new()
300 // Create a new shape attribute. A shape is used to impose a
301 // particular ink and logical rectangle on the result of shaping a
302 // particular glyph. This might be used, for instance, for
303 // embedding a picture or a widget inside a #PangoLayout.
305 // freed with pango_attribute_destroy().
306 // RETURNS: the newly allocated #PangoAttribute, which should be
307 // <ink_rect>: ink rectangle to assign to each character
308 // <logical_rect>: logical rectangle to assign to each character
309 static Attribute* new_(AT0, AT1)(AT0 /*Rectangle*/ ink_rect, AT1 /*Rectangle*/ logical_rect) nothrow {
310 return pango_attr_shape_new(UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
313 // Unintrospectable function: new_with_data() / pango_attr_shape_new_with_data()
314 // VERSION: 1.8
315 // Like pango_attr_shape_new(), but a user data pointer is also
316 // provided; this pointer can be accessed when later
317 // rendering the glyph.
319 // freed with pango_attribute_destroy().
320 // RETURNS: the newly allocated #PangoAttribute, which should be
321 // <ink_rect>: ink rectangle to assign to each character
322 // <logical_rect>: logical rectangle to assign to each character
323 // <data>: user data pointer
324 // <copy_func>: function to copy @data when the attribute is copied. If %NULL, @data is simply copied as a pointer.
325 // <destroy_func>: function to free @data when the attribute is freed, or %NULL
326 static Attribute* new_with_data(AT0, AT1, AT2)(AT0 /*Rectangle*/ ink_rect, AT1 /*Rectangle*/ logical_rect, AT2 /*void*/ data, AttrDataCopyFunc copy_func, GLib2.DestroyNotify destroy_func) nothrow {
327 return pango_attr_shape_new_with_data(UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect), UpCast!(void*)(data), copy_func, destroy_func);
331 struct AttrSize {
332 Attribute attr;
333 int size;
334 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
335 uint, "absolute", 1,
336 uint, "__dummy32A", 31));
339 // Unintrospectable function: new() / pango_attr_size_new()
340 // Create a new font-size attribute in fractional points.
342 // freed with pango_attribute_destroy().
343 // RETURNS: the newly allocated #PangoAttribute, which should be
344 // <size>: the font size, in %PANGO_SCALE<!-- -->ths of a point.
345 static Attribute* new_()(int size) nothrow {
346 return pango_attr_size_new(size);
349 // Unintrospectable function: new_absolute() / pango_attr_size_new_absolute()
350 // VERSION: 1.8
351 // Create a new font-size attribute in device units.
353 // freed with pango_attribute_destroy().
354 // RETURNS: the newly allocated #PangoAttribute, which should be
355 // <size>: the font size, in %PANGO_SCALE<!-- -->ths of a device unit.
356 static Attribute* new_absolute()(int size) nothrow {
357 return pango_attr_size_new_absolute(size);
361 struct AttrString {
362 Attribute attr;
363 char* value;
366 enum AttrType {
367 INVALID = 0,
368 LANGUAGE = 1,
369 FAMILY = 2,
370 STYLE = 3,
371 WEIGHT = 4,
372 VARIANT = 5,
373 STRETCH = 6,
374 SIZE = 7,
375 FONT_DESC = 8,
376 FOREGROUND = 9,
377 BACKGROUND = 10,
378 UNDERLINE = 11,
379 STRIKETHROUGH = 12,
380 RISE = 13,
381 SHAPE = 14,
382 SCALE = 15,
383 FALLBACK = 16,
384 LETTER_SPACING = 17,
385 UNDERLINE_COLOR = 18,
386 STRIKETHROUGH_COLOR = 19,
387 ABSOLUTE_SIZE = 20,
388 GRAVITY = 21,
389 GRAVITY_HINT = 22
391 struct Attribute {
392 AttrClass* klass;
393 uint start_index, end_index;
396 // Unintrospectable method: copy() / pango_attribute_copy()
397 // Make a copy of an attribute.
399 // freed with pango_attribute_destroy().
400 // RETURNS: the newly allocated #PangoAttribute, which should be
401 Attribute* copy()() nothrow {
402 return pango_attribute_copy(&this);
404 // Destroy a #PangoAttribute and free all associated memory.
405 void destroy()() nothrow {
406 pango_attribute_destroy(&this);
409 // Compare two attributes for equality. This compares only the
410 // actual value of the two attributes and not the ranges that the
411 // attributes apply to.
412 // RETURNS: %TRUE if the two attributes have the same value.
413 // <attr2>: another #PangoAttribute
414 int equal(AT0)(AT0 /*Attribute*/ attr2) nothrow {
415 return pango_attribute_equal(&this, UpCast!(Attribute*)(attr2));
418 // VERSION: 1.20
419 // Initializes @attr's klass to @klass,
420 // it's start_index to %PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING
421 // and end_index to %PANGO_ATTR_INDEX_TO_TEXT_END
422 // such that the attribute applies
423 // to the entire text by default.
424 // <klass>: a #PangoAttributeClass
425 void init(AT0)(AT0 /*AttrClass*/ klass) nothrow {
426 pango_attribute_init(&this, UpCast!(AttrClass*)(klass));
431 // The #PangoBidiType type represents the bidirectional character
432 // type of a Unicode character as specified by the
433 // <ulink url="http://www.unicode.org/reports/tr9/">Unicode bidirectional algorithm</ulink>.
434 enum BidiType /* Version 1.22 */ {
435 L = 0,
436 LRE = 1,
437 LRO = 2,
438 R = 3,
439 AL = 4,
440 RLE = 5,
441 RLO = 6,
442 PDF = 7,
443 EN = 8,
444 ES = 9,
445 ET = 10,
446 AN = 11,
447 CS = 12,
448 NSM = 13,
449 BN = 14,
450 B = 15,
451 S = 16,
452 WS = 17,
453 ON = 18
455 struct Color {
456 ushort red, green, blue;
459 // Creates a copy of @src, which should be freed with
460 // pango_color_free(). Primarily used by language bindings,
461 // not that useful otherwise (since colors can just be copied
462 // by assignment in C).
464 // be freed with pango_color_free(), or %NULL
465 // if @src was %NULL.
466 // RETURNS: the newly allocated #PangoColor, which should
467 Color* /*new*/ copy()() nothrow {
468 return pango_color_copy(&this);
470 // Frees a color allocated by pango_color_copy().
471 void free()() nothrow {
472 pango_color_free(&this);
475 // Fill in the fields of a color from a string specification. The
476 // string can either one of a large set of standard names. (Taken
477 // from the X11 <filename>rgb.txt</filename> file), or it can be a hex value in the
478 // form '&num;rgb' '&num;rrggbb' '&num;rrrgggbbb' or '&num;rrrrggggbbbb' where
479 // 'r', 'g' and 'b' are hex digits of the red, green, and blue
480 // components of the color, respectively. (White in the four
481 // forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and '&num;ffffffffffff')
483 // otherwise false.
484 // RETURNS: %TRUE if parsing of the specifier succeeded,
485 // <spec>: a string specifying the new color
486 int parse(AT0)(AT0 /*char*/ spec) nothrow {
487 return pango_color_parse(&this, toCString!(char*)(spec));
490 // VERSION: 1.16
491 // Returns a textual specification of @color in the hexadecimal form
492 // <literal>&num;rrrrggggbbbb</literal>, where <literal>r</literal>,
493 // <literal>g</literal> and <literal>b</literal> are hex digits representing
494 // the red, green, and blue components respectively.
495 // RETURNS: a newly-allocated text string that must be freed with g_free().
496 char* /*new*/ to_string()() nothrow {
497 return pango_color_to_string(&this);
501 struct Context /* : GObject.Object */ {
502 alias method_parent this;
503 alias method_parent super_;
504 alias method_parent object;
505 GObject2.Object method_parent;
508 // Creates a new #PangoContext initialized to default values.
510 // This function is not particularly useful as it should always
511 // be followed by a pango_context_set_font_map() call, and the
512 // function pango_font_map_create_context() does these two steps
513 // together and hence users are recommended to use that.
515 // If you are using Pango as part of a higher-level system,
516 // that system may have it's own way of create a #PangoContext.
517 // For instance, the GTK+ toolkit has, among others,
518 // gdk_pango_context_get_for_screen(), and
519 // gtk_widget_get_pango_context(). Use those instead.
521 // be freed with g_object_unref().
522 // RETURNS: the newly allocated #PangoContext, which should
523 static Context* /*new*/ new_()() nothrow {
524 return pango_context_new();
526 static auto opCall()() {
527 return pango_context_new();
530 // Retrieves the base direction for the context. See
531 // pango_context_set_base_dir().
532 // RETURNS: the base direction for the context.
533 Direction get_base_dir()() nothrow {
534 return pango_context_get_base_dir(&this);
537 // VERSION: 1.16
538 // Retrieves the base gravity for the context. See
539 // pango_context_set_base_gravity().
540 // RETURNS: the base gravity for the context.
541 Gravity get_base_gravity()() nothrow {
542 return pango_context_get_base_gravity(&this);
545 // Retrieve the default font description for the context.
547 // This value must not be modified or freed.
548 // RETURNS: a pointer to the context's default font description.
549 FontDescription* /*new*/ get_font_description()() nothrow {
550 return pango_context_get_font_description(&this);
553 // Unintrospectable method: get_font_map() / pango_context_get_font_map()
554 // VERSION: 1.6
555 // Gets the #PangoFontmap used to look up fonts for this context.
557 // is owned by Pango and should not be unreferenced.
558 // RETURNS: the font map for the #PangoContext. This value
559 FontMap* get_font_map()() nothrow {
560 return pango_context_get_font_map(&this);
563 // VERSION: 1.16
564 // Retrieves the gravity for the context. This is similar to
565 // pango_context_get_base_gravity(), except for when the base gravity
566 // is %PANGO_GRAVITY_AUTO for which pango_gravity_get_for_matrix() is used
567 // to return the gravity from the current context matrix.
568 // RETURNS: the resolved gravity for the context.
569 Gravity get_gravity()() nothrow {
570 return pango_context_get_gravity(&this);
573 // VERSION: 1.16
574 // Retrieves the gravity hint for the context. See
575 // pango_context_set_gravity_hint() for details.
576 // RETURNS: the gravity hint for the context.
577 GravityHint get_gravity_hint()() nothrow {
578 return pango_context_get_gravity_hint(&this);
581 // Retrieves the global language tag for the context.
582 // RETURNS: the global language tag.
583 Language* /*new*/ get_language()() nothrow {
584 return pango_context_get_language(&this);
587 // VERSION: 1.6
588 // Gets the transformation matrix that will be applied when
589 // rendering with this context. See pango_context_set_matrix().
591 // (which is the same as the identity matrix). The returned
592 // matrix is owned by Pango and must not be modified or
593 // freed.
594 // RETURNS: the matrix, or %NULL if no matrix has been set
595 Matrix* get_matrix()() nothrow {
596 return pango_context_get_matrix(&this);
599 // Get overall metric information for a particular font
600 // description. Since the metrics may be substantially different for
601 // different scripts, a language tag can be provided to indicate that
602 // the metrics should be retrieved that correspond to the script(s)
603 // used by that language.
605 // The #PangoFontDescription is interpreted in the same way as
606 // by pango_itemize(), and the family name may be a comma separated
607 // list of figures. If characters from multiple of these families
608 // would be used to render the string, then the returned fonts would
609 // be a composite of the metrics for the fonts loaded for the
610 // individual families.
612 // when finished using the object.
613 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
614 // <desc>: a #PangoFontDescription structure. %NULL means that the font description from the context will be used.
615 // <language>: language tag used to determine which script to get the metrics for. %NULL means that the language tag from the context will be used. If no language tag is set on the context, metrics for the default language (as determined by pango_language_get_default()) will be returned.
616 FontMetrics* /*new*/ get_metrics(AT0, AT1)(AT0 /*FontDescription*/ desc, AT1 /*Language*/ language) nothrow {
617 return pango_context_get_metrics(&this, UpCast!(FontDescription*)(desc), UpCast!(Language*)(language));
620 // List all families for a context.
621 // <families>: location to store a pointer to an array of #PangoFontFamily *. This array should be freed with g_free().
622 // <n_families>: location to store the number of elements in @descs
623 void list_families(AT0)(AT0 /*FontFamily***/ families, int* n_families) nothrow {
624 pango_context_list_families(&this, UpCast!(FontFamily***)(families), n_families);
627 // Unintrospectable method: load_font() / pango_context_load_font()
628 // Loads the font in one of the fontmaps in the context
629 // that is the closest match for @desc.
630 // RETURNS: the font loaded, or %NULL if no font matched.
631 // <desc>: a #PangoFontDescription describing the font to load
632 Font* load_font(AT0)(AT0 /*FontDescription*/ desc) nothrow {
633 return pango_context_load_font(&this, UpCast!(FontDescription*)(desc));
636 // Unintrospectable method: load_fontset() / pango_context_load_fontset()
637 // Load a set of fonts in the context that can be used to render
638 // a font matching @desc.
639 // RETURNS: the fontset, or %NULL if no font matched.
640 // <desc>: a #PangoFontDescription describing the fonts to load
641 // <language>: a #PangoLanguage the fonts will be used for
642 Fontset* load_fontset(AT0, AT1)(AT0 /*FontDescription*/ desc, AT1 /*Language*/ language) nothrow {
643 return pango_context_load_fontset(&this, UpCast!(FontDescription*)(desc), UpCast!(Language*)(language));
646 // Sets the base direction for the context.
648 // The base direction is used in applying the Unicode bidirectional
649 // algorithm; if the @direction is %PANGO_DIRECTION_LTR or
650 // %PANGO_DIRECTION_RTL, then the value will be used as the paragraph
651 // direction in the Unicode bidirectional algorithm. A value of
652 // %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only
653 // for paragraphs that do not contain any strong characters themselves.
654 // <direction>: the new base direction
655 void set_base_dir()(Direction direction) nothrow {
656 pango_context_set_base_dir(&this, direction);
659 // VERSION: 1.16
660 // Sets the base gravity for the context.
662 // The base gravity is used in laying vertical text out.
663 // <gravity>: the new base gravity
664 void set_base_gravity()(Gravity gravity) nothrow {
665 pango_context_set_base_gravity(&this, gravity);
668 // Set the default font description for the context
669 // <desc>: the new pango font description
670 void set_font_description(AT0)(AT0 /*FontDescription*/ desc) nothrow {
671 pango_context_set_font_description(&this, UpCast!(FontDescription*)(desc));
674 // Sets the font map to be searched when fonts are looked-up in this context.
675 // This is only for internal use by Pango backends, a #PangoContext obtained
676 // via one of the recommended methods should already have a suitable font map.
677 // <font_map>: the #PangoFontMap to set.
678 void set_font_map(AT0)(AT0 /*FontMap*/ font_map) nothrow {
679 pango_context_set_font_map(&this, UpCast!(FontMap*)(font_map));
682 // VERSION: 1.16
683 // Sets the gravity hint for the context.
685 // The gravity hint is used in laying vertical text out, and is only relevant
686 // if gravity of the context as returned by pango_context_get_gravity()
687 // is set %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST.
688 // <hint>: the new gravity hint
689 void set_gravity_hint()(GravityHint hint) nothrow {
690 pango_context_set_gravity_hint(&this, hint);
693 // Sets the global language tag for the context. The default language
694 // for the locale of the running process can be found using
695 // pango_language_get_default().
696 // <language>: the new language tag.
697 void set_language(AT0)(AT0 /*Language*/ language) nothrow {
698 pango_context_set_language(&this, UpCast!(Language*)(language));
701 // VERSION: 1.6
702 // Sets the transformation matrix that will be applied when rendering
703 // with this context. Note that reported metrics are in the user space
704 // coordinates before the application of the matrix, not device-space
705 // coordinates after the application of the matrix. So, they don't scale
706 // with the matrix, though they may change slightly for different
707 // matrices, depending on how the text is fit to the pixel grid.
708 // <matrix>: a #PangoMatrix, or %NULL to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)
709 void set_matrix(AT0)(AT0 /*Matrix*/ matrix) nothrow {
710 pango_context_set_matrix(&this, UpCast!(Matrix*)(matrix));
714 struct ContextClass {
717 struct Coverage {
719 // Unintrospectable method: copy() / pango_coverage_copy()
720 // Copy an existing #PangoCoverage. (This function may now be unnecessary
721 // since we refcount the structure. File a bug if you use it.)
723 // with a reference count of one, which
724 // should be freed with pango_coverage_unref().
725 // RETURNS: the newly allocated #PangoCoverage,
726 Coverage* copy()() nothrow {
727 return pango_coverage_copy(&this);
730 // Determine whether a particular index is covered by @coverage
731 // RETURNS: the coverage level of @coverage for character @index_.
732 // <index_>: the index to check
733 CoverageLevel get()(int index_) nothrow {
734 return pango_coverage_get(&this, index_);
737 // Set the coverage for each index in @coverage to be the max (better)
738 // value of the current coverage for the index and the coverage for
739 // the corresponding index in @other.
740 // <other>: another #PangoCoverage
741 void max(AT0)(AT0 /*Coverage*/ other) nothrow {
742 pango_coverage_max(&this, UpCast!(Coverage*)(other));
745 // Unintrospectable method: ref() / pango_coverage_ref()
746 // Increase the reference count on the #PangoCoverage by one
747 // RETURNS: @coverage
748 Coverage* ref_()() nothrow {
749 return pango_coverage_ref(&this);
752 // Modify a particular index within @coverage
753 // <index_>: the index to modify
754 // <level>: the new level for @index_
755 void set()(int index_, CoverageLevel level) nothrow {
756 pango_coverage_set(&this, index_, level);
759 // Convert a #PangoCoverage structure into a flat binary format
760 // <bytes>: location to store result (must be freed with g_free())
761 // <n_bytes>: location to store size of result
762 void to_bytes(AT0)(AT0 /*ubyte**/ bytes, int* n_bytes) nothrow {
763 pango_coverage_to_bytes(&this, UpCast!(ubyte**)(bytes), n_bytes);
766 // Decrease the reference count on the #PangoCoverage by one.
767 // If the result is zero, free the coverage and all associated memory.
768 void unref()() nothrow {
769 pango_coverage_unref(&this);
772 // Unintrospectable function: from_bytes() / pango_coverage_from_bytes()
773 // Convert data generated from pango_converage_to_bytes() back
774 // to a #PangoCoverage
776 // the data was invalid.
777 // RETURNS: a newly allocated #PangoCoverage, or %NULL if
778 // <bytes>: binary data representing a #PangoCoverage
779 // <n_bytes>: the size of @bytes in bytes
780 static Coverage* from_bytes(AT0)(AT0 /*ubyte*/ bytes, int n_bytes) nothrow {
781 return pango_coverage_from_bytes(UpCast!(ubyte*)(bytes), n_bytes);
784 // Unintrospectable function: new() / pango_coverage_new()
785 // Create a new #PangoCoverage
787 // initialized to %PANGO_COVERAGE_NONE
788 // with a reference count of one, which
789 // should be freed with pango_coverage_unref().
790 // RETURNS: the newly allocated #PangoCoverage,
791 static Coverage* new_()() nothrow {
792 return pango_coverage_new();
796 enum CoverageLevel {
797 NONE = 0,
798 FALLBACK = 1,
799 APPROXIMATE = 2,
800 EXACT = 3
803 // The #PangoDirection type represents a direction in the
804 // Unicode bidirectional algorithm; not every value in this
805 // enumeration makes sense for every usage of #PangoDirection;
806 // for example, the return value of pango_unichar_direction()
807 // and pango_find_base_dir() cannot be %PANGO_DIRECTION_WEAK_LTR
808 // or %PANGO_DIRECTION_WEAK_RTL, since every character is either
809 // neutral or has a strong direction; on the other hand
810 // %PANGO_DIRECTION_NEUTRAL doesn't make sense to pass
811 // to pango_itemize_with_base_dir().
813 // The %PANGO_DIRECTION_TTB_LTR, %PANGO_DIRECTION_TTB_RTL
814 // values come from an earlier interpretation of this
815 // enumeration as the writing direction of a block of
816 // text and are no longer used; See #PangoGravity for how
817 // vertical text is handled in Pango.
818 enum Direction {
819 LTR = 0,
820 RTL = 1,
821 TTB_LTR = 2,
822 TTB_RTL = 3,
823 WEAK_LTR = 4,
824 WEAK_RTL = 5,
825 NEUTRAL = 6
827 enum ENGINE_TYPE_LANG = "PangoEngineLang";
828 enum ENGINE_TYPE_SHAPE = "PangoEngineShape";
830 // The #PangoEllipsizeMode type describes what sort of (if any)
831 // ellipsization should be applied to a line of text. In
832 // the ellipsization process characters are removed from the
833 // text in order to make it fit to a given width and replaced
834 // with an ellipsis.
835 enum EllipsizeMode {
836 NONE = 0,
837 START = 1,
838 MIDDLE = 2,
839 END = 3
841 struct EngineLang {
844 struct EngineShape {
847 struct Font /* : GObject.Object */ {
848 alias method_parent this;
849 alias method_parent super_;
850 alias method_parent object;
851 GObject2.Object method_parent;
854 // Frees an array of font descriptions.
855 // <descs>: a pointer to an array of #PangoFontDescription, may be %NULL
856 // <n_descs>: number of font descriptions in @descs
857 static void descriptions_free(AT0)(AT0 /*FontDescription**/ descs, int n_descs) nothrow {
858 pango_font_descriptions_free(UpCast!(FontDescription**)(descs), n_descs);
861 // Returns a description of the font, with font size set in points.
862 // Use pango_font_describe_with_absolute_size() if you want the font
863 // size in device units.
864 // RETURNS: a newly-allocated #PangoFontDescription object.
865 FontDescription* /*new*/ describe()() nothrow {
866 return pango_font_describe(&this);
869 // VERSION: 1.14
870 // Returns a description of the font, with absolute font size set
871 // (in device units). Use pango_font_describe() if you want the font
872 // size in points.
873 // RETURNS: a newly-allocated #PangoFontDescription object.
874 FontDescription* /*new*/ describe_with_absolute_size()() nothrow {
875 return pango_font_describe_with_absolute_size(&this);
878 // Unintrospectable method: find_shaper() / pango_font_find_shaper()
879 // Finds the best matching shaper for a font for a particular
880 // language tag and character point.
881 // RETURNS: the best matching shaper.
882 // <language>: the language tag
883 // <ch>: a Unicode character.
884 EngineShape* find_shaper(AT0)(AT0 /*Language*/ language, uint ch) nothrow {
885 return pango_font_find_shaper(&this, UpCast!(Language*)(language), ch);
888 // Unintrospectable method: get_coverage() / pango_font_get_coverage()
889 // Computes the coverage map for a given font and language tag.
890 // RETURNS: a newly-allocated #PangoCoverage object.
891 // <language>: the language tag
892 Coverage* get_coverage(AT0)(AT0 /*Language*/ language) nothrow {
893 return pango_font_get_coverage(&this, UpCast!(Language*)(language));
896 // Unintrospectable method: get_font_map() / pango_font_get_font_map()
897 // VERSION: 1.10
898 // Gets the font map for which the font was created.
900 // Note that the font maintains a <firstterm>weak</firstterm> reference
901 // to the font map, so if all references to font map are dropped, the font
902 // map will be finalized even if there are fonts created with the font
903 // map that are still alive. In that case this function will return %NULL.
904 // It is the responsibility of the user to ensure that the font map is kept
905 // alive. In most uses this is not an issue as a #PangoContext holds
906 // a reference to the font map.
907 // RETURNS: the #PangoFontMap for the font, or %NULL if @font is %NULL.
908 FontMap* get_font_map()() nothrow {
909 return pango_font_get_font_map(&this);
912 // Gets the logical and ink extents of a glyph within a font. The
913 // coordinate system for each rectangle has its origin at the
914 // base line and horizontal origin of the character with increasing
915 // coordinates extending to the right and down. The macros PANGO_ASCENT(),
916 // PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert
917 // from the extents rectangle to more traditional font metrics. The units
918 // of the rectangles are in 1/PANGO_SCALE of a device unit.
920 // If @font is %NULL, this function gracefully sets some sane values in the
921 // output variables and returns.
922 // <glyph>: the glyph index
923 // <ink_rect>: rectangle used to store the extents of the glyph as drawn or %NULL to indicate that the result is not needed.
924 // <logical_rect>: rectangle used to store the logical extents of the glyph or %NULL to indicate that the result is not needed.
925 void get_glyph_extents(AT0, AT1)(Glyph glyph, AT0 /*Rectangle*/ ink_rect, AT1 /*Rectangle*/ logical_rect) nothrow {
926 pango_font_get_glyph_extents(&this, glyph, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
929 // Gets overall metric information for a font. Since the metrics may be
930 // substantially different for different scripts, a language tag can
931 // be provided to indicate that the metrics should be retrieved that
932 // correspond to the script(s) used by that language.
934 // If @font is %NULL, this function gracefully sets some sane values in the
935 // output variables and returns.
937 // when finished using the object.
938 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
939 // <language>: language tag used to determine which script to get the metrics for, or %NULL to indicate to get the metrics for the entire font.
940 FontMetrics* /*new*/ get_metrics(AT0)(AT0 /*Language*/ language) nothrow {
941 return pango_font_get_metrics(&this, UpCast!(Language*)(language));
945 struct FontDescription {
947 // Creates a new font description structure with all fields unset.
949 // should be freed using pango_font_description_free().
950 // RETURNS: the newly allocated #PangoFontDescription, which
951 static FontDescription* /*new*/ new_()() nothrow {
952 return pango_font_description_new();
954 static auto opCall()() {
955 return pango_font_description_new();
958 // Determines if the style attributes of @new_match are a closer match
959 // for @desc than those of @old_match are, or if @old_match is %NULL,
960 // determines if @new_match is a match at all.
961 // Approximate matching is done for
962 // weight and style; other style attributes must match exactly.
963 // Style attributes are all attributes other than family and size-related
964 // attributes. Approximate matching for style considers PANGO_STYLE_OBLIQUE
965 // and PANGO_STYLE_ITALIC as matches, but not as good a match as when the
966 // styles are equal.
968 // Note that @old_match must match @desc.
969 // RETURNS: %TRUE if @new_match is a better match
970 // <old_match>: a #PangoFontDescription, or %NULL
971 // <new_match>: a #PangoFontDescription
972 int better_match(AT0, AT1)(AT0 /*FontDescription*/ old_match, AT1 /*FontDescription*/ new_match) nothrow {
973 return pango_font_description_better_match(&this, UpCast!(FontDescription*)(old_match), UpCast!(FontDescription*)(new_match));
976 // Make a copy of a #PangoFontDescription.
978 // be freed with pango_font_description_free(), or %NULL
979 // if @desc was %NULL.
980 // RETURNS: the newly allocated #PangoFontDescription, which should
981 FontDescription* /*new*/ copy()() nothrow {
982 return pango_font_description_copy(&this);
985 // Like pango_font_description_copy(), but only a shallow copy is made
986 // of the family name and other allocated fields. The result can only
987 // be used until @desc is modified or freed. This is meant to be used
988 // when the copy is only needed temporarily.
990 // be freed with pango_font_description_free(), or %NULL
991 // if @desc was %NULL.
992 // RETURNS: the newly allocated #PangoFontDescription, which should
993 FontDescription* /*new*/ copy_static()() nothrow {
994 return pango_font_description_copy_static(&this);
997 // Compares two font descriptions for equality. Two font descriptions
998 // are considered equal if the fonts they describe are provably identical.
999 // This means that their masks do not have to match, as long as other fields
1000 // are all the same. (Two font descriptions may result in identical fonts
1001 // being loaded, but still compare %FALSE.)
1003 // %FALSE otherwise.
1004 // RETURNS: %TRUE if the two font descriptions are identical,
1005 // <desc2>: another #PangoFontDescription
1006 int equal(AT0)(AT0 /*FontDescription*/ desc2) nothrow {
1007 return pango_font_description_equal(&this, UpCast!(FontDescription*)(desc2));
1009 // Frees a font description.
1010 void free()() nothrow {
1011 pango_font_description_free(&this);
1014 // Gets the family name field of a font description. See
1015 // pango_font_description_set_family().
1017 // %NULL if not previously set. This has the same life-time
1018 // as the font description itself and should not be freed.
1019 // RETURNS: the family name field for the font description, or
1020 char* get_family()() nothrow {
1021 return pango_font_description_get_family(&this);
1024 // VERSION: 1.16
1025 // Gets the gravity field of a font description. See
1026 // pango_font_description_set_gravity().
1028 // pango_font_description_get_set_fields() to find out if
1029 // the field was explicitly set or not.
1030 // RETURNS: the gravity field for the font description. Use
1031 Gravity get_gravity()() nothrow {
1032 return pango_font_description_get_gravity(&this);
1035 // Determines which fields in a font description have been set.
1037 // fields in @desc that have been set.
1038 // RETURNS: a bitmask with bits set corresponding to the
1039 FontMask get_set_fields()() nothrow {
1040 return pango_font_description_get_set_fields(&this);
1043 // Gets the size field of a font description.
1044 // See pango_font_description_set_size().
1046 // You must call pango_font_description_get_size_is_absolute()
1047 // to find out which is the case. Returns 0 if the size field has not
1048 // previously been set or it has been set to 0 explicitly.
1049 // Use pango_font_description_get_set_fields() to
1050 // find out if the field was explicitly set or not.
1051 // RETURNS: the size field for the font description in points or device units.
1052 int get_size()() nothrow {
1053 return pango_font_description_get_size(&this);
1056 // VERSION: 1.8
1057 // Determines whether the size of the font is in points (not absolute) or device units (absolute).
1058 // See pango_font_description_set_size() and pango_font_description_set_absolute_size().
1060 // points or device units. Use pango_font_description_get_set_fields() to
1061 // find out if the size field of the font description was explicitly set or not.
1062 // RETURNS: whether the size for the font description is in
1063 int get_size_is_absolute()() nothrow {
1064 return pango_font_description_get_size_is_absolute(&this);
1067 // Gets the stretch field of a font description.
1068 // See pango_font_description_set_stretch().
1070 // pango_font_description_get_set_fields() to find out if
1071 // the field was explicitly set or not.
1072 // RETURNS: the stretch field for the font description. Use
1073 Stretch get_stretch()() nothrow {
1074 return pango_font_description_get_stretch(&this);
1077 // Gets the style field of a #PangoFontDescription. See
1078 // pango_font_description_set_style().
1080 // Use pango_font_description_get_set_fields() to find out if
1081 // the field was explicitly set or not.
1082 // RETURNS: the style field for the font description.
1083 Style get_style()() nothrow {
1084 return pango_font_description_get_style(&this);
1087 // Gets the variant field of a #PangoFontDescription. See
1088 // pango_font_description_set_variant().
1090 // pango_font_description_get_set_fields() to find out if
1091 // the field was explicitly set or not.
1092 // RETURNS: the variant field for the font description. Use
1093 Variant get_variant()() nothrow {
1094 return pango_font_description_get_variant(&this);
1097 // Gets the weight field of a font description. See
1098 // pango_font_description_set_weight().
1100 // pango_font_description_get_set_fields() to find out if
1101 // the field was explicitly set or not.
1102 // RETURNS: the weight field for the font description. Use
1103 Weight get_weight()() nothrow {
1104 return pango_font_description_get_weight(&this);
1107 // Computes a hash of a #PangoFontDescription structure suitable
1108 // to be used, for example, as an argument to g_hash_table_new().
1109 // The hash value is independent of @desc->mask.
1110 // RETURNS: the hash value.
1111 uint hash()() nothrow {
1112 return pango_font_description_hash(&this);
1115 // Merges the fields that are set in @desc_to_merge into the fields in
1116 // @desc. If @replace_existing is %FALSE, only fields in @desc that
1117 // are not already set are affected. If %TRUE, then fields that are
1118 // already set will be replaced as well.
1120 // If @desc_to_merge is %NULL, this function performs nothing.
1121 // <desc_to_merge>: the #PangoFontDescription to merge from, or %NULL
1122 // <replace_existing>: if %TRUE, replace fields in @desc with the corresponding values from @desc_to_merge, even if they are already exist.
1123 void merge(AT0)(AT0 /*FontDescription*/ desc_to_merge, int replace_existing) nothrow {
1124 pango_font_description_merge(&this, UpCast!(FontDescription*)(desc_to_merge), replace_existing);
1127 // Like pango_font_description_merge(), but only a shallow copy is made
1128 // of the family name and other allocated fields. @desc can only be
1129 // used until @desc_to_merge is modified or freed. This is meant
1130 // to be used when the merged font description is only needed temporarily.
1131 // <desc_to_merge>: the #PangoFontDescription to merge from
1132 // <replace_existing>: if %TRUE, replace fields in @desc with the corresponding values from @desc_to_merge, even if they are already exist.
1133 void merge_static(AT0)(AT0 /*FontDescription*/ desc_to_merge, int replace_existing) nothrow {
1134 pango_font_description_merge_static(&this, UpCast!(FontDescription*)(desc_to_merge), replace_existing);
1137 // VERSION: 1.8
1138 // Sets the size field of a font description, in device units. This is mutually
1139 // exclusive with pango_font_description_set_size() which sets the font size
1140 // in points.
1141 // <size>: the new size, in Pango units. There are %PANGO_SCALE Pango units in one device unit. For an output backend where a device unit is a pixel, a @size value of 10 * PANGO_SCALE gives a 10 pixel font.
1142 void set_absolute_size()(double size) nothrow {
1143 pango_font_description_set_absolute_size(&this, size);
1146 // Sets the family name field of a font description. The family
1147 // name represents a family of related font styles, and will
1148 // resolve to a particular #PangoFontFamily. In some uses of
1149 // #PangoFontDescription, it is also possible to use a comma
1150 // separated list of family names for this field.
1151 // <family>: a string representing the family name.
1152 void set_family(AT0)(AT0 /*char*/ family) nothrow {
1153 pango_font_description_set_family(&this, toCString!(char*)(family));
1156 // Like pango_font_description_set_family(), except that no
1157 // copy of @family is made. The caller must make sure that the
1158 // string passed in stays around until @desc has been freed
1159 // or the name is set again. This function can be used if
1160 // @family is a static string such as a C string literal, or
1161 // if @desc is only needed temporarily.
1162 // <family>: a string representing the family name.
1163 void set_family_static(AT0)(AT0 /*char*/ family) nothrow {
1164 pango_font_description_set_family_static(&this, toCString!(char*)(family));
1167 // VERSION: 1.16
1168 // Sets the gravity field of a font description. The gravity field
1169 // specifies how the glyphs should be rotated. If @gravity is
1170 // %PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on
1171 // the font description.
1173 // This function is seldom useful to the user. Gravity should normally
1174 // be set on a #PangoContext.
1175 // <gravity>: the gravity for the font description.
1176 void set_gravity()(Gravity gravity) nothrow {
1177 pango_font_description_set_gravity(&this, gravity);
1180 // Sets the size field of a font description in fractional points. This is mutually
1181 // exclusive with pango_font_description_set_absolute_size().
1182 // <size>: the size of the font in points, scaled by PANGO_SCALE. (That is, a @size value of 10 * PANGO_SCALE is a 10 point font. The conversion factor between points and device units depends on system configuration and the output device. For screen display, a logical DPI of 96 is common, in which case a 10 point font corresponds to a 10 * (96 / 72) = 13.3 pixel font. Use pango_font_description_set_absolute_size() if you need a particular size in device units.
1183 void set_size()(int size) nothrow {
1184 pango_font_description_set_size(&this, size);
1187 // Sets the stretch field of a font description. The stretch field
1188 // specifies how narrow or wide the font should be.
1189 // <stretch>: the stretch for the font description
1190 void set_stretch()(Stretch stretch) nothrow {
1191 pango_font_description_set_stretch(&this, stretch);
1194 // Sets the style field of a #PangoFontDescription. The
1195 // #PangoStyle enumeration describes whether the font is slanted and
1196 // the manner in which it is slanted; it can be either
1197 // #PANGO_STYLE_NORMAL, #PANGO_STYLE_ITALIC, or #PANGO_STYLE_OBLIQUE.
1198 // Most fonts will either have a italic style or an oblique
1199 // style, but not both, and font matching in Pango will
1200 // match italic specifications with oblique fonts and vice-versa
1201 // if an exact match is not found.
1202 // <style>: the style for the font description
1203 void set_style()(Style style) nothrow {
1204 pango_font_description_set_style(&this, style);
1207 // Sets the variant field of a font description. The #PangoVariant
1208 // can either be %PANGO_VARIANT_NORMAL or %PANGO_VARIANT_SMALL_CAPS.
1209 // <variant>: the variant type for the font description.
1210 void set_variant()(Variant variant) nothrow {
1211 pango_font_description_set_variant(&this, variant);
1214 // Sets the weight field of a font description. The weight field
1215 // specifies how bold or light the font should be. In addition
1216 // to the values of the #PangoWeight enumeration, other intermediate
1217 // numeric values are possible.
1218 // <weight>: the weight for the font description.
1219 void set_weight()(Weight weight) nothrow {
1220 pango_font_description_set_weight(&this, weight);
1223 // Creates a filename representation of a font description. The
1224 // filename is identical to the result from calling
1225 // pango_font_description_to_string(), but with underscores instead of
1226 // characters that are untypical in filenames, and in lower case only.
1227 // RETURNS: a new string that must be freed with g_free().
1228 char* /*new*/ to_filename()() nothrow {
1229 return pango_font_description_to_filename(&this);
1232 // Creates a string representation of a font description. See
1233 // pango_font_description_from_string() for a description of the
1234 // format of the string representation. The family list in the
1235 // string description will only have a terminating comma if the
1236 // last word of the list is a valid style option.
1237 // RETURNS: a new string that must be freed with g_free().
1238 char* /*new*/ to_string()() nothrow {
1239 return pango_font_description_to_string(&this);
1242 // Unsets some of the fields in a #PangoFontDescription. The unset
1243 // fields will get back to their default values.
1244 // <to_unset>: bitmask of fields in the @desc to unset.
1245 void unset_fields()(FontMask to_unset) nothrow {
1246 pango_font_description_unset_fields(&this, to_unset);
1249 // Creates a new font description from a string representation in the
1250 // form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a
1251 // comma separated list of families optionally terminated by a comma,
1252 // STYLE_OPTIONS is a whitespace separated list of words where each WORD
1253 // describes one of style, variant, weight, stretch, or gravity, and SIZE
1254 // is a decimal number (size in points) or optionally followed by the
1255 // unit modifier "px" for absolute size. Any one of the options may
1256 // be absent. If FAMILY-LIST is absent, then the family_name field of
1257 // the resulting font description will be initialized to %NULL. If
1258 // STYLE-OPTIONS is missing, then all style options will be set to the
1259 // default values. If SIZE is missing, the size in the resulting font
1260 // description will be set to 0.
1261 // RETURNS: a new #PangoFontDescription.
1262 // <str>: string representation of a font description.
1263 static FontDescription* /*new*/ from_string(AT0)(AT0 /*char*/ str) nothrow {
1264 return pango_font_description_from_string(toCString!(char*)(str));
1268 struct FontFace /* : GObject.Object */ {
1269 alias method_parent this;
1270 alias method_parent super_;
1271 alias method_parent object;
1272 GObject2.Object method_parent;
1275 // Returns the family, style, variant, weight and stretch of
1276 // a #PangoFontFace. The size field of the resulting font description
1277 // will be unset.
1279 // holding the description of the face. Use pango_font_description_free()
1280 // to free the result.
1281 // RETURNS: a newly-created #PangoFontDescription structure
1282 FontDescription* /*new*/ describe()() nothrow {
1283 return pango_font_face_describe(&this);
1286 // Gets a name representing the style of this face among the
1287 // different faces in the #PangoFontFamily for the face. This
1288 // name is unique among all faces in the family and is suitable
1289 // for displaying to users.
1291 // owned by the face object and must not be modified or freed.
1292 // RETURNS: the face name for the face. This string is
1293 char* get_face_name()() nothrow {
1294 return pango_font_face_get_face_name(&this);
1297 // VERSION: 1.18
1298 // Returns whether a #PangoFontFace is synthesized by the underlying
1299 // font rendering engine from another face, perhaps by shearing, emboldening,
1300 // or lightening it.
1301 // RETURNS: whether @face is synthesized.
1302 int is_synthesized()() nothrow {
1303 return pango_font_face_is_synthesized(&this);
1306 // VERSION: 1.4
1307 // List the available sizes for a font. This is only applicable to bitmap
1308 // fonts. For scalable fonts, stores %NULL at the location pointed to by
1309 // @sizes and 0 at the location pointed to by @n_sizes. The sizes returned
1310 // are in Pango units and are sorted in ascending order.
1311 // <sizes>: location to store a pointer to an array of int. This array should be freed with g_free().
1312 // <n_sizes>: location to store the number of elements in @sizes
1313 void list_sizes()(int** sizes, int* n_sizes) nothrow {
1314 pango_font_face_list_sizes(&this, sizes, n_sizes);
1318 struct FontFamily /* : GObject.Object */ {
1319 alias method_parent this;
1320 alias method_parent super_;
1321 alias method_parent object;
1322 GObject2.Object method_parent;
1325 // Gets the name of the family. The name is unique among all
1326 // fonts for the font backend and can be used in a #PangoFontDescription
1327 // to specify that a face from this family is desired.
1329 // by the family object and must not be modified or freed.
1330 // RETURNS: the name of the family. This string is owned
1331 char* get_name()() nothrow {
1332 return pango_font_family_get_name(&this);
1335 // VERSION: 1.4
1336 // A monospace font is a font designed for text display where the the
1337 // characters form a regular grid. For Western languages this would
1338 // mean that the advance width of all characters are the same, but
1339 // this categorization also includes Asian fonts which include
1340 // double-width characters: characters that occupy two grid cells.
1341 // g_unichar_iswide() returns a result that indicates whether a
1342 // character is typically double-width in a monospace font.
1344 // The best way to find out the grid-cell size is to call
1345 // pango_font_metrics_get_approximate_digit_width(), since the results
1346 // of pango_font_metrics_get_approximate_char_width() may be affected
1347 // by double-width characters.
1348 // RETURNS: %TRUE if the family is monospace.
1349 int is_monospace()() nothrow {
1350 return pango_font_family_is_monospace(&this);
1353 // Lists the different font faces that make up @family. The faces
1354 // in a family share a common design, but differ in slant, weight,
1355 // width and other aspects.
1356 // <faces>: location to store an array of pointers to #PangoFontFace objects, or %NULL. This array should be freed with g_free() when it is no longer needed.
1357 // <n_faces>: location to store number of elements in @faces.
1358 void list_faces(AT0)(AT0 /*FontFace***/ faces, int* n_faces) nothrow {
1359 pango_font_family_list_faces(&this, UpCast!(FontFace***)(faces), n_faces);
1363 struct FontMap /* : GObject.Object */ {
1364 alias method_parent this;
1365 alias method_parent super_;
1366 alias method_parent object;
1367 GObject2.Object method_parent;
1370 // Unintrospectable method: create_context() / pango_font_map_create_context()
1371 // VERSION: 1.22
1372 // Creates a #PangoContext connected to @fontmap. This is equivalent
1373 // to pango_context_new() followed by pango_context_set_font_map().
1375 // If you are using Pango as part of a higher-level system,
1376 // that system may have it's own way of create a #PangoContext.
1377 // For instance, the GTK+ toolkit has, among others,
1378 // gdk_pango_context_get_for_screen(), and
1379 // gtk_widget_get_pango_context(). Use those instead.
1381 // be freed with g_object_unref().
1382 // RETURNS: the newly allocated #PangoContext, which should
1383 Context* create_context()() nothrow {
1384 return pango_font_map_create_context(&this);
1387 // List all families for a fontmap.
1388 // <families>: location to store a pointer to an array of #PangoFontFamily *. This array should be freed with g_free().
1389 // <n_families>: location to store the number of elements in @families
1390 void list_families(AT0)(AT0 /*FontFamily***/ families, int* n_families) nothrow {
1391 pango_font_map_list_families(&this, UpCast!(FontFamily***)(families), n_families);
1394 // Unintrospectable method: load_font() / pango_font_map_load_font()
1395 // Load the font in the fontmap that is the closest match for @desc.
1396 // RETURNS: the font loaded, or %NULL if no font matched.
1397 // <context>: the #PangoContext the font will be used with
1398 // <desc>: a #PangoFontDescription describing the font to load
1399 Font* load_font(AT0, AT1)(AT0 /*Context*/ context, AT1 /*FontDescription*/ desc) nothrow {
1400 return pango_font_map_load_font(&this, UpCast!(Context*)(context), UpCast!(FontDescription*)(desc));
1403 // Unintrospectable method: load_fontset() / pango_font_map_load_fontset()
1404 // Load a set of fonts in the fontmap that can be used to render
1405 // a font matching @desc.
1406 // RETURNS: the fontset, or %NULL if no font matched.
1407 // <context>: the #PangoContext the font will be used with
1408 // <desc>: a #PangoFontDescription describing the font to load
1409 // <language>: a #PangoLanguage the fonts will be used for
1410 Fontset* load_fontset(AT0, AT1, AT2)(AT0 /*Context*/ context, AT1 /*FontDescription*/ desc, AT2 /*Language*/ language) nothrow {
1411 return pango_font_map_load_fontset(&this, UpCast!(Context*)(context), UpCast!(FontDescription*)(desc), UpCast!(Language*)(language));
1415 enum FontMask {
1416 FAMILY = 1,
1417 STYLE = 2,
1418 VARIANT = 4,
1419 WEIGHT = 8,
1420 STRETCH = 16,
1421 SIZE = 32,
1422 GRAVITY = 64
1424 struct FontMetrics {
1426 // Gets the approximate character width for a font metrics structure.
1427 // This is merely a representative value useful, for example, for
1428 // determining the initial size for a window. Actual characters in
1429 // text will be wider and narrower than this.
1430 // RETURNS: the character width, in Pango units.
1431 int get_approximate_char_width()() nothrow {
1432 return pango_font_metrics_get_approximate_char_width(&this);
1435 // Gets the approximate digit width for a font metrics structure.
1436 // This is merely a representative value useful, for example, for
1437 // determining the initial size for a window. Actual digits in
1438 // text can be wider or narrower than this, though this value
1439 // is generally somewhat more accurate than the result of
1440 // pango_font_metrics_get_approximate_char_width() for digits.
1441 // RETURNS: the digit width, in Pango units.
1442 int get_approximate_digit_width()() nothrow {
1443 return pango_font_metrics_get_approximate_digit_width(&this);
1446 // Gets the ascent from a font metrics structure. The ascent is
1447 // the distance from the baseline to the logical top of a line
1448 // of text. (The logical top may be above or below the top of the
1449 // actual drawn ink. It is necessary to lay out the text to figure
1450 // where the ink will be.)
1451 // RETURNS: the ascent, in Pango units.
1452 int get_ascent()() nothrow {
1453 return pango_font_metrics_get_ascent(&this);
1456 // Gets the descent from a font metrics structure. The descent is
1457 // the distance from the baseline to the logical bottom of a line
1458 // of text. (The logical bottom may be above or below the bottom of the
1459 // actual drawn ink. It is necessary to lay out the text to figure
1460 // where the ink will be.)
1461 // RETURNS: the descent, in Pango units.
1462 int get_descent()() nothrow {
1463 return pango_font_metrics_get_descent(&this);
1466 // VERSION: 1.6
1467 // Gets the suggested position to draw the strikethrough.
1468 // The value returned is the distance <emphasis>above</emphasis> the
1469 // baseline of the top of the strikethrough.
1470 // RETURNS: the suggested strikethrough position, in Pango units.
1471 int get_strikethrough_position()() nothrow {
1472 return pango_font_metrics_get_strikethrough_position(&this);
1475 // VERSION: 1.6
1476 // Gets the suggested thickness to draw for the strikethrough.
1477 // RETURNS: the suggested strikethrough thickness, in Pango units.
1478 int get_strikethrough_thickness()() nothrow {
1479 return pango_font_metrics_get_strikethrough_thickness(&this);
1482 // VERSION: 1.6
1483 // Gets the suggested position to draw the underline.
1484 // The value returned is the distance <emphasis>above</emphasis> the
1485 // baseline of the top of the underline. Since most fonts have
1486 // underline positions beneath the baseline, this value is typically
1487 // negative.
1488 // RETURNS: the suggested underline position, in Pango units.
1489 int get_underline_position()() nothrow {
1490 return pango_font_metrics_get_underline_position(&this);
1493 // VERSION: 1.6
1494 // Gets the suggested thickness to draw for the underline.
1495 // RETURNS: the suggested underline thickness, in Pango units.
1496 int get_underline_thickness()() nothrow {
1497 return pango_font_metrics_get_underline_thickness(&this);
1500 // Increase the reference count of a font metrics structure by one.
1501 // RETURNS: @metrics
1502 FontMetrics* /*new*/ ref_()() nothrow {
1503 return pango_font_metrics_ref(&this);
1506 // Decrease the reference count of a font metrics structure by one. If
1507 // the result is zero, frees the structure and any associated
1508 // memory.
1509 void unref()() nothrow {
1510 pango_font_metrics_unref(&this);
1514 struct Fontset /* : GObject.Object */ {
1515 alias method_parent this;
1516 alias method_parent super_;
1517 alias method_parent object;
1518 GObject2.Object method_parent;
1521 // Unintrospectable method: foreach() / pango_fontset_foreach()
1522 // VERSION: 1.4
1523 // Iterates through all the fonts in a fontset, calling @func for
1524 // each one. If @func returns %TRUE, that stops the iteration.
1525 // <func>: Callback function
1526 // <data>: data to pass to the callback function
1527 void foreach_(AT0)(FontsetForeachFunc func, AT0 /*void*/ data) nothrow {
1528 pango_fontset_foreach(&this, func, UpCast!(void*)(data));
1531 // Unintrospectable method: get_font() / pango_fontset_get_font()
1532 // Returns the font in the fontset that contains the best glyph for the
1533 // Unicode character @wc.
1535 // with the font.
1536 // RETURNS: a #PangoFont. The caller must call g_object_unref when finished
1537 // <wc>: a Unicode character
1538 Font* get_font()(uint wc) nothrow {
1539 return pango_fontset_get_font(&this, wc);
1542 // Get overall metric information for the fonts in the fontset.
1544 // when finished using the object.
1545 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
1546 FontMetrics* /*new*/ get_metrics()() nothrow {
1547 return pango_fontset_get_metrics(&this);
1552 // VERSION: 1.4
1553 // A callback function used by pango_fontset_foreach() when enumerating
1554 // the fonts in a fontset.
1555 // RETURNS: if %TRUE, stop iteration and return immediately.
1556 // <fontset>: a #PangoFontset
1557 // <font>: a font from @fontset
1558 // <data>: callback data
1559 extern (C) alias int function (Fontset* fontset, Font* font, void* data) nothrow FontsetForeachFunc;
1561 struct GlyphGeometry {
1562 GlyphUnit width, x_offset, y_offset;
1565 struct GlyphInfo {
1566 Glyph glyph;
1567 GlyphGeometry geometry;
1568 GlyphVisAttr attr;
1571 struct GlyphItem {
1572 Item* item;
1573 GlyphString* glyphs;
1576 // Unintrospectable method: apply_attrs() / pango_glyph_item_apply_attrs()
1577 // VERSION: 1.2
1578 // Splits a shaped item (PangoGlyphItem) into multiple items based
1579 // on an attribute list. The idea is that if you have attributes
1580 // that don't affect shaping, such as color or underline, to avoid
1581 // affecting shaping, you filter them out (pango_attr_list_filter()),
1582 // apply the shaping process and then reapply them to the result using
1583 // this function.
1585 // All attributes that start or end inside a cluster are applied
1586 // to that cluster; for instance, if half of a cluster is underlined
1587 // and the other-half strikethrough, then the cluster will end
1588 // up with both underline and strikethrough attributes. In these
1589 // cases, it may happen that item->extra_attrs for some of the
1590 // result items can have multiple attributes of the same type.
1592 // This function takes ownership of @glyph_item; it will be reused
1593 // as one of the elements in the list.
1595 // @glyph_item. Free the elements using pango_glyph_item_free(),
1596 // the list using g_slist_free().
1597 // RETURNS: a list of glyph items resulting from splitting
1598 // <text>: text that @list applies to
1599 // <list>: a #PangoAttrList
1600 GLib2.SList* apply_attrs(AT0, AT1)(AT0 /*char*/ text, AT1 /*AttrList*/ list) nothrow {
1601 return pango_glyph_item_apply_attrs(&this, toCString!(char*)(text), UpCast!(AttrList*)(list));
1604 // VERSION: 1.20
1605 // Make a deep copy of an existing #PangoGlyphItem structure.
1607 // be freed with pango_glyph_item_free(), or %NULL
1608 // if @orig was %NULL.
1609 // RETURNS: the newly allocated #PangoGlyphItem, which should
1610 GlyphItem* /*new*/ copy()() nothrow {
1611 return pango_glyph_item_copy(&this);
1614 // VERSION: 1.6
1615 // Frees a #PangoGlyphItem and resources to which it points.
1616 void free()() nothrow {
1617 pango_glyph_item_free(&this);
1620 // VERSION: 1.26
1621 // Given a #PangoGlyphItem and the corresponding
1622 // text, determine the screen width corresponding to each character. When
1623 // multiple characters compose a single cluster, the width of the entire
1624 // cluster is divided equally among the characters.
1626 // See also pango_glyph_string_get_logical_widths().
1627 // <text>: text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text)
1628 // <logical_widths>: an array whose length is the number of characters in glyph_item (equal to glyph_item->item->num_chars) to be filled in with the resulting character widths.
1629 void get_logical_widths(AT0)(AT0 /*char*/ text, int* logical_widths) nothrow {
1630 pango_glyph_item_get_logical_widths(&this, toCString!(char*)(text), logical_widths);
1633 // VERSION: 1.6
1634 // Adds spacing between the graphemes of @glyph_item to
1635 // give the effect of typographic letter spacing.
1636 // <text>: text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text)
1637 // <log_attrs>: logical attributes for the item (the first logical attribute refers to the position before the first character in the item)
1638 // <letter_spacing>: amount of letter spacing to add in Pango units. May be negative, though too large negative values will give ugly results.
1639 void letter_space(AT0, AT1)(AT0 /*char*/ text, AT1 /*LogAttr*/ log_attrs, int letter_spacing) nothrow {
1640 pango_glyph_item_letter_space(&this, toCString!(char*)(text), UpCast!(LogAttr*)(log_attrs), letter_spacing);
1643 // VERSION: 1.2
1644 // Modifies @orig to cover only the text after @split_index, and
1645 // returns a new item that covers the text before @split_index that
1646 // used to be in @orig. You can think of @split_index as the length of
1647 // the returned item. @split_index may not be 0, and it may not be
1648 // greater than or equal to the length of @orig (that is, there must
1649 // be at least one byte assigned to each item, you can't create a
1650 // zero-length item).
1652 // This function is similar in function to pango_item_split() (and uses
1653 // it internally.)
1655 // @split_index, which should be freed
1656 // with pango_glyph_item_free().
1657 // RETURNS: the newly allocated item representing text before
1658 // <text>: text to which positions in @orig apply
1659 // <split_index>: byte index of position to split item, relative to the start of the item
1660 GlyphItem* /*new*/ split(AT0)(AT0 /*char*/ text, int split_index) nothrow {
1661 return pango_glyph_item_split(&this, toCString!(char*)(text), split_index);
1665 struct GlyphItemIter {
1666 GlyphItem* glyph_item;
1667 char* text;
1668 int start_glyph, start_index, start_char, end_glyph, end_index, end_char;
1671 // VERSION: 1.22
1672 // Make a shallow copy of an existing #PangoGlyphItemIter structure.
1674 // be freed with pango_glyph_item_iter_free(), or %NULL
1675 // if @orig was %NULL.
1676 // RETURNS: the newly allocated #PangoGlyphItemIter, which should
1677 GlyphItemIter* /*new*/ copy()() nothrow {
1678 return pango_glyph_item_iter_copy(&this);
1681 // VERSION: 1.22
1682 // Frees a #PangoGlyphItemIter created by pango_glyph_item_iter_copy().
1683 void free()() nothrow {
1684 pango_glyph_item_iter_free(&this);
1687 // VERSION: 1.22
1688 // Initializes a #PangoGlyphItemIter structure to point to the
1689 // last cluster in a glyph item.
1690 // See #PangoGlyphItemIter for details of cluster orders.
1691 // RETURNS: %FALSE if there are no clusters in the glyph item
1692 // <glyph_item>: the glyph item to iterate over
1693 // <text>: text corresponding to the glyph item
1694 int init_end(AT0, AT1)(AT0 /*GlyphItem*/ glyph_item, AT1 /*char*/ text) nothrow {
1695 return pango_glyph_item_iter_init_end(&this, UpCast!(GlyphItem*)(glyph_item), toCString!(char*)(text));
1698 // VERSION: 1.22
1699 // Initializes a #PangoGlyphItemIter structure to point to the
1700 // first cluster in a glyph item.
1701 // See #PangoGlyphItemIter for details of cluster orders.
1702 // RETURNS: %FALSE if there are no clusters in the glyph item
1703 // <glyph_item>: the glyph item to iterate over
1704 // <text>: text corresponding to the glyph item
1705 int init_start(AT0, AT1)(AT0 /*GlyphItem*/ glyph_item, AT1 /*char*/ text) nothrow {
1706 return pango_glyph_item_iter_init_start(&this, UpCast!(GlyphItem*)(glyph_item), toCString!(char*)(text));
1709 // VERSION: 1.22
1710 // Advances the iterator to the next cluster in the glyph item.
1711 // See #PangoGlyphItemIter for details of cluster orders.
1713 // last cluster.
1714 // RETURNS: %TRUE if the iterator was advanced, %FALSE if we were already on the
1715 int next_cluster()() nothrow {
1716 return pango_glyph_item_iter_next_cluster(&this);
1719 // VERSION: 1.22
1720 // Moves the iterator to the preceding cluster in the glyph item.
1721 // See #PangoGlyphItemIter for details of cluster orders.
1723 // first cluster.
1724 // RETURNS: %TRUE if the iterator was moved, %FALSE if we were already on the
1725 int prev_cluster()() nothrow {
1726 return pango_glyph_item_iter_prev_cluster(&this);
1730 struct GlyphString {
1731 int num_glyphs;
1732 GlyphInfo* glyphs;
1733 int* log_clusters;
1734 private int space;
1737 // Create a new #PangoGlyphString.
1739 // should be freed with pango_glyph_string_free().
1740 // RETURNS: the newly allocated #PangoGlyphString, which
1741 static GlyphString* /*new*/ new_()() nothrow {
1742 return pango_glyph_string_new();
1744 static auto opCall()() {
1745 return pango_glyph_string_new();
1748 // Copy a glyph string and associated storage.
1750 // should be freed with pango_glyph_string_free(),
1751 // or %NULL if @string was %NULL.
1752 // RETURNS: the newly allocated #PangoGlyphString, which
1753 GlyphString* /*new*/ copy()() nothrow {
1754 return pango_glyph_string_copy(&this);
1757 // Compute the logical and ink extents of a glyph string. See the documentation
1758 // for pango_font_get_glyph_extents() for details about the interpretation
1759 // of the rectangles.
1760 // <font>: a #PangoFont
1761 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn or %NULL to indicate that the result is not needed.
1762 // <logical_rect>: rectangle used to store the logical extents of the glyph string or %NULL to indicate that the result is not needed.
1763 void extents(AT0, AT1, AT2)(AT0 /*Font*/ font, AT1 /*Rectangle*/ ink_rect, AT2 /*Rectangle*/ logical_rect) nothrow {
1764 pango_glyph_string_extents(&this, UpCast!(Font*)(font), UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
1767 // Computes the extents of a sub-portion of a glyph string. The extents are
1768 // relative to the start of the glyph string range (the origin of their
1769 // coordinate system is at the start of the range, not at the start of the entire
1770 // glyph string).
1771 // <start>: start index
1772 // <end>: end index (the range is the set of bytes with
1773 // <font>: a #PangoFont
1774 // <ink_rect>: rectangle used to store the extents of the glyph string range as drawn or %NULL to indicate that the result is not needed.
1775 // <logical_rect>: rectangle used to store the logical extents of the glyph string range or %NULL to indicate that the result is not needed.
1776 void extents_range(AT0, AT1, AT2)(int start, int end, AT0 /*Font*/ font, AT1 /*Rectangle*/ ink_rect, AT2 /*Rectangle*/ logical_rect) nothrow {
1777 pango_glyph_string_extents_range(&this, start, end, UpCast!(Font*)(font), UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
1779 // Free a glyph string and associated storage.
1780 void free()() nothrow {
1781 pango_glyph_string_free(&this);
1784 // Given a #PangoGlyphString resulting from pango_shape() and the corresponding
1785 // text, determine the screen width corresponding to each character. When
1786 // multiple characters compose a single cluster, the width of the entire
1787 // cluster is divided equally among the characters.
1789 // See also pango_glyph_item_get_logical_widths().
1790 // <text>: the text corresponding to the glyphs
1791 // <length>: the length of @text, in bytes
1792 // <embedding_level>: the embedding level of the string
1793 // <logical_widths>: an array whose length is the number of characters in text (equal to g_utf8_strlen (text, length) unless text has NUL bytes) to be filled in with the resulting character widths.
1794 void get_logical_widths(AT0)(AT0 /*char*/ text, int length, int embedding_level, int* logical_widths) nothrow {
1795 pango_glyph_string_get_logical_widths(&this, toCString!(char*)(text), length, embedding_level, logical_widths);
1798 // VERSION: 1.14
1799 // Computes the logical width of the glyph string as can also be computed
1800 // using pango_glyph_string_extents(). However, since this only computes the
1801 // width, it's much faster. This is in fact only a convenience function that
1802 // computes the sum of geometry.width for each glyph in the @glyphs.
1803 // RETURNS: the logical width of the glyph string.
1804 int get_width()() nothrow {
1805 return pango_glyph_string_get_width(&this);
1808 // Converts from character position to x position. (X position
1809 // is measured from the left edge of the run). Character positions
1810 // are computed by dividing up each cluster into equal portions.
1811 // <text>: the text for the run
1812 // <length>: the number of bytes (not characters) in @text.
1813 // <analysis>: the analysis information return from pango_itemize()
1814 // <index_>: the byte index within @text
1815 // <trailing>: whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character.
1816 // <x_pos>: location to store result
1817 void index_to_x(AT0, AT1)(AT0 /*char*/ text, int length, AT1 /*Analysis*/ analysis, int index_, int trailing, int* x_pos) nothrow {
1818 pango_glyph_string_index_to_x(&this, toCString!(char*)(text), length, UpCast!(Analysis*)(analysis), index_, trailing, x_pos);
1821 // Resize a glyph string to the given length.
1822 // <new_len>: the new length of the string.
1823 void set_size()(int new_len) nothrow {
1824 pango_glyph_string_set_size(&this, new_len);
1827 // Convert from x offset to character position. Character positions
1828 // are computed by dividing up each cluster into equal portions.
1829 // In scripts where positioning within a cluster is not allowed
1830 // (such as Thai), the returned value may not be a valid cursor
1831 // position; the caller must combine the result with the logical
1832 // attributes for the text to compute the valid cursor position.
1833 // <text>: the text for the run
1834 // <length>: the number of bytes (not characters) in text.
1835 // <analysis>: the analysis information return from pango_itemize()
1836 // <x_pos>: the x offset (in Pango units)
1837 // <index_>: location to store calculated byte index within @text
1838 // <trailing>: location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.
1839 void x_to_index(AT0, AT1)(AT0 /*char*/ text, int length, AT1 /*Analysis*/ analysis, int x_pos, int* index_, int* trailing) nothrow {
1840 pango_glyph_string_x_to_index(&this, toCString!(char*)(text), length, UpCast!(Analysis*)(analysis), x_pos, index_, trailing);
1844 struct GlyphVisAttr {
1845 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
1846 uint, "is_cluster_start", 1,
1847 uint, "__dummy32A", 31));
1851 // The #PangoGravity type represents the orientation of glyphs in a segment
1852 // of text. This is useful when rendering vertical text layouts. In
1853 // those situations, the layout is rotated using a non-identity PangoMatrix,
1854 // and then glyph orientation is controlled using #PangoGravity.
1855 // Not every value in this enumeration makes sense for every usage of
1856 // #PangoGravity; for example, %PANGO_GRAVITY_AUTO only can be passed to
1857 // pango_context_set_base_gravity() and can only be returned by
1858 // pango_context_get_base_gravity().
1860 // See also: #PangoGravityHint
1861 enum Gravity /* Version 1.16 */ {
1862 SOUTH = 0,
1863 EAST = 1,
1864 NORTH = 2,
1865 WEST = 3,
1866 AUTO = 4
1869 // The #PangoGravityHint defines how horizontal scripts should behave in a
1870 // vertical context. That is, English excerpt in a vertical paragraph for
1871 // example.
1873 // See #PangoGravity.
1874 enum GravityHint /* Version 1.16 */ {
1875 NATURAL = 0,
1876 STRONG = 1,
1877 LINE = 2
1879 struct Item {
1880 int offset, length, num_chars;
1881 Analysis analysis;
1884 // Creates a new #PangoItem structure initialized to default values.
1886 // be freed with pango_item_free().
1887 // RETURNS: the newly allocated #PangoItem, which should
1888 static Item* /*new*/ new_()() nothrow {
1889 return pango_item_new();
1891 static auto opCall()() {
1892 return pango_item_new();
1895 // Copy an existing #PangoItem structure.
1897 // be freed with pango_item_free(), or %NULL if
1898 // @item was NULL.
1899 // RETURNS: the newly allocated #PangoItem, which should
1900 Item* /*new*/ copy()() nothrow {
1901 return pango_item_copy(&this);
1903 // Free a #PangoItem and all associated memory.
1904 void free()() nothrow {
1905 pango_item_free(&this);
1908 // Modifies @orig to cover only the text after @split_index, and
1909 // returns a new item that covers the text before @split_index that
1910 // used to be in @orig. You can think of @split_index as the length of
1911 // the returned item. @split_index may not be 0, and it may not be
1912 // greater than or equal to the length of @orig (that is, there must
1913 // be at least one byte assigned to each item, you can't create a
1914 // zero-length item). @split_offset is the length of the first item in
1915 // chars, and must be provided because the text used to generate the
1916 // item isn't available, so pango_item_split() can't count the char
1917 // length of the split items itself.
1919 // should be freed with pango_item_free().
1920 // RETURNS: new item representing text before @split_index, which
1921 // <split_index>: byte index of position to split item, relative to the start of the item
1922 // <split_offset>: number of chars between start of @orig and @split_index
1923 Item* /*new*/ split()(int split_index, int split_offset) nothrow {
1924 return pango_item_split(&this, split_index, split_offset);
1928 struct Language {
1930 // Get a string that is representative of the characters needed to
1931 // render a particular language.
1933 // The sample text may be a pangram, but is not necessarily. It is chosen to
1934 // be demonstrative of normal text in the language, as well as exposing font
1935 // feature requirements unique to the language. It is suitable for use
1936 // as sample text in a font selection dialog.
1938 // If @language is %NULL, the default language as found by
1939 // pango_language_get_default() is used.
1941 // If Pango does not have a sample string for @language, the classic
1942 // "The quick brown fox..." is returned. This can be detected by
1943 // comparing the returned pointer value to that returned for (non-existent)
1944 // language code "xx". That is, compare to:
1945 // <informalexample><programlisting>
1946 // pango_language_get_sample_string (pango_language_from_string ("xx"))
1947 // </programlisting></informalexample>
1949 // and should not be freed.
1950 // RETURNS: the sample string. This value is owned by Pango
1951 char* get_sample_string()() nothrow {
1952 return pango_language_get_sample_string(&this);
1955 // VERSION: 1.22
1956 // Determines the scripts used to to write @language.
1957 // If nothing is known about the language tag @language,
1958 // or if @language is %NULL, then %NULL is returned.
1959 // The list of scripts returned starts with the script that the
1960 // language uses most and continues to the one it uses least.
1962 // The value @num_script points at will be set to the number
1963 // of scripts in the returned array (or zero if %NULL is returned).
1965 // Most languages use only one script for writing, but there are
1966 // some that use two (Latin and Cyrillic for example), and a few
1967 // use three (Japanese for example). Applications should not make
1968 // any assumptions on the maximum number of scripts returned
1969 // though, except that it is positive if the return value is not
1970 // %NULL, and it is a small number.
1972 // The pango_language_includes_script() function uses this function
1973 // internally.
1975 // number of entries in the array stored in @num_scripts, or
1976 // %NULL if Pango does not have any information about this
1977 // particular language tag (also the case if @language is %NULL).
1978 // The returned array is owned by Pango and should not be modified
1979 // or freed.
1980 // RETURNS: An array of #PangoScript values, with the
1981 // <num_scripts>: location to return number of scripts, or %NULL
1982 Script* get_scripts()(int* num_scripts) nothrow {
1983 return pango_language_get_scripts(&this, num_scripts);
1986 // VERSION: 1.4
1987 // Determines if @script is one of the scripts used to
1988 // write @language. The returned value is conservative;
1989 // if nothing is known about the language tag @language,
1990 // %TRUE will be returned, since, as far as Pango knows,
1991 // @script might be used to write @language.
1993 // This routine is used in Pango's itemization process when
1994 // determining if a supplied language tag is relevant to
1995 // a particular section of text. It probably is not useful for
1996 // applications in most circumstances.
1998 // This function uses pango_language_get_scripts() internally.
2000 // to write @language or if nothing is known about @language
2001 // (including the case that @language is %NULL),
2002 // %FALSE otherwise.
2003 // RETURNS: %TRUE if @script is one of the scripts used
2004 // <script>: a #PangoScript
2005 int includes_script()(Script script) nothrow {
2006 return pango_language_includes_script(&this, script);
2009 // Checks if a language tag matches one of the elements in a list of
2010 // language ranges. A language tag is considered to match a range
2011 // in the list if the range is '*', the range is exactly the tag,
2012 // or the range is a prefix of the tag, and the character after it
2013 // in the tag is '-'.
2014 // RETURNS: %TRUE if a match was found.
2015 // <range_list>: a list of language ranges, separated by ';', ':', ',', or space characters. Each element must either be '*', or a RFC 3066 language range canonicalized as by pango_language_from_string()
2016 int matches(AT0)(AT0 /*char*/ range_list) nothrow {
2017 return pango_language_matches(&this, toCString!(char*)(range_list));
2020 // Gets the RFC-3066 format string representing the given language tag.
2022 // Pango and should not be freed.
2023 // RETURNS: a string representing the language tag. This is owned by
2024 char* to_string()() nothrow {
2025 return pango_language_to_string(&this);
2028 // Take a RFC-3066 format language tag as a string and convert it to a
2029 // #PangoLanguage pointer that can be efficiently copied (copy the
2030 // pointer) and compared with other language tags (compare the
2031 // pointer.)
2033 // This function first canonicalizes the string by converting it to
2034 // lowercase, mapping '_' to '-', and stripping all characters other
2035 // than letters and '-'.
2037 // Use pango_language_get_default() if you want to get the #PangoLanguage for
2038 // the current locale of the process.
2040 // if @language was %NULL. The returned pointer will be valid
2041 // forever after, and should not be freed.
2042 // RETURNS: an opaque pointer to a #PangoLanguage structure, or %NULL
2043 // <language>: a string representing a language tag, or %NULL
2044 static Language* /*new*/ from_string(AT0)(AT0 /*char*/ language) nothrow {
2045 return pango_language_from_string(toCString!(char*)(language));
2048 // VERSION: 1.16
2049 // Returns the #PangoLanguage for the current locale of the process.
2050 // Note that this can change over the life of an application.
2052 // On Unix systems, this is the return value is derived from
2053 // <literal>setlocale(LC_CTYPE, NULL)</literal>, and the user can
2054 // affect this through the environment variables LC_ALL, LC_CTYPE or
2055 // LANG (checked in that order). The locale string typically is in
2056 // the form lang_COUNTRY, where lang is an ISO-639 language code, and
2057 // COUNTRY is an ISO-3166 country code. For instance, sv_FI for
2058 // Swedish as written in Finland or pt_BR for Portuguese as written in
2059 // Brazil.
2061 // On Windows, the C library does not use any such environment
2062 // variables, and setting them won't affect the behavior of functions
2063 // like ctime(). The user sets the locale through the Regional Options
2064 // in the Control Panel. The C library (in the setlocale() function)
2065 // does not use country and language codes, but country and language
2066 // names spelled out in English.
2067 // However, this function does check the above environment
2068 // variables, and does return a Unix-style locale string based on
2069 // either said environment variables or the thread's current locale.
2071 // Your application should call <literal>setlocale(LC_ALL, "");</literal>
2072 // for the user settings to take effect. Gtk+ does this in its initialization
2073 // functions automatically (by calling gtk_set_locale()).
2074 // See <literal>man setlocale</literal> for more details.
2076 // freed.
2077 // RETURNS: the default language as a #PangoLanguage, must not be
2078 static Language* /*new*/ get_default()() nothrow {
2079 return pango_language_get_default();
2083 struct Layout /* : GObject.Object */ {
2084 alias method_parent this;
2085 alias method_parent super_;
2086 alias method_parent object;
2087 GObject2.Object method_parent;
2090 // Create a new #PangoLayout object with attributes initialized to
2091 // default values for a particular #PangoContext.
2093 // count of one, which should be freed with
2094 // g_object_unref().
2095 // RETURNS: the newly allocated #PangoLayout, with a reference
2096 // <context>: a #PangoContext
2097 static Layout* /*new*/ new_(AT0)(AT0 /*Context*/ context) nothrow {
2098 return pango_layout_new(UpCast!(Context*)(context));
2100 static auto opCall(AT0)(AT0 /*Context*/ context) {
2101 return pango_layout_new(UpCast!(Context*)(context));
2104 // Forces recomputation of any state in the #PangoLayout that
2105 // might depend on the layout's context. This function should
2106 // be called if you make changes to the context subsequent
2107 // to creating the layout.
2108 void context_changed()() nothrow {
2109 pango_layout_context_changed(&this);
2112 // Unintrospectable method: copy() / pango_layout_copy()
2113 // Does a deep copy-by-value of the @src layout. The attribute list,
2114 // tab array, and text from the original layout are all copied by
2115 // value.
2117 // count of one, which should be freed with
2118 // g_object_unref().
2119 // RETURNS: the newly allocated #PangoLayout, with a reference
2120 Layout* copy()() nothrow {
2121 return pango_layout_copy(&this);
2124 // Gets the alignment for the layout: how partial lines are
2125 // positioned within the horizontal space available.
2126 // RETURNS: the alignment.
2127 Alignment get_alignment()() nothrow {
2128 return pango_layout_get_alignment(&this);
2131 // Gets the attribute list for the layout, if any.
2132 // RETURNS: a #PangoAttrList.
2133 AttrList* /*new*/ get_attributes()() nothrow {
2134 return pango_layout_get_attributes(&this);
2137 // VERSION: 1.4
2138 // Gets whether to calculate the bidirectional base direction
2139 // for the layout according to the contents of the layout.
2140 // See pango_layout_set_auto_dir().
2142 // is computed from the layout's contents, %FALSE otherwise.
2143 // RETURNS: %TRUE if the bidirectional base direction
2144 int get_auto_dir()() nothrow {
2145 return pango_layout_get_auto_dir(&this);
2148 // VERSION: 1.22
2149 // Gets the Y position of baseline of the first line in @layout.
2150 // RETURNS: baseline of first line, from top of @layout.
2151 int get_baseline()() nothrow {
2152 return pango_layout_get_baseline(&this);
2155 // Retrieves the #PangoContext used for this layout.
2157 // This does not have an additional refcount added, so if you want to
2158 // keep a copy of this around, you must reference it yourself.
2159 // RETURNS: the #PangoContext for the layout.
2160 Context* get_context()() nothrow {
2161 return pango_layout_get_context(&this);
2164 // Given an index within a layout, determines the positions that of the
2165 // strong and weak cursors if the insertion point is at that
2166 // index. The position of each cursor is stored as a zero-width
2167 // rectangle. The strong cursor location is the location where
2168 // characters of the directionality equal to the base direction of the
2169 // layout are inserted. The weak cursor location is the location
2170 // where characters of the directionality opposite to the base
2171 // direction of the layout are inserted.
2172 // <index_>: the byte index of the cursor
2173 // <strong_pos>: location to store the strong cursor position (may be %NULL)
2174 // <weak_pos>: location to store the weak cursor position (may be %NULL)
2175 void get_cursor_pos(AT0, AT1)(int index_, /*out*/ AT0 /*Rectangle*/ strong_pos, /*out*/ AT1 /*Rectangle*/ weak_pos) nothrow {
2176 pango_layout_get_cursor_pos(&this, index_, UpCast!(Rectangle*)(strong_pos), UpCast!(Rectangle*)(weak_pos));
2179 // VERSION: 1.6
2180 // Gets the type of ellipsization being performed for @layout.
2181 // See pango_layout_set_ellipsize()
2184 // Use pango_layout_is_ellipsized() to query whether any paragraphs
2185 // were actually ellipsized.
2186 // RETURNS: the current ellipsization mode for @layout.
2187 EllipsizeMode get_ellipsize()() nothrow {
2188 return pango_layout_get_ellipsize(&this);
2191 // Computes the logical and ink extents of @layout. Logical extents
2192 // are usually what you want for positioning things. Note that both extents
2193 // may have non-zero x and y. You may want to use those to offset where you
2194 // render the layout. Not doing that is a very typical bug that shows up as
2195 // right-to-left layouts not being correctly positioned in a layout with
2196 // a set width.
2198 // The extents are given in layout coordinates and in Pango units; layout
2199 // coordinates begin at the top left corner of the layout.
2200 // <ink_rect>: rectangle used to store the extents of the layout as drawn or %NULL to indicate that the result is not needed.
2201 // <logical_rect>: rectangle used to store the logical extents of the layout or %NULL to indicate that the result is not needed.
2202 void get_extents(AT0, AT1)(/*out*/ AT0 /*Rectangle*/ ink_rect, /*out*/ AT1 /*Rectangle*/ logical_rect) nothrow {
2203 pango_layout_get_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2206 // VERSION: 1.8
2207 // Gets the font description for the layout, if any.
2209 // or %NULL if the font description from the layout's
2210 // context is inherited. This value is owned by the layout
2211 // and must not be modified or freed.
2212 // RETURNS: a pointer to the layout's font description,
2213 FontDescription* get_font_description()() nothrow {
2214 return pango_layout_get_font_description(&this);
2217 // VERSION: 1.20
2218 // Gets the height of layout used for ellipsization. See
2219 // pango_layout_set_height() for details.
2221 // number of lines if negative.
2222 // RETURNS: the height, in Pango units if positive, or
2223 int get_height()() nothrow {
2224 return pango_layout_get_height(&this);
2227 // Gets the paragraph indent width in Pango units. A negative value
2228 // indicates a hanging indentation.
2229 // RETURNS: the indent in Pango units.
2230 int get_indent()() nothrow {
2231 return pango_layout_get_indent(&this);
2234 // Returns an iterator to iterate over the visual extents of the layout.
2236 // pango_layout_iter_free().
2237 // RETURNS: the new #PangoLayoutIter that should be freed using
2238 LayoutIter* /*new*/ get_iter()() nothrow {
2239 return pango_layout_get_iter(&this);
2242 // Gets whether each complete line should be stretched to fill the entire
2243 // width of the layout.
2244 // RETURNS: the justify.
2245 int get_justify()() nothrow {
2246 return pango_layout_get_justify(&this);
2249 // Retrieves a particular line from a #PangoLayout.
2251 // Use the faster pango_layout_get_line_readonly() if you do not plan
2252 // to modify the contents of the line (glyphs, glyph widths, etc.).
2254 // index is out of range. This layout line can
2255 // be ref'ed and retained, but will become invalid
2256 // if changes are made to the #PangoLayout.
2257 // RETURNS: the requested #PangoLayoutLine, or %NULL if the
2258 // <line>: the index of a line, which must be between 0 and <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.
2259 LayoutLine* /*new*/ get_line()(int line) nothrow {
2260 return pango_layout_get_line(&this, line);
2263 // Retrieves the count of lines for the @layout.
2264 // RETURNS: the line count.
2265 int get_line_count()() nothrow {
2266 return pango_layout_get_line_count(&this);
2269 // VERSION: 1.16
2270 // Retrieves a particular line from a #PangoLayout.
2272 // This is a faster alternative to pango_layout_get_line(),
2273 // but the user is not expected
2274 // to modify the contents of the line (glyphs, glyph widths, etc.).
2276 // index is out of range. This layout line can
2277 // be ref'ed and retained, but will become invalid
2278 // if changes are made to the #PangoLayout.
2279 // No changes should be made to the line.
2280 // RETURNS: the requested #PangoLayoutLine, or %NULL if the
2281 // <line>: the index of a line, which must be between 0 and <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.
2282 LayoutLine* /*new*/ get_line_readonly()(int line) nothrow {
2283 return pango_layout_get_line_readonly(&this, line);
2286 // Returns the lines of the @layout as a list.
2288 // Use the faster pango_layout_get_lines_readonly() if you do not plan
2289 // to modify the contents of the lines (glyphs, glyph widths, etc.).
2291 // the lines in the layout. This points to internal data of the #PangoLayout
2292 // and must be used with care. It will become invalid on any change to the layout's
2293 // text or properties.
2294 // RETURNS: a #GSList containing
2295 GLib2.SList* get_lines()() nothrow {
2296 return pango_layout_get_lines(&this);
2299 // VERSION: 1.16
2300 // Returns the lines of the @layout as a list.
2302 // This is a faster alternative to pango_layout_get_lines(),
2303 // but the user is not expected
2304 // to modify the contents of the lines (glyphs, glyph widths, etc.).
2306 // the lines in the layout. This points to internal data of the #PangoLayout and
2307 // must be used with care. It will become invalid on any change to the layout's
2308 // text or properties. No changes should be made to the lines.
2309 // RETURNS: a #GSList containing
2310 GLib2.SList* get_lines_readonly()() nothrow {
2311 return pango_layout_get_lines_readonly(&this);
2314 // Retrieves an array of logical attributes for each character in
2315 // the @layout.
2316 // <attrs>: location to store a pointer to an array of logical attributes This value must be freed with g_free().
2317 // <n_attrs>: location to store the number of the attributes in the array. (The stored value will be one more than the total number of characters in the layout, since there need to be attributes corresponding to both the position before the first character and the position after the last character.)
2318 void get_log_attrs(AT0)(/*out*/ AT0 /*LogAttr**/ attrs, /*out*/ int* n_attrs) nothrow {
2319 pango_layout_get_log_attrs(&this, UpCast!(LogAttr**)(attrs), n_attrs);
2322 // Computes the logical and ink extents of @layout in device units.
2323 // This function just calls pango_layout_get_extents() followed by
2324 // two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect
2325 // such that the rounded rectangles fully contain the unrounded one (that is,
2326 // passes them as first argument to pango_extents_to_pixels()).
2327 // <ink_rect>: rectangle used to store the extents of the layout as drawn or %NULL to indicate that the result is not needed.
2328 // <logical_rect>: rectangle used to store the logical extents of the layout or %NULL to indicate that the result is not needed.
2329 void get_pixel_extents(AT0, AT1)(/*out*/ AT0 /*Rectangle*/ ink_rect, /*out*/ AT1 /*Rectangle*/ logical_rect) nothrow {
2330 pango_layout_get_pixel_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2333 // Determines the logical width and height of a #PangoLayout
2334 // in device units. (pango_layout_get_size() returns the width
2335 // and height scaled by %PANGO_SCALE.) This
2336 // is simply a convenience function around
2337 // pango_layout_get_pixel_extents().
2338 // <width>: location to store the logical width, or %NULL
2339 // <height>: location to store the logical height, or %NULL
2340 void get_pixel_size()(/*out*/ int* width, /*out*/ int* height) nothrow {
2341 pango_layout_get_pixel_size(&this, width, height);
2344 // Obtains the value set by pango_layout_set_single_paragraph_mode().
2346 // paragraph separator characters, %FALSE otherwise.
2347 // RETURNS: %TRUE if the layout does not break paragraphs at
2348 int get_single_paragraph_mode()() nothrow {
2349 return pango_layout_get_single_paragraph_mode(&this);
2352 // Determines the logical width and height of a #PangoLayout
2353 // in Pango units (device units scaled by %PANGO_SCALE). This
2354 // is simply a convenience function around pango_layout_get_extents().
2355 // <width>: location to store the logical width, or %NULL
2356 // <height>: location to store the logical height, or %NULL
2357 void get_size()(/*out*/ int* width, /*out*/ int* height) nothrow {
2358 pango_layout_get_size(&this, width, height);
2361 // Gets the amount of spacing between the lines of the layout.
2362 // RETURNS: the spacing in Pango units.
2363 int get_spacing()() nothrow {
2364 return pango_layout_get_spacing(&this);
2367 // Gets the current #PangoTabArray used by this layout. If no
2368 // #PangoTabArray has been set, then the default tabs are in use
2369 // and %NULL is returned. Default tabs are every 8 spaces.
2370 // The return value should be freed with pango_tab_array_free().
2371 // RETURNS: a copy of the tabs for this layout, or %NULL.
2372 TabArray* /*new*/ get_tabs()() nothrow {
2373 return pango_layout_get_tabs(&this);
2376 // Gets the text in the layout. The returned text should not
2377 // be freed or modified.
2378 // RETURNS: the text in the @layout.
2379 char* get_text()() nothrow {
2380 return pango_layout_get_text(&this);
2383 // VERSION: 1.16
2384 // Counts the number unknown glyphs in @layout. That is, zero if
2385 // glyphs for all characters in the layout text were found, or more
2386 // than zero otherwise.
2388 // This function can be used to determine if there are any fonts
2389 // available to render all characters in a certain string, or when
2390 // used in combination with %PANGO_ATTR_FALLBACK, to check if a
2391 // certain font supports all the characters in the string.
2392 // RETURNS: The number of unknown glyphs in @layout.
2393 int get_unknown_glyphs_count()() nothrow {
2394 return pango_layout_get_unknown_glyphs_count(&this);
2397 // Gets the width to which the lines of the #PangoLayout should wrap.
2398 // RETURNS: the width in Pango units, or -1 if no width set.
2399 int get_width()() nothrow {
2400 return pango_layout_get_width(&this);
2403 // Gets the wrap mode for the layout.
2405 // Use pango_layout_is_wrapped() to query whether any paragraphs
2406 // were actually wrapped.
2407 // RETURNS: active wrap mode.
2408 WrapMode get_wrap()() nothrow {
2409 return pango_layout_get_wrap(&this);
2412 // Converts from byte @index_ within the @layout to line and X position.
2413 // (X position is measured from the left edge of the line)
2414 // <index_>: the byte index of a grapheme within the layout.
2415 // <trailing>: an integer indicating the edge of the grapheme to retrieve the position of. If 0, the trailing edge of the grapheme, if > 0, the leading of the grapheme.
2416 // <line>: location to store resulting line index. (which will between 0 and pango_layout_get_line_count(layout) - 1)
2417 void index_to_line_x()(int index_, int trailing, /*out*/ int* line, int* x_pos) nothrow {
2418 pango_layout_index_to_line_x(&this, index_, trailing, line, x_pos);
2421 // Converts from an index within a #PangoLayout to the onscreen position
2422 // corresponding to the grapheme at that index, which is represented
2423 // as rectangle. Note that <literal>pos->x</literal> is always the leading
2424 // edge of the grapheme and <literal>pos->x + pos->width</literal> the trailing
2425 // edge of the grapheme. If the directionality of the grapheme is right-to-left,
2426 // then <literal>pos->width</literal> will be negative.
2427 // <index_>: byte index within @layout
2428 // <pos>: rectangle in which to store the position of the grapheme
2429 void index_to_pos(AT0)(int index_, /*out*/ AT0 /*Rectangle*/ pos) nothrow {
2430 pango_layout_index_to_pos(&this, index_, UpCast!(Rectangle*)(pos));
2433 // VERSION: 1.16
2434 // Queries whether the layout had to ellipsize any paragraphs.
2436 // This returns %TRUE if the ellipsization mode for @layout
2437 // is not %PANGO_ELLIPSIZE_NONE, a positive width is set on @layout,
2438 // and there are paragraphs exceeding that width that have to be
2439 // ellipsized.
2441 // otherwise.
2442 // RETURNS: %TRUE if any paragraphs had to be ellipsized, %FALSE
2443 int is_ellipsized()() nothrow {
2444 return pango_layout_is_ellipsized(&this);
2447 // VERSION: 1.16
2448 // Queries whether the layout had to wrap any paragraphs.
2450 // This returns %TRUE if a positive width is set on @layout,
2451 // ellipsization mode of @layout is set to %PANGO_ELLIPSIZE_NONE,
2452 // and there are paragraphs exceeding the layout width that have
2453 // to be wrapped.
2455 // otherwise.
2456 // RETURNS: %TRUE if any paragraphs had to be wrapped, %FALSE
2457 int is_wrapped()() nothrow {
2458 return pango_layout_is_wrapped(&this);
2461 // Computes a new cursor position from an old position and
2462 // a count of positions to move visually. If @direction is positive,
2463 // then the new strong cursor position will be one position
2464 // to the right of the old cursor position. If @direction is negative,
2465 // then the new strong cursor position will be one position
2466 // to the left of the old cursor position.
2468 // In the presence of bidirectional text, the correspondence
2469 // between logical and visual order will depend on the direction
2470 // of the current run, and there may be jumps when the cursor
2471 // is moved off of the end of a run.
2473 // Motion here is in cursor positions, not in characters, so a
2474 // single call to pango_layout_move_cursor_visually() may move the
2475 // cursor over multiple characters when multiple characters combine
2476 // to form a single grapheme.
2477 // <strong>: whether the moving cursor is the strong cursor or the weak cursor. The strong cursor is the cursor corresponding to text insertion in the base direction for the layout.
2478 // <old_index>: the byte index of the grapheme for the old index
2479 // <old_trailing>: if 0, the cursor was at the trailing edge of the grapheme indicated by @old_index, if > 0, the cursor was at the leading edge.
2480 // <direction>: direction to move cursor. A negative value indicates motion to the left.
2481 // <new_index>: location to store the new cursor byte index. A value of -1 indicates that the cursor has been moved off the beginning of the layout. A value of %G_MAXINT indicates that the cursor has been moved off the end of the layout.
2482 // <new_trailing>: number of characters to move forward from the location returned for @new_index to get the position where the cursor should be displayed. This allows distinguishing the position at the beginning of one line from the position at the end of the preceding line. @new_index is always on the line where the cursor should be displayed.
2483 void move_cursor_visually()(int strong, int old_index, int old_trailing, int direction, /*out*/ int* new_index, int* new_trailing) nothrow {
2484 pango_layout_move_cursor_visually(&this, strong, old_index, old_trailing, direction, new_index, new_trailing);
2487 // Sets the alignment for the layout: how partial lines are
2488 // positioned within the horizontal space available.
2489 // <alignment>: the alignment
2490 void set_alignment()(Alignment alignment) nothrow {
2491 pango_layout_set_alignment(&this, alignment);
2494 // Sets the text attributes for a layout object.
2495 // References @attrs, so the caller can unref its reference.
2496 // <attrs>: a #PangoAttrList, can be %NULL
2497 void set_attributes(AT0)(AT0 /*AttrList*/ attrs) nothrow {
2498 pango_layout_set_attributes(&this, UpCast!(AttrList*)(attrs));
2501 // VERSION: 1.4
2502 // Sets whether to calculate the bidirectional base direction
2503 // for the layout according to the contents of the layout;
2504 // when this flag is on (the default), then paragraphs in
2505 // (Arabic and Hebrew principally), will have right-to-left
2506 // layout, paragraphs with letters from other scripts will
2507 // have left-to-right layout. Paragraphs with only neutral
2508 // characters get their direction from the surrounding paragraphs.
2510 // When %FALSE, the choice between left-to-right and
2511 // right-to-left layout is done according to the base direction
2512 // of the layout's #PangoContext. (See pango_context_set_base_dir()).
2514 // When the auto-computed direction of a paragraph differs from the
2515 // base direction of the context, the interpretation of
2516 // %PANGO_ALIGN_LEFT and %PANGO_ALIGN_RIGHT are swapped.
2517 // <auto_dir>: if %TRUE, compute the bidirectional base direction from the layout's contents.
2518 void set_auto_dir()(int auto_dir) nothrow {
2519 pango_layout_set_auto_dir(&this, auto_dir);
2522 // VERSION: 1.6
2523 // Sets the type of ellipsization being performed for @layout.
2524 // Depending on the ellipsization mode @ellipsize text is
2525 // removed from the start, middle, or end of text so they
2526 // fit within the width and height of layout set with
2527 // pango_layout_set_width() and pango_layout_set_height().
2529 // If the layout contains characters such as newlines that
2530 // force it to be layed out in multiple paragraphs, then whether
2531 // each paragraph is ellipsized separately or the entire layout
2532 // is ellipsized as a whole depends on the set height of the layout.
2533 // See pango_layout_set_height() for details.
2534 // <ellipsize>: the new ellipsization mode for @layout
2535 void set_ellipsize()(EllipsizeMode ellipsize) nothrow {
2536 pango_layout_set_ellipsize(&this, ellipsize);
2539 // Sets the default font description for the layout. If no font
2540 // description is set on the layout, the font description from
2541 // the layout's context is used.
2542 // <desc>: the new #PangoFontDescription, or %NULL to unset the current font description
2543 void set_font_description(AT0)(AT0 /*FontDescription*/ desc) nothrow {
2544 pango_layout_set_font_description(&this, UpCast!(FontDescription*)(desc));
2547 // VERSION: 1.20
2548 // Sets the height to which the #PangoLayout should be ellipsized at. There
2549 // are two different behaviors, based on whether @height is positive or
2550 // negative.
2552 // If @height is positive, it will be the maximum height of the layout. Only
2553 // lines would be shown that would fit, and if there is any text omitted,
2554 // an ellipsis added. At least one line is included in each paragraph regardless
2555 // of how small the height value is. A value of zero will render exactly one
2556 // line for the entire layout.
2558 // If @height is negative, it will be the (negative of) maximum number of lines per
2559 // paragraph. That is, the total number of lines shown may well be more than
2560 // this value if the layout contains multiple paragraphs of text.
2561 // The default value of -1 means that first line of each paragraph is ellipsized.
2562 // This behvaior may be changed in the future to act per layout instead of per
2563 // paragraph. File a bug against pango at <ulink
2564 // url="http://bugzilla.gnome.org/">http://bugzilla.gnome.org/</ulink> if your
2565 // code relies on this behavior.
2567 // Height setting only has effect if a positive width is set on
2568 // @layout and ellipsization mode of @layout is not %PANGO_ELLIPSIZE_NONE.
2569 // The behavior is undefined if a height other than -1 is set and
2570 // ellipsization mode is set to %PANGO_ELLIPSIZE_NONE, and may change in the
2571 // future.
2572 // <height>: the desired height of the layout in Pango units if positive, or desired number of lines if negative.
2573 void set_height()(int height) nothrow {
2574 pango_layout_set_height(&this, height);
2577 // Sets the width in Pango units to indent each paragraph. A negative value
2578 // of @indent will produce a hanging indentation. That is, the first line will
2579 // have the full width, and subsequent lines will be indented by the
2580 // absolute value of @indent.
2582 // The indent setting is ignored if layout alignment is set to
2583 // %PANGO_ALIGN_CENTER.
2584 // <indent>: the amount by which to indent.
2585 void set_indent()(int indent) nothrow {
2586 pango_layout_set_indent(&this, indent);
2589 // Sets whether each complete line should be stretched to
2590 // fill the entire width of the layout. This stretching is typically
2591 // done by adding whitespace, but for some scripts (such as Arabic),
2592 // the justification may be done in more complex ways, like extending
2593 // the characters.
2595 // Note that this setting is not implemented and so is ignored in Pango
2596 // older than 1.18.
2597 // <justify>: whether the lines in the layout should be justified.
2598 void set_justify()(int justify) nothrow {
2599 pango_layout_set_justify(&this, justify);
2602 // Same as pango_layout_set_markup_with_accel(), but
2603 // the markup text isn't scanned for accelerators.
2604 // <markup>: marked-up text
2605 // <length>: length of marked-up text in bytes, or -1 if @markup is nul-terminated
2606 void set_markup(AT0)(AT0 /*char*/ markup, int length) nothrow {
2607 pango_layout_set_markup(&this, toCString!(char*)(markup), length);
2610 // Sets the layout text and attribute list from marked-up text (see
2611 // <link linkend="PangoMarkupFormat">markup format</link>). Replaces
2612 // the current text and attribute list.
2614 // If @accel_marker is nonzero, the given character will mark the
2615 // character following it as an accelerator. For example, @accel_marker
2616 // might be an ampersand or underscore. All characters marked
2617 // as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
2618 // and the first character so marked will be returned in @accel_char.
2619 // Two @accel_marker characters following each other produce a single
2620 // literal @accel_marker character.
2621 // <markup>: marked-up text (see <link linkend="PangoMarkupFormat">markup format</link>)
2622 // <length>: length of marked-up text in bytes, or -1 if @markup is nul-terminated
2623 // <accel_marker>: marker for accelerators in the text
2624 // <accel_char>: return location for first located accelerator, or %NULL
2625 void set_markup_with_accel(AT0, AT1)(AT0 /*char*/ markup, int length, dchar accel_marker, AT1 /*dchar*/ accel_char) nothrow {
2626 pango_layout_set_markup_with_accel(&this, toCString!(char*)(markup), length, accel_marker, UpCast!(dchar*)(accel_char));
2629 // If @setting is %TRUE, do not treat newlines and similar characters
2630 // as paragraph separators; instead, keep all text in a single paragraph,
2631 // and display a glyph for paragraph separator characters. Used when
2632 // you want to allow editing of newlines on a single text line.
2633 // <setting>: new setting
2634 void set_single_paragraph_mode()(int setting) nothrow {
2635 pango_layout_set_single_paragraph_mode(&this, setting);
2638 // Sets the amount of spacing in Pango unit between the lines of the
2639 // layout.
2640 // <spacing>: the amount of spacing
2641 void set_spacing()(int spacing) nothrow {
2642 pango_layout_set_spacing(&this, spacing);
2645 // Sets the tabs to use for @layout, overriding the default tabs
2646 // (by default, tabs are every 8 spaces). If @tabs is %NULL, the default
2647 // tabs are reinstated. @tabs is copied into the layout; you must
2648 // free your copy of @tabs yourself.
2649 // <tabs>: a #PangoTabArray, or %NULL
2650 void set_tabs(AT0)(AT0 /*TabArray*/ tabs) nothrow {
2651 pango_layout_set_tabs(&this, UpCast!(TabArray*)(tabs));
2654 // Sets the text of the layout.
2656 // Note that if you have used
2657 // pango_layout_set_markup() or pango_layout_set_markup_with_accel() on
2658 // @layout before, you may want to call pango_layout_set_attributes() to clear
2659 // the attributes set on the layout from the markup as this function does not
2660 // clear attributes.
2661 // <text>: a valid UTF-8 string
2662 // <length>: maximum length of @text, in bytes. -1 indicates that the string is nul-terminated and the length should be calculated. The text will also be truncated on encountering a nul-termination even when @length is positive.
2663 void set_text(AT0)(AT0 /*char*/ text, int length) nothrow {
2664 pango_layout_set_text(&this, toCString!(char*)(text), length);
2667 // Sets the width to which the lines of the #PangoLayout should wrap or
2668 // ellipsized. The default value is -1: no width set.
2669 // <width>: the desired width in Pango units, or -1 to indicate that no wrapping or ellipsization should be performed.
2670 void set_width()(int width) nothrow {
2671 pango_layout_set_width(&this, width);
2674 // Sets the wrap mode; the wrap mode only has effect if a width
2675 // is set on the layout with pango_layout_set_width().
2676 // To turn off wrapping, set the width to -1.
2677 // <wrap>: the wrap mode
2678 void set_wrap()(WrapMode wrap) nothrow {
2679 pango_layout_set_wrap(&this, wrap);
2682 // Converts from X and Y position within a layout to the byte
2683 // index to the character at that logical position. If the
2684 // Y position is not inside the layout, the closest position is chosen
2685 // (the position will be clamped inside the layout). If the
2686 // X position is not within the layout, then the start or the
2687 // end of the line is chosen as described for pango_layout_x_to_index().
2688 // If either the X or Y positions were not inside the layout, then the
2689 // function returns %FALSE; on an exact hit, it returns %TRUE.
2690 // RETURNS: %TRUE if the coordinates were inside text, %FALSE otherwise.
2691 // <x>: the X offset (in Pango units) from the left edge of the layout.
2692 // <y>: the Y offset (in Pango units) from the top edge of the layout
2693 // <index_>: location to store calculated byte index
2694 // <trailing>: location to store a integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme.
2695 int xy_to_index()(int x, int y, /*out*/ int* index_, /*out*/ int* trailing) nothrow {
2696 return pango_layout_xy_to_index(&this, x, y, index_, trailing);
2700 struct LayoutClass {
2703 struct LayoutIter {
2705 // Determines whether @iter is on the last line of the layout.
2706 // RETURNS: %TRUE if @iter is on the last line.
2707 int at_last_line()() nothrow {
2708 return pango_layout_iter_at_last_line(&this);
2711 // VERSION: 1.20
2712 // Copies a #PangLayoutIter.
2714 // be freed with pango_layout_iter_free(), or %NULL if
2715 // @iter was %NULL.
2716 // RETURNS: the newly allocated #PangoLayoutIter, which should
2717 LayoutIter* /*new*/ copy()() nothrow {
2718 return pango_layout_iter_copy(&this);
2720 // Frees an iterator that's no longer in use.
2721 void free()() nothrow {
2722 pango_layout_iter_free(&this);
2725 // Gets the Y position of the current line's baseline, in layout
2726 // coordinates (origin at top left of the entire layout).
2727 // RETURNS: baseline of current line.
2728 int get_baseline()() nothrow {
2729 return pango_layout_iter_get_baseline(&this);
2732 // Gets the extents of the current character, in layout coordinates
2733 // (origin is the top left of the entire layout). Only logical extents
2734 // can sensibly be obtained for characters; ink extents make sense only
2735 // down to the level of clusters.
2736 // <logical_rect>: rectangle to fill with logical extents
2737 void get_char_extents(AT0)(AT0 /*Rectangle*/ logical_rect) nothrow {
2738 pango_layout_iter_get_char_extents(&this, UpCast!(Rectangle*)(logical_rect));
2741 // Gets the extents of the current cluster, in layout coordinates
2742 // (origin is the top left of the entire layout).
2743 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2744 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2745 void get_cluster_extents(AT0, AT1)(AT0 /*Rectangle*/ ink_rect, AT1 /*Rectangle*/ logical_rect) nothrow {
2746 pango_layout_iter_get_cluster_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2749 // Gets the current byte index. Note that iterating forward by char
2750 // moves in visual order, not logical order, so indexes may not be
2751 // sequential. Also, the index may be equal to the length of the text
2752 // in the layout, if on the %NULL run (see pango_layout_iter_get_run()).
2753 // RETURNS: current byte index.
2754 int get_index()() nothrow {
2755 return pango_layout_iter_get_index(&this);
2758 // Unintrospectable method: get_layout() / pango_layout_iter_get_layout()
2759 // VERSION: 1.20
2760 // Gets the layout associated with a #PangoLayoutIter.
2761 // RETURNS: the layout associated with @iter.
2762 Layout* get_layout()() nothrow {
2763 return pango_layout_iter_get_layout(&this);
2766 // Obtains the extents of the #PangoLayout being iterated
2767 // over. @ink_rect or @logical_rect can be %NULL if you
2768 // aren't interested in them.
2769 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2770 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2771 void get_layout_extents(AT0, AT1)(AT0 /*Rectangle*/ ink_rect, AT1 /*Rectangle*/ logical_rect) nothrow {
2772 pango_layout_iter_get_layout_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2775 // Gets the current line.
2777 // Use the faster pango_layout_iter_get_line_readonly() if you do not plan
2778 // to modify the contents of the line (glyphs, glyph widths, etc.).
2779 // RETURNS: the current line.
2780 LayoutLine* /*new*/ get_line()() nothrow {
2781 return pango_layout_iter_get_line(&this);
2784 // Obtains the extents of the current line. @ink_rect or @logical_rect
2785 // can be %NULL if you aren't interested in them. Extents are in layout
2786 // coordinates (origin is the top-left corner of the entire
2787 // #PangoLayout). Thus the extents returned by this function will be
2788 // the same width/height but not at the same x/y as the extents
2789 // returned from pango_layout_line_get_extents().
2790 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2791 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2792 void get_line_extents(AT0, AT1)(AT0 /*Rectangle*/ ink_rect, AT1 /*Rectangle*/ logical_rect) nothrow {
2793 pango_layout_iter_get_line_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2796 // VERSION: 1.16
2797 // Gets the current line for read-only access.
2799 // This is a faster alternative to pango_layout_iter_get_line(),
2800 // but the user is not expected
2801 // to modify the contents of the line (glyphs, glyph widths, etc.).
2802 // RETURNS: the current line, that should not be modified.
2803 LayoutLine* /*new*/ get_line_readonly()() nothrow {
2804 return pango_layout_iter_get_line_readonly(&this);
2807 // Divides the vertical space in the #PangoLayout being iterated over
2808 // between the lines in the layout, and returns the space belonging to
2809 // the current line. A line's range includes the line's logical
2810 // extents, plus half of the spacing above and below the line, if
2811 // pango_layout_set_spacing() has been called to set layout spacing.
2812 // The Y positions are in layout coordinates (origin at top left of the
2813 // entire layout).
2814 // <y0_>: start of line
2815 // <y1_>: end of line
2816 void get_line_yrange()(int* y0_, int* y1_) nothrow {
2817 pango_layout_iter_get_line_yrange(&this, y0_, y1_);
2820 // Unintrospectable method: get_run() / pango_layout_iter_get_run()
2821 // Gets the current run. When iterating by run, at the end of each
2822 // line, there's a position with a %NULL run, so this function can return
2823 // %NULL. The %NULL run at the end of each line ensures that all lines have
2824 // at least one run, even lines consisting of only a newline.
2826 // Use the faster pango_layout_iter_get_run_readonly() if you do not plan
2827 // to modify the contents of the run (glyphs, glyph widths, etc.).
2828 // RETURNS: the current run.
2829 LayoutRun* get_run()() nothrow {
2830 return pango_layout_iter_get_run(&this);
2833 // Gets the extents of the current run in layout coordinates
2834 // (origin is the top left of the entire layout).
2835 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2836 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2837 void get_run_extents(AT0, AT1)(AT0 /*Rectangle*/ ink_rect, AT1 /*Rectangle*/ logical_rect) nothrow {
2838 pango_layout_iter_get_run_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2841 // Unintrospectable method: get_run_readonly() / pango_layout_iter_get_run_readonly()
2842 // VERSION: 1.16
2843 // Gets the current run. When iterating by run, at the end of each
2844 // line, there's a position with a %NULL run, so this function can return
2845 // %NULL. The %NULL run at the end of each line ensures that all lines have
2846 // at least one run, even lines consisting of only a newline.
2848 // This is a faster alternative to pango_layout_iter_get_run(),
2849 // but the user is not expected
2850 // to modify the contents of the run (glyphs, glyph widths, etc.).
2851 // RETURNS: the current run, that should not be modified.
2852 LayoutRun* get_run_readonly()() nothrow {
2853 return pango_layout_iter_get_run_readonly(&this);
2856 // Moves @iter forward to the next character in visual order. If @iter was already at
2857 // the end of the layout, returns %FALSE.
2858 // RETURNS: whether motion was possible.
2859 int next_char()() nothrow {
2860 return pango_layout_iter_next_char(&this);
2863 // Moves @iter forward to the next cluster in visual order. If @iter
2864 // was already at the end of the layout, returns %FALSE.
2865 // RETURNS: whether motion was possible.
2866 int next_cluster()() nothrow {
2867 return pango_layout_iter_next_cluster(&this);
2870 // Moves @iter forward to the start of the next line. If @iter is
2871 // already on the last line, returns %FALSE.
2872 // RETURNS: whether motion was possible.
2873 int next_line()() nothrow {
2874 return pango_layout_iter_next_line(&this);
2877 // Moves @iter forward to the next run in visual order. If @iter was
2878 // already at the end of the layout, returns %FALSE.
2879 // RETURNS: whether motion was possible.
2880 int next_run()() nothrow {
2881 return pango_layout_iter_next_run(&this);
2885 struct LayoutLine {
2886 Layout* layout;
2887 int start_index, length;
2888 GLib2.SList* runs;
2889 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2890 uint, "is_paragraph_start", 1,
2891 uint, "resolved_dir", 3,
2892 uint, "__dummy32A", 28));
2895 // Computes the logical and ink extents of a layout line. See
2896 // pango_font_get_glyph_extents() for details about the interpretation
2897 // of the rectangles.
2898 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn, or %NULL
2899 // <logical_rect>: rectangle used to store the logical extents of the glyph string, or %NULL
2900 void get_extents(AT0, AT1)(/*out*/ AT0 /*Rectangle*/ ink_rect, /*out*/ AT1 /*Rectangle*/ logical_rect) nothrow {
2901 pango_layout_line_get_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2904 // Computes the logical and ink extents of @layout_line in device units.
2905 // This function just calls pango_layout_line_get_extents() followed by
2906 // two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect
2907 // such that the rounded rectangles fully contain the unrounded one (that is,
2908 // passes them as first argument to pango_extents_to_pixels()).
2909 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn, or %NULL
2910 // <logical_rect>: rectangle used to store the logical extents of the glyph string, or %NULL
2911 void get_pixel_extents(AT0, AT1)(/*out*/ AT0 /*Rectangle*/ ink_rect, /*out*/ AT1 /*Rectangle*/ logical_rect) nothrow {
2912 pango_layout_line_get_pixel_extents(&this, UpCast!(Rectangle*)(ink_rect), UpCast!(Rectangle*)(logical_rect));
2915 // Gets a list of visual ranges corresponding to a given logical range.
2916 // This list is not necessarily minimal - there may be consecutive
2917 // ranges which are adjacent. The ranges will be sorted from left to
2918 // right. The ranges are with respect to the left edge of the entire
2919 // layout, not with respect to the line.
2920 // <start_index>: Start byte index of the logical range. If this value is less than the start index for the line, then the first range will extend all the way to the leading edge of the layout. Otherwise it will start at the leading edge of the first character.
2921 // <end_index>: Ending byte index of the logical range. If this value is greater than the end index for the line, then the last range will extend all the way to the trailing edge of the layout. Otherwise, it will end at the trailing edge of the last character.
2922 // <ranges>: location to store a pointer to an array of ranges. The array will be of length <literal>2*n_ranges</literal>, with each range starting at <literal>(*ranges)[2*n]</literal> and of width <literal>(*ranges)[2*n + 1] - (*ranges)[2*n]</literal>. This array must be freed with g_free(). The coordinates are relative to the layout and are in Pango units.
2923 // <n_ranges>: The number of ranges stored in @ranges.
2924 void get_x_ranges()(int start_index, int end_index, /*out*/ int** ranges, /*out*/ int* n_ranges) nothrow {
2925 pango_layout_line_get_x_ranges(&this, start_index, end_index, ranges, n_ranges);
2928 // Converts an index within a line to a X position.
2929 // <index_>: byte offset of a grapheme within the layout
2930 // <trailing>: an integer indicating the edge of the grapheme to retrieve the position of. If > 0, the trailing edge of the grapheme, if 0, the leading of the grapheme.
2931 // <x_pos>: location to store the x_offset (in Pango unit)
2932 void index_to_x()(int index_, int trailing, /*out*/ int* x_pos) nothrow {
2933 pango_layout_line_index_to_x(&this, index_, trailing, x_pos);
2936 // VERSION: 1.10
2937 // Increase the reference count of a #PangoLayoutLine by one.
2938 // RETURNS: the line passed in.
2939 LayoutLine* /*new*/ ref_()() nothrow {
2940 return pango_layout_line_ref(&this);
2943 // Decrease the reference count of a #PangoLayoutLine by one.
2944 // If the result is zero, the line and all associated memory
2945 // will be freed.
2946 void unref()() nothrow {
2947 pango_layout_line_unref(&this);
2950 // Converts from x offset to the byte index of the corresponding
2951 // character within the text of the layout. If @x_pos is outside the line,
2952 // @index_ and @trailing will point to the very first or very last position
2953 // in the line. This determination is based on the resolved direction
2954 // of the paragraph; for example, if the resolved direction is
2955 // right-to-left, then an X position to the right of the line (after it)
2956 // results in 0 being stored in @index_ and @trailing. An X position to the
2957 // left of the line results in @index_ pointing to the (logical) last
2958 // grapheme in the line and @trailing being set to the number of characters
2959 // in that grapheme. The reverse is true for a left-to-right line.
2960 // RETURNS: %FALSE if @x_pos was outside the line, %TRUE if inside
2961 // <x_pos>: the X offset (in Pango units) from the left edge of the line.
2962 // <index_>: location to store calculated byte index for the grapheme in which the user clicked.
2963 // <trailing>: location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the leading edge of the grapheme.
2964 int x_to_index()(int x_pos, /*out*/ int* index_, /*out*/ int* trailing) nothrow {
2965 return pango_layout_line_x_to_index(&this, x_pos, index_, trailing);
2969 struct LogAttr {
2970 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2971 uint, "is_line_break", 1,
2972 uint, "is_mandatory_break", 1,
2973 uint, "is_char_break", 1,
2974 uint, "is_white", 1,
2975 uint, "is_cursor_position", 1,
2976 uint, "is_word_start", 1,
2977 uint, "is_word_end", 1,
2978 uint, "is_sentence_boundary", 1,
2979 uint, "is_sentence_start", 1,
2980 uint, "is_sentence_end", 1,
2981 uint, "backspace_deletes_character", 1,
2982 uint, "is_expandable_space", 1,
2983 uint, "is_word_boundary", 1,
2984 uint, "__dummy32A", 19));
2988 // A structure specifying a transformation between user-space
2989 // coordinates and device coordinates. The transformation
2990 // is given by
2992 // <programlisting>
2993 // x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0;
2994 // y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;
2995 // </programlisting>
2996 struct Matrix /* Version 1.6 */ {
2997 double xx, xy, yx, yy, x0, y0;
3000 // VERSION: 1.6
3001 // Changes the transformation represented by @matrix to be the
3002 // transformation given by first applying transformation
3003 // given by @new_matrix then applying the original transformation.
3004 // <new_matrix>: a #PangoMatrix
3005 void concat(AT0)(AT0 /*Matrix*/ new_matrix) nothrow {
3006 pango_matrix_concat(&this, UpCast!(Matrix*)(new_matrix));
3009 // VERSION: 1.6
3010 // Copies a #PangoMatrix.
3012 // be freed with pango_matrix_free(), or %NULL if
3013 // @matrix was %NULL.
3014 // RETURNS: the newly allocated #PangoMatrix, which should
3015 Matrix* /*new*/ copy()() nothrow {
3016 return pango_matrix_copy(&this);
3019 // VERSION: 1.6
3020 // Free a #PangoMatrix created with pango_matrix_copy().
3021 void free()() nothrow {
3022 pango_matrix_free(&this);
3025 // VERSION: 1.12
3026 // Returns the scale factor of a matrix on the height of the font.
3027 // That is, the scale factor in the direction perpendicular to the
3028 // vector that the X coordinate is mapped to.
3030 // or 1.0 if @matrix is %NULL.
3031 // RETURNS: the scale factor of @matrix on the height of the font,
3032 double get_font_scale_factor()() nothrow {
3033 return pango_matrix_get_font_scale_factor(&this);
3036 // VERSION: 1.6
3037 // Changes the transformation represented by @matrix to be the
3038 // transformation given by first rotating by @degrees degrees
3039 // counter-clockwise then applying the original transformation.
3040 // <degrees>: degrees to rotate counter-clockwise
3041 void rotate()(double degrees) nothrow {
3042 pango_matrix_rotate(&this, degrees);
3045 // VERSION: 1.6
3046 // Changes the transformation represented by @matrix to be the
3047 // transformation given by first scaling by @sx in the X direction
3048 // and @sy in the Y direction then applying the original
3049 // transformation.
3050 // <scale_x>: amount to scale by in X direction
3051 // <scale_y>: amount to scale by in Y direction
3052 void scale()(double scale_x, double scale_y) nothrow {
3053 pango_matrix_scale(&this, scale_x, scale_y);
3056 // VERSION: 1.16
3057 // Transforms the distance vector (@dx,@dy) by @matrix. This is
3058 // similar to pango_matrix_transform_point() except that the translation
3059 // components of the transformation are ignored. The calculation of
3060 // the returned vector is as follows:
3062 // <programlisting>
3063 // dx2 = dx1 * xx + dy1 * xy;
3064 // dy2 = dx1 * yx + dy1 * yy;
3065 // </programlisting>
3067 // Affine transformations are position invariant, so the same vector
3068 // always transforms to the same vector. If (@x1,@y1) transforms
3069 // to (@x2,@y2) then (@x1+@dx1,@y1+@dy1) will transform to
3070 // (@x1+@dx2,@y1+@dy2) for all values of @x1 and @x2.
3071 // <dx>: in/out X component of a distance vector
3072 // <dy>: yn/out Y component of a distance vector
3073 void transform_distance(AT0, AT1)(AT0 /*double*/ dx, AT1 /*double*/ dy) nothrow {
3074 pango_matrix_transform_distance(&this, UpCast!(double*)(dx), UpCast!(double*)(dy));
3077 // VERSION: 1.16
3078 // First transforms the @rect using @matrix, then calculates the bounding box
3079 // of the transformed rectangle. The rectangle should be in device units
3080 // (pixels).
3082 // This function is useful for example when you want to draw a rotated
3083 // @PangoLayout to an image buffer, and want to know how large the image
3084 // should be and how much you should shift the layout when rendering.
3086 // For better accuracy, you should use pango_matrix_transform_rectangle() on
3087 // original rectangle in Pango units and convert to pixels afterward
3088 // using pango_extents_to_pixels()'s first argument.
3089 // <rect>: in/out bounding box in device units, or %NULL
3090 void transform_pixel_rectangle(AT0)(AT0 /*Rectangle*/ rect) nothrow {
3091 pango_matrix_transform_pixel_rectangle(&this, UpCast!(Rectangle*)(rect));
3094 // VERSION: 1.16
3095 // Transforms the point (@x, @y) by @matrix.
3096 // <x>: in/out X position
3097 // <y>: in/out Y position
3098 void transform_point(AT0, AT1)(AT0 /*double*/ x, AT1 /*double*/ y) nothrow {
3099 pango_matrix_transform_point(&this, UpCast!(double*)(x), UpCast!(double*)(y));
3102 // VERSION: 1.16
3103 // First transforms @rect using @matrix, then calculates the bounding box
3104 // of the transformed rectangle. The rectangle should be in Pango units.
3106 // This function is useful for example when you want to draw a rotated
3107 // @PangoLayout to an image buffer, and want to know how large the image
3108 // should be and how much you should shift the layout when rendering.
3110 // If you have a rectangle in device units (pixels), use
3111 // pango_matrix_transform_pixel_rectangle().
3113 // If you have the rectangle in Pango units and want to convert to
3114 // transformed pixel bounding box, it is more accurate to transform it first
3115 // (using this function) and pass the result to pango_extents_to_pixels(),
3116 // first argument, for an inclusive rounded rectangle.
3117 // However, there are valid reasons that you may want to convert
3118 // to pixels first and then transform, for example when the transformed
3119 // coordinates may overflow in Pango units (large matrix translation for
3120 // example).
3121 // <rect>: in/out bounding box in Pango units, or %NULL
3122 void transform_rectangle(AT0)(AT0 /*Rectangle*/ rect) nothrow {
3123 pango_matrix_transform_rectangle(&this, UpCast!(Rectangle*)(rect));
3126 // VERSION: 1.6
3127 // Changes the transformation represented by @matrix to be the
3128 // transformation given by first translating by (@tx, @ty)
3129 // then applying the original transformation.
3130 // <tx>: amount to translate in the X direction
3131 // <ty>: amount to translate in the Y direction
3132 void translate()(double tx, double ty) nothrow {
3133 pango_matrix_translate(&this, tx, ty);
3137 enum RENDER_TYPE_NONE = "PangoRenderNone";
3138 struct Rectangle {
3139 int x, y, width, height;
3143 // #PangoRenderPart defines different items to render for such
3144 // purposes as setting colors.
3145 enum RenderPart /* Version 1.8 */ {
3146 FOREGROUND = 0,
3147 BACKGROUND = 1,
3148 UNDERLINE = 2,
3149 STRIKETHROUGH = 3
3152 // #PangoRenderer is a base class for objects that are used to
3153 // render Pango objects such as #PangoGlyphString and
3154 // #PangoLayout.
3155 struct Renderer /* : GObject.Object */ /* Version 1.8 */ {
3156 alias parent_instance this;
3157 alias parent_instance super_;
3158 alias parent_instance object;
3159 GObject2.Object parent_instance;
3160 private Underline underline;
3161 private int strikethrough;
3162 private int active_count;
3163 Matrix* matrix;
3164 private RendererPrivate* priv;
3167 // VERSION: 1.8
3168 // Does initial setup before rendering operations on @renderer.
3169 // pango_renderer_deactivate() should be called when done drawing.
3170 // Calls such as pango_renderer_draw_layout() automatically
3171 // activate the layout before drawing on it. Calls to
3172 // pango_renderer_activate() and pango_renderer_deactivate() can
3173 // be nested and the renderer will only be initialized and
3174 // deinitialized once.
3175 void activate()() nothrow {
3176 pango_renderer_activate(&this);
3179 // VERSION: 1.8
3180 // Cleans up after rendering operations on @renderer. See
3181 // docs for pango_renderer_activate().
3182 void deactivate()() nothrow {
3183 pango_renderer_deactivate(&this);
3186 // VERSION: 1.8
3187 // Draw a squiggly line that approximately covers the given rectangle
3188 // in the style of an underline used to indicate a spelling error.
3189 // (The width of the underline is rounded to an integer number
3190 // of up/down segments and the resulting rectangle is centered
3191 // in the original rectangle)
3193 // This should be called while @renderer is already active. Use
3194 // pango_renderer_activate() to activate a renderer.
3195 // <x>: X coordinate of underline, in Pango units in user coordinate system
3196 // <y>: Y coordinate of underline, in Pango units in user coordinate system
3197 // <width>: width of underline, in Pango units in user coordinate system
3198 // <height>: height of underline, in Pango units in user coordinate system
3199 void draw_error_underline()(int x, int y, int width, int height) nothrow {
3200 pango_renderer_draw_error_underline(&this, x, y, width, height);
3203 // VERSION: 1.8
3204 // Draws a single glyph with coordinates in device space.
3205 // <font>: a #PangoFont
3206 // <glyph>: the glyph index of a single glyph
3207 // <x>: X coordinate of left edge of baseline of glyph
3208 // <y>: Y coordinate of left edge of baseline of glyph
3209 void draw_glyph(AT0)(AT0 /*Font*/ font, Glyph glyph, double x, double y) nothrow {
3210 pango_renderer_draw_glyph(&this, UpCast!(Font*)(font), glyph, x, y);
3213 // VERSION: 1.22
3214 // Draws the glyphs in @glyph_item with the specified #PangoRenderer,
3215 // embedding the text associated with the glyphs in the output if the
3216 // output format supports it (PDF for example).
3218 // Note that @text is the start of the text for layout, which is then
3219 // indexed by <literal>@glyph_item->item->offset</literal>.
3221 // If @text is %NULL, this simply calls pango_renderer_draw_glyphs().
3223 // The default implementation of this method simply falls back to
3224 // pango_renderer_draw_glyphs().
3225 // <text>: the UTF-8 text that @glyph_item refers to, or %NULL
3226 // <glyph_item>: a #PangoGlyphItem
3227 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3228 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3229 void draw_glyph_item(AT0, AT1)(AT0 /*char*/ text, AT1 /*GlyphItem*/ glyph_item, int x, int y) nothrow {
3230 pango_renderer_draw_glyph_item(&this, toCString!(char*)(text), UpCast!(GlyphItem*)(glyph_item), x, y);
3233 // VERSION: 1.8
3234 // Draws the glyphs in @glyphs with the specified #PangoRenderer.
3235 // <font>: a #PangoFont
3236 // <glyphs>: a #PangoGlyphString
3237 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3238 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3239 void draw_glyphs(AT0, AT1)(AT0 /*Font*/ font, AT1 /*GlyphString*/ glyphs, int x, int y) nothrow {
3240 pango_renderer_draw_glyphs(&this, UpCast!(Font*)(font), UpCast!(GlyphString*)(glyphs), x, y);
3243 // VERSION: 1.8
3244 // Draws @layout with the specified #PangoRenderer.
3245 // <layout>: a #PangoLayout
3246 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3247 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3248 void draw_layout(AT0)(AT0 /*Layout*/ layout, int x, int y) nothrow {
3249 pango_renderer_draw_layout(&this, UpCast!(Layout*)(layout), x, y);
3252 // VERSION: 1.8
3253 // Draws @line with the specified #PangoRenderer.
3254 // <line>: a #PangoLayoutLine
3255 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3256 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3257 void draw_layout_line(AT0)(AT0 /*LayoutLine*/ line, int x, int y) nothrow {
3258 pango_renderer_draw_layout_line(&this, UpCast!(LayoutLine*)(line), x, y);
3261 // VERSION: 1.8
3262 // Draws an axis-aligned rectangle in user space coordinates with the
3263 // specified #PangoRenderer.
3265 // This should be called while @renderer is already active. Use
3266 // pango_renderer_activate() to activate a renderer.
3267 // <part>: type of object this rectangle is part of
3268 // <x>: X position at which to draw rectangle, in user space coordinates in Pango units
3269 // <y>: Y position at which to draw rectangle, in user space coordinates in Pango units
3270 // <width>: width of rectangle in Pango units in user space coordinates
3271 // <height>: height of rectangle in Pango units in user space coordinates
3272 void draw_rectangle()(RenderPart part, int x, int y, int width, int height) nothrow {
3273 pango_renderer_draw_rectangle(&this, part, x, y, width, height);
3276 // VERSION: 1.8
3277 // Draws a trapezoid with the parallel sides aligned with the X axis
3278 // using the given #PangoRenderer; coordinates are in device space.
3279 // <part>: type of object this trapezoid is part of
3280 // <y1_>: Y coordinate of top of trapezoid
3281 // <x11>: X coordinate of left end of top of trapezoid
3282 // <x21>: X coordinate of right end of top of trapezoid
3283 // <y2>: Y coordinate of bottom of trapezoid
3284 // <x12>: X coordinate of left end of bottom of trapezoid
3285 // <x22>: X coordinate of right end of bottom of trapezoid
3286 void draw_trapezoid()(RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22) nothrow {
3287 pango_renderer_draw_trapezoid(&this, part, y1_, x11, x21, y2, x12, x22);
3290 // VERSION: 1.8
3291 // Gets the current rendering color for the specified part.
3293 // if it hasn't been set and should be inherited from the
3294 // environment.
3295 // RETURNS: the color for the specified part, or %NULL
3296 // <part>: the part to get the color for
3297 Color* /*new*/ get_color()(RenderPart part) nothrow {
3298 return pango_renderer_get_color(&this, part);
3301 // Unintrospectable method: get_layout() / pango_renderer_get_layout()
3302 // VERSION: 1.20
3303 // Gets the layout currently being rendered using @renderer.
3304 // Calling this function only makes sense from inside a subclass's
3305 // methods, like in its draw_shape<!---->() for example.
3307 // The returned layout should not be modified while still being
3308 // rendered.
3310 // rendered using @renderer at this time.
3311 // RETURNS: the layout, or %NULL if no layout is being
3312 Layout* get_layout()() nothrow {
3313 return pango_renderer_get_layout(&this);
3316 // VERSION: 1.20
3317 // Gets the layout line currently being rendered using @renderer.
3318 // Calling this function only makes sense from inside a subclass's
3319 // methods, like in its draw_shape<!---->() for example.
3321 // The returned layout line should not be modified while still being
3322 // rendered.
3324 // rendered using @renderer at this time.
3325 // RETURNS: the layout line, or %NULL if no layout line is being
3326 LayoutLine* /*new*/ get_layout_line()() nothrow {
3327 return pango_renderer_get_layout_line(&this);
3330 // VERSION: 1.8
3331 // Gets the transformation matrix that will be applied when
3332 // rendering. See pango_renderer_set_matrix().
3334 // (which is the same as the identity matrix). The returned
3335 // matrix is owned by Pango and must not be modified or
3336 // freed.
3337 // RETURNS: the matrix, or %NULL if no matrix has been set
3338 Matrix* get_matrix()() nothrow {
3339 return pango_renderer_get_matrix(&this);
3342 // VERSION: 1.8
3343 // Informs Pango that the way that the rendering is done
3344 // for @part has changed in a way that would prevent multiple
3345 // pieces being joined together into one drawing call. For
3346 // instance, if a subclass of #PangoRenderer was to add a stipple
3347 // option for drawing underlines, it needs to call
3349 // <informalexample><programlisting>
3350 // pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);
3351 // </programlisting></informalexample>
3353 // When the stipple changes or underlines with different stipples
3354 // might be joined together. Pango automatically calls this for
3355 // changes to colors. (See pango_renderer_set_color())
3356 // <part>: the part for which rendering has changed.
3357 void part_changed()(RenderPart part) nothrow {
3358 pango_renderer_part_changed(&this, part);
3361 // VERSION: 1.8
3362 // Sets the color for part of the rendering.
3363 // <part>: the part to change the color of
3364 // <color>: the new color or %NULL to unset the current color
3365 void set_color(AT0)(RenderPart part, AT0 /*Color*/ color) nothrow {
3366 pango_renderer_set_color(&this, part, UpCast!(Color*)(color));
3369 // VERSION: 1.8
3370 // Sets the transformation matrix that will be applied when rendering.
3371 // <matrix>: a #PangoMatrix, or %NULL to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)
3372 void set_matrix(AT0)(AT0 /*Matrix*/ matrix) nothrow {
3373 pango_renderer_set_matrix(&this, UpCast!(Matrix*)(matrix));
3377 // Class structure for #PangoRenderer.
3378 struct RendererClass /* Version 1.8 */ {
3379 private GObject2.ObjectClass parent_class;
3381 // <font>: a #PangoFont
3382 // <glyphs>: a #PangoGlyphString
3383 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3384 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3385 extern (C) void function (Renderer* renderer, Font* font, GlyphString* glyphs, int x, int y) nothrow draw_glyphs;
3387 // <part>: type of object this rectangle is part of
3388 // <x>: X position at which to draw rectangle, in user space coordinates in Pango units
3389 // <y>: Y position at which to draw rectangle, in user space coordinates in Pango units
3390 // <width>: width of rectangle in Pango units in user space coordinates
3391 // <height>: height of rectangle in Pango units in user space coordinates
3392 extern (C) void function (Renderer* renderer, RenderPart part, int x, int y, int width, int height) nothrow draw_rectangle;
3394 // <x>: X coordinate of underline, in Pango units in user coordinate system
3395 // <y>: Y coordinate of underline, in Pango units in user coordinate system
3396 // <width>: width of underline, in Pango units in user coordinate system
3397 // <height>: height of underline, in Pango units in user coordinate system
3398 extern (C) void function (Renderer* renderer, int x, int y, int width, int height) nothrow draw_error_underline;
3399 extern (C) void function (Renderer* renderer, AttrShape* attr, int x, int y) nothrow draw_shape;
3401 // <part>: type of object this trapezoid is part of
3402 // <y1_>: Y coordinate of top of trapezoid
3403 // <x11>: X coordinate of left end of top of trapezoid
3404 // <x21>: X coordinate of right end of top of trapezoid
3405 // <y2>: Y coordinate of bottom of trapezoid
3406 // <x12>: X coordinate of left end of bottom of trapezoid
3407 // <x22>: X coordinate of right end of bottom of trapezoid
3408 extern (C) void function (Renderer* renderer, RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22) nothrow draw_trapezoid;
3410 // <font>: a #PangoFont
3411 // <glyph>: the glyph index of a single glyph
3412 // <x>: X coordinate of left edge of baseline of glyph
3413 // <y>: Y coordinate of left edge of baseline of glyph
3414 extern (C) void function (Renderer* renderer, Font* font, Glyph glyph, double x, double y) nothrow draw_glyph;
3415 // <part>: the part for which rendering has changed.
3416 extern (C) void function (Renderer* renderer, RenderPart part) nothrow part_changed;
3417 extern (C) void function (Renderer* renderer) nothrow begin;
3418 extern (C) void function (Renderer* renderer) nothrow end;
3419 extern (C) void function (Renderer* renderer, LayoutRun* run) nothrow prepare_run;
3421 // <text>: the UTF-8 text that @glyph_item refers to, or %NULL
3422 // <glyph_item>: a #PangoGlyphItem
3423 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3424 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3425 extern (C) void function (Renderer* renderer, char* text, GlyphItem* glyph_item, int x, int y) nothrow draw_glyph_item;
3426 extern (C) void function () nothrow _pango_reserved2;
3427 extern (C) void function () nothrow _pango_reserved3;
3428 extern (C) void function () nothrow _pango_reserved4;
3431 struct RendererPrivate {
3434 enum int SCALE = 1024;
3435 enum Script {
3436 INVALID_CODE = -1,
3437 COMMON = 0,
3438 INHERITED = 1,
3439 ARABIC = 2,
3440 ARMENIAN = 3,
3441 BENGALI = 4,
3442 BOPOMOFO = 5,
3443 CHEROKEE = 6,
3444 COPTIC = 7,
3445 CYRILLIC = 8,
3446 DESERET = 9,
3447 DEVANAGARI = 10,
3448 ETHIOPIC = 11,
3449 GEORGIAN = 12,
3450 GOTHIC = 13,
3451 GREEK = 14,
3452 GUJARATI = 15,
3453 GURMUKHI = 16,
3454 HAN = 17,
3455 HANGUL = 18,
3456 HEBREW = 19,
3457 HIRAGANA = 20,
3458 KANNADA = 21,
3459 KATAKANA = 22,
3460 KHMER = 23,
3461 LAO = 24,
3462 LATIN = 25,
3463 MALAYALAM = 26,
3464 MONGOLIAN = 27,
3465 MYANMAR = 28,
3466 OGHAM = 29,
3467 OLD_ITALIC = 30,
3468 ORIYA = 31,
3469 RUNIC = 32,
3470 SINHALA = 33,
3471 SYRIAC = 34,
3472 TAMIL = 35,
3473 TELUGU = 36,
3474 THAANA = 37,
3475 THAI = 38,
3476 TIBETAN = 39,
3477 CANADIAN_ABORIGINAL = 40,
3478 YI = 41,
3479 TAGALOG = 42,
3480 HANUNOO = 43,
3481 BUHID = 44,
3482 TAGBANWA = 45,
3483 BRAILLE = 46,
3484 CYPRIOT = 47,
3485 LIMBU = 48,
3486 OSMANYA = 49,
3487 SHAVIAN = 50,
3488 LINEAR_B = 51,
3489 TAI_LE = 52,
3490 UGARITIC = 53,
3491 NEW_TAI_LUE = 54,
3492 BUGINESE = 55,
3493 GLAGOLITIC = 56,
3494 TIFINAGH = 57,
3495 SYLOTI_NAGRI = 58,
3496 OLD_PERSIAN = 59,
3497 KHAROSHTHI = 60,
3498 UNKNOWN = 61,
3499 BALINESE = 62,
3500 CUNEIFORM = 63,
3501 PHOENICIAN = 64,
3502 PHAGS_PA = 65,
3503 NKO = 66,
3504 KAYAH_LI = 67,
3505 LEPCHA = 68,
3506 REJANG = 69,
3507 SUNDANESE = 70,
3508 SAURASHTRA = 71,
3509 CHAM = 72,
3510 OL_CHIKI = 73,
3511 VAI = 74,
3512 CARIAN = 75,
3513 LYCIAN = 76,
3514 LYDIAN = 77
3517 // A #PangoScriptIter is used to iterate through a string
3518 // and identify ranges in different scripts.
3519 struct ScriptIter {
3521 // VERSION: 1.4
3522 // Frees a #PangoScriptIter created with pango_script_iter_new().
3523 void free()() nothrow {
3524 pango_script_iter_free(&this);
3527 // VERSION: 1.4
3528 // Gets information about the range to which @iter currently points.
3529 // The range is the set of locations p where *start <= p < *end.
3530 // (That is, it doesn't include the character stored at *end)
3531 // <start>: location to store start position of the range, or %NULL
3532 // <end>: location to store end position of the range, or %NULL
3533 // <script>: location to store script for range, or %NULL
3534 void get_range(AT0, AT1, AT2)(AT0 /*char**/ start, AT1 /*char**/ end, AT2 /*Script*/ script) nothrow {
3535 pango_script_iter_get_range(&this, toCString!(char**)(start), toCString!(char**)(end), UpCast!(Script*)(script));
3538 // VERSION: 1.4
3539 // Advances a #PangoScriptIter to the next range. If @iter
3540 // is already at the end, it is left unchanged and %FALSE
3541 // is returned.
3542 // RETURNS: %TRUE if @iter was successfully advanced.
3543 int next()() nothrow {
3544 return pango_script_iter_next(&this);
3547 // Unintrospectable function: new() / pango_script_iter_new()
3548 // VERSION: 1.4
3549 // Create a new #PangoScriptIter, used to break a string of
3550 // Unicode into runs by text. No copy is made of @text, so
3551 // the caller needs to make sure it remains valid until
3552 // the iterator is freed with pango_script_iter_free().
3554 // to point at the first range in the text, which should be
3555 // freed with pango_script_iter_free(). If the string is
3556 // empty, it will point at an empty range.
3557 // RETURNS: the new script iterator, initialized
3558 // <text>: a UTF-8 string
3559 // <length>: length of @text, or -1 if @text is nul-terminated.
3560 static ScriptIter* new_(AT0)(AT0 /*char*/ text, int length) nothrow {
3561 return pango_script_iter_new(toCString!(char*)(text), length);
3565 enum Stretch {
3566 ULTRA_CONDENSED = 0,
3567 EXTRA_CONDENSED = 1,
3568 CONDENSED = 2,
3569 SEMI_CONDENSED = 3,
3570 NORMAL = 4,
3571 SEMI_EXPANDED = 5,
3572 EXPANDED = 6,
3573 EXTRA_EXPANDED = 7,
3574 ULTRA_EXPANDED = 8
3576 // An enumeration specifying the various slant styles possible for a font.
3577 enum Style {
3578 NORMAL = 0,
3579 OBLIQUE = 1,
3580 ITALIC = 2
3582 enum TabAlign {
3583 LEFT = 0
3585 struct TabArray {
3587 // Creates an array of @initial_size tab stops. Tab stops are specified in
3588 // pixel units if @positions_in_pixels is %TRUE, otherwise in Pango
3589 // units. All stops are initially at position 0.
3591 // be freed with pango_tab_array_free().
3592 // RETURNS: the newly allocated #PangoTabArray, which should
3593 // <initial_size>: Initial number of tab stops to allocate, can be 0
3594 // <positions_in_pixels>: whether positions are in pixel units
3595 static TabArray* /*new*/ new_()(int initial_size, int positions_in_pixels) nothrow {
3596 return pango_tab_array_new(initial_size, positions_in_pixels);
3598 static auto opCall()(int initial_size, int positions_in_pixels) {
3599 return pango_tab_array_new(initial_size, positions_in_pixels);
3602 // Unintrospectable constructor: new_with_positions() / pango_tab_array_new_with_positions()
3603 // This is a convenience function that creates a #PangoTabArray
3604 // and allows you to specify the alignment and position of each
3605 // tab stop. You <emphasis>must</emphasis> provide an alignment
3606 // and position for @size tab stops.
3608 // be freed with pango_tab_array_free().
3609 // RETURNS: the newly allocated #PangoTabArray, which should
3610 // <size>: number of tab stops in the array
3611 // <positions_in_pixels>: whether positions are in pixel units
3612 // <first_alignment>: alignment of first tab stop
3613 // <first_position>: position of first tab stop
3614 alias pango_tab_array_new_with_positions new_with_positions; // Variadic
3616 // Copies a #PangoTabArray
3618 // be freed with pango_tab_array_free().
3619 // RETURNS: the newly allocated #PangoTabArray, which should
3620 TabArray* /*new*/ copy()() nothrow {
3621 return pango_tab_array_copy(&this);
3623 // Frees a tab array and associated resources.
3624 void free()() nothrow {
3625 pango_tab_array_free(&this);
3628 // Returns %TRUE if the tab positions are in pixels, %FALSE if they are
3629 // in Pango units.
3630 // RETURNS: whether positions are in pixels.
3631 int get_positions_in_pixels()() nothrow {
3632 return pango_tab_array_get_positions_in_pixels(&this);
3635 // Gets the number of tab stops in @tab_array.
3636 // RETURNS: the number of tab stops in the array.
3637 int get_size()() nothrow {
3638 return pango_tab_array_get_size(&this);
3641 // Gets the alignment and position of a tab stop.
3642 // <tab_index>: tab stop index
3643 // <alignment>: location to store alignment, or %NULL
3644 // <location>: location to store tab position, or %NULL
3645 void get_tab(AT0)(int tab_index, AT0 /*TabAlign*/ alignment, int* location) nothrow {
3646 pango_tab_array_get_tab(&this, tab_index, UpCast!(TabAlign*)(alignment), location);
3649 // If non-%NULL, @alignments and @locations are filled with allocated
3650 // arrays of length pango_tab_array_get_size(). You must free the
3651 // returned array.
3652 // <alignments>: location to store an array of tab stop alignments, or %NULL
3653 // <locations>: location to store an array of tab positions, or %NULL
3654 void get_tabs(AT0)(AT0 /*TabAlign**/ alignments, int** locations) nothrow {
3655 pango_tab_array_get_tabs(&this, UpCast!(TabAlign**)(alignments), locations);
3658 // Resizes a tab array. You must subsequently initialize any tabs that
3659 // were added as a result of growing the array.
3660 // <new_size>: new size of the array
3661 void resize()(int new_size) nothrow {
3662 pango_tab_array_resize(&this, new_size);
3665 // Sets the alignment and location of a tab stop.
3666 // @alignment must always be #PANGO_TAB_LEFT in the current
3667 // implementation.
3668 // <tab_index>: the index of a tab stop
3669 // <alignment>: tab alignment
3670 // <location>: tab location in Pango units
3671 void set_tab()(int tab_index, TabAlign alignment, int location) nothrow {
3672 pango_tab_array_set_tab(&this, tab_index, alignment, location);
3676 enum int UNKNOWN_GLYPH_HEIGHT = 14;
3677 enum int UNKNOWN_GLYPH_WIDTH = 10;
3678 enum Underline {
3679 NONE = 0,
3680 SINGLE = 1,
3681 DOUBLE = 2,
3682 LOW = 3,
3683 ERROR = 4
3685 enum Variant {
3686 NORMAL = 0,
3687 SMALL_CAPS = 1
3689 enum Weight {
3690 THIN = 100,
3691 ULTRALIGHT = 200,
3692 LIGHT = 300,
3693 BOOK = 380,
3694 NORMAL = 400,
3695 MEDIUM = 500,
3696 SEMIBOLD = 600,
3697 BOLD = 700,
3698 ULTRABOLD = 800,
3699 HEAVY = 900,
3700 ULTRAHEAVY = 1000
3702 enum WrapMode {
3703 WORD = 0,
3704 CHAR = 1,
3705 WORD_CHAR = 2
3707 struct _ScriptForLang {
3708 char[7] lang;
3709 Script[3] scripts;
3713 // Unintrospectable function: attr_background_new() / pango_attr_background_new()
3714 // Create a new background color attribute.
3716 // freed with pango_attribute_destroy().
3717 // RETURNS: the newly allocated #PangoAttribute, which should be
3718 // <red>: the red value (ranging from 0 to 65535)
3719 // <green>: the green value
3720 // <blue>: the blue value
3721 static Attribute* attr_background_new()(ushort red, ushort green, ushort blue) nothrow {
3722 return pango_attr_background_new(red, green, blue);
3726 // Unintrospectable function: attr_fallback_new() / pango_attr_fallback_new()
3727 // VERSION: 1.4
3728 // Create a new font fallback attribute.
3730 // If fallback is disabled, characters will only be used from the
3731 // closest matching font on the system. No fallback will be done to
3732 // other fonts on the system that might contain the characters in the
3733 // text.
3735 // freed with pango_attribute_destroy().
3736 // RETURNS: the newly allocated #PangoAttribute, which should be
3737 // <enable_fallback>: %TRUE if we should fall back on other fonts for characters the active font is missing.
3738 static Attribute* attr_fallback_new()(int enable_fallback) nothrow {
3739 return pango_attr_fallback_new(enable_fallback);
3743 // Unintrospectable function: attr_family_new() / pango_attr_family_new()
3744 // Create a new font family attribute.
3746 // freed with pango_attribute_destroy().
3747 // RETURNS: the newly allocated #PangoAttribute, which should be
3748 // <family>: the family or comma separated list of families
3749 static Attribute* attr_family_new(AT0)(AT0 /*char*/ family) nothrow {
3750 return pango_attr_family_new(toCString!(char*)(family));
3754 // Unintrospectable function: attr_foreground_new() / pango_attr_foreground_new()
3755 // Create a new foreground color attribute.
3757 // freed with pango_attribute_destroy().
3758 // RETURNS: the newly allocated #PangoAttribute, which should be
3759 // <red>: the red value (ranging from 0 to 65535)
3760 // <green>: the green value
3761 // <blue>: the blue value
3762 static Attribute* attr_foreground_new()(ushort red, ushort green, ushort blue) nothrow {
3763 return pango_attr_foreground_new(red, green, blue);
3767 // Unintrospectable function: attr_gravity_hint_new() / pango_attr_gravity_hint_new()
3768 // VERSION: 1.16
3769 // Create a new gravity hint attribute.
3771 // freed with pango_attribute_destroy().
3772 // RETURNS: the newly allocated #PangoAttribute, which should be
3773 // <hint>: the gravity hint value.
3774 static Attribute* attr_gravity_hint_new()(GravityHint hint) nothrow {
3775 return pango_attr_gravity_hint_new(hint);
3779 // Unintrospectable function: attr_gravity_new() / pango_attr_gravity_new()
3780 // VERSION: 1.16
3781 // Create a new gravity attribute.
3783 // freed with pango_attribute_destroy().
3784 // RETURNS: the newly allocated #PangoAttribute, which should be
3785 // <gravity>: the gravity value; should not be %PANGO_GRAVITY_AUTO.
3786 static Attribute* attr_gravity_new()(Gravity gravity) nothrow {
3787 return pango_attr_gravity_new(gravity);
3791 // Unintrospectable function: attr_letter_spacing_new() / pango_attr_letter_spacing_new()
3792 // VERSION: 1.6
3793 // Create a new letter-spacing attribute.
3795 // freed with pango_attribute_destroy().
3796 // RETURNS: the newly allocated #PangoAttribute, which should be
3797 // <letter_spacing>: amount of extra space to add between graphemes of the text, in Pango units.
3798 static Attribute* attr_letter_spacing_new()(int letter_spacing) nothrow {
3799 return pango_attr_letter_spacing_new(letter_spacing);
3803 // Unintrospectable function: attr_rise_new() / pango_attr_rise_new()
3804 // Create a new baseline displacement attribute.
3806 // freed with pango_attribute_destroy().
3807 // RETURNS: the newly allocated #PangoAttribute, which should be
3808 // <rise>: the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.
3809 static Attribute* attr_rise_new()(int rise) nothrow {
3810 return pango_attr_rise_new(rise);
3814 // Unintrospectable function: attr_scale_new() / pango_attr_scale_new()
3815 // Create a new font size scale attribute. The base font for the
3816 // affected text will have its size multiplied by @scale_factor.
3818 // freed with pango_attribute_destroy().
3819 // RETURNS: the newly allocated #PangoAttribute, which should be
3820 // <scale_factor>: factor to scale the font
3821 static Attribute* attr_scale_new()(double scale_factor) nothrow {
3822 return pango_attr_scale_new(scale_factor);
3826 // Unintrospectable function: attr_stretch_new() / pango_attr_stretch_new()
3827 // Create a new font stretch attribute
3829 // freed with pango_attribute_destroy().
3830 // RETURNS: the newly allocated #PangoAttribute, which should be
3831 // <stretch>: the stretch
3832 static Attribute* attr_stretch_new()(Stretch stretch) nothrow {
3833 return pango_attr_stretch_new(stretch);
3837 // Unintrospectable function: attr_strikethrough_color_new() / pango_attr_strikethrough_color_new()
3838 // VERSION: 1.8
3839 // Create a new strikethrough color attribute. This attribute
3840 // modifies the color of strikethrough lines. If not set, strikethrough
3841 // lines will use the foreground color.
3843 // freed with pango_attribute_destroy().
3844 // RETURNS: the newly allocated #PangoAttribute, which should be
3845 // <red>: the red value (ranging from 0 to 65535)
3846 // <green>: the green value
3847 // <blue>: the blue value
3848 static Attribute* attr_strikethrough_color_new()(ushort red, ushort green, ushort blue) nothrow {
3849 return pango_attr_strikethrough_color_new(red, green, blue);
3853 // Unintrospectable function: attr_strikethrough_new() / pango_attr_strikethrough_new()
3854 // Create a new strike-through attribute.
3856 // freed with pango_attribute_destroy().
3857 // RETURNS: the newly allocated #PangoAttribute, which should be
3858 // <strikethrough>: %TRUE if the text should be struck-through.
3859 static Attribute* attr_strikethrough_new()(int strikethrough) nothrow {
3860 return pango_attr_strikethrough_new(strikethrough);
3864 // Unintrospectable function: attr_style_new() / pango_attr_style_new()
3865 // Create a new font slant style attribute.
3867 // freed with pango_attribute_destroy().
3868 // RETURNS: the newly allocated #PangoAttribute, which should be
3869 // <style>: the slant style
3870 static Attribute* attr_style_new()(Style style) nothrow {
3871 return pango_attr_style_new(style);
3875 // VERSION: 1.22
3876 // MOVED TO: AttrType.get_name
3877 // Fetches the attribute type name passed in when registering the type using
3878 // pango_attr_type_register().
3880 // The returned value is an interned string (see g_intern_string() for what
3881 // that means) that should not be modified or freed.
3883 // a built-in Pango attribute type or invalid.
3884 // RETURNS: the type ID name (which may be %NULL), or %NULL if @type is
3885 // <type>: an attribute type ID to fetch the name for
3886 static char* attr_type_get_name()(AttrType type) nothrow {
3887 return pango_attr_type_get_name(type);
3891 // MOVED TO: AttrType.register
3892 // Allocate a new attribute type ID. The attribute type name can be accessed
3893 // later by using pango_attr_type_get_name().
3894 // RETURNS: the new type ID.
3895 // <name>: an identifier for the type
3896 static AttrType attr_type_register(AT0)(AT0 /*char*/ name) nothrow {
3897 return pango_attr_type_register(toCString!(char*)(name));
3901 // Unintrospectable function: attr_underline_color_new() / pango_attr_underline_color_new()
3902 // VERSION: 1.8
3903 // Create a new underline color attribute. This attribute
3904 // modifies the color of underlines. If not set, underlines
3905 // will use the foreground color.
3907 // freed with pango_attribute_destroy().
3908 // RETURNS: the newly allocated #PangoAttribute, which should be
3909 // <red>: the red value (ranging from 0 to 65535)
3910 // <green>: the green value
3911 // <blue>: the blue value
3912 static Attribute* attr_underline_color_new()(ushort red, ushort green, ushort blue) nothrow {
3913 return pango_attr_underline_color_new(red, green, blue);
3917 // Unintrospectable function: attr_underline_new() / pango_attr_underline_new()
3918 // Create a new underline-style attribute.
3920 // freed with pango_attribute_destroy().
3921 // RETURNS: the newly allocated #PangoAttribute, which should be
3922 // <underline>: the underline style.
3923 static Attribute* attr_underline_new()(Underline underline) nothrow {
3924 return pango_attr_underline_new(underline);
3928 // Unintrospectable function: attr_variant_new() / pango_attr_variant_new()
3929 // Create a new font variant attribute (normal or small caps)
3931 // freed with pango_attribute_destroy().
3932 // RETURNS: the newly allocated #PangoAttribute, which should be
3933 // <variant>: the variant
3934 static Attribute* attr_variant_new()(Variant variant) nothrow {
3935 return pango_attr_variant_new(variant);
3939 // Unintrospectable function: attr_weight_new() / pango_attr_weight_new()
3940 // Create a new font weight attribute.
3942 // freed with pango_attribute_destroy().
3943 // RETURNS: the newly allocated #PangoAttribute, which should be
3944 // <weight>: the weight
3945 static Attribute* attr_weight_new()(Weight weight) nothrow {
3946 return pango_attr_weight_new(weight);
3950 // VERSION: 1.22
3951 // MOVED TO: BidiType.for_unichar
3952 // Determines the normative bidirectional character type of a
3953 // character, as specified in the Unicode Character Database.
3955 // A simplified version of this function is available as
3956 // pango_unichar_get_direction().
3958 // Unicode bidirectional algorithm.
3959 // RETURNS: the bidirectional character type, as used in the
3960 // <ch>: a Unicode character
3961 static BidiType bidi_type_for_unichar()(dchar ch) nothrow {
3962 return pango_bidi_type_for_unichar(ch);
3966 // Determines possible line, word, and character breaks
3967 // for a string of Unicode text with a single analysis. For most
3968 // purposes you may want to use pango_get_log_attrs().
3969 // <text>: the text to process
3970 // <length>: length of @text in bytes (may be -1 if @text is nul-terminated)
3971 // <analysis>: #PangoAnalysis structure from pango_itemize()
3972 // <attrs>: an array to store character information in
3973 // <attrs_len>: size of the array passed as @attrs
3974 static void break_(AT0, AT1, AT2)(AT0 /*char*/ text, int length, AT1 /*Analysis*/ analysis, AT2 /*LogAttr*/ attrs, int attrs_len) nothrow {
3975 pango_break(toCString!(char*)(text), length, UpCast!(Analysis*)(analysis), UpCast!(LogAttr*)(attrs), attrs_len);
3979 // VERSION: 1.16
3980 // Converts extents from Pango units to device units, dividing by the
3981 // %PANGO_SCALE factor and performing rounding.
3983 // The @inclusive rectangle is converted by flooring the x/y coordinates and extending
3984 // width/height, such that the final rectangle completely includes the original
3985 // rectangle.
3987 // The @nearest rectangle is converted by rounding the coordinates
3988 // of the rectangle to the nearest device unit (pixel).
3990 // The rule to which argument to use is: if you want the resulting device-space
3991 // rectangle to completely contain the original rectangle, pass it in as @inclusive.
3992 // If you want two touching-but-not-overlapping rectangles stay
3993 // touching-but-not-overlapping after rounding to device units, pass them in
3994 // as @nearest.
3995 // <inclusive>: rectangle to round to pixels inclusively, or %NULL.
3996 // <nearest>: rectangle to round to nearest pixels, or %NULL.
3997 static void extents_to_pixels(AT0, AT1)(AT0 /*Rectangle*/ inclusive, AT1 /*Rectangle*/ nearest) nothrow {
3998 pango_extents_to_pixels(UpCast!(Rectangle*)(inclusive), UpCast!(Rectangle*)(nearest));
4002 // VERSION: 1.4
4003 // Searches a string the first character that has a strong
4004 // direction, according to the Unicode bidirectional algorithm.
4006 // If no such character is found, then %PANGO_DIRECTION_NEUTRAL is returned.
4007 // RETURNS: The direction corresponding to the first strong character.
4008 // <text>: the text to process
4009 // <length>: length of @text in bytes (may be -1 if @text is nul-terminated)
4010 static Direction find_base_dir(AT0)(AT0 /*char*/ text, int length) nothrow {
4011 return pango_find_base_dir(toCString!(char*)(text), length);
4015 // Locates a paragraph boundary in @text. A boundary is caused by
4016 // delimiter characters, such as a newline, carriage return, carriage
4017 // return-newline pair, or Unicode paragraph separator character. The
4018 // index of the run of delimiters is returned in
4019 // @paragraph_delimiter_index. The index of the start of the paragraph
4020 // (index after all delimiters) is stored in @next_paragraph_start.
4022 // If no delimiters are found, both @paragraph_delimiter_index and
4023 // @next_paragraph_start are filled with the length of @text (an index one
4024 // off the end).
4025 // <text>: UTF-8 text
4026 // <length>: length of @text in bytes, or -1 if nul-terminated
4027 // <paragraph_delimiter_index>: return location for index of delimiter
4028 // <next_paragraph_start>: return location for start of next paragraph
4029 static void find_paragraph_boundary(AT0)(AT0 /*char*/ text, int length, int* paragraph_delimiter_index, int* next_paragraph_start) nothrow {
4030 pango_find_paragraph_boundary(toCString!(char*)(text), length, paragraph_delimiter_index, next_paragraph_start);
4034 // MOVED TO: FontDescription.from_string
4035 // Creates a new font description from a string representation in the
4036 // form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a
4037 // comma separated list of families optionally terminated by a comma,
4038 // STYLE_OPTIONS is a whitespace separated list of words where each WORD
4039 // describes one of style, variant, weight, stretch, or gravity, and SIZE
4040 // is a decimal number (size in points) or optionally followed by the
4041 // unit modifier "px" for absolute size. Any one of the options may
4042 // be absent. If FAMILY-LIST is absent, then the family_name field of
4043 // the resulting font description will be initialized to %NULL. If
4044 // STYLE-OPTIONS is missing, then all style options will be set to the
4045 // default values. If SIZE is missing, the size in the resulting font
4046 // description will be set to 0.
4047 // RETURNS: a new #PangoFontDescription.
4048 // <str>: string representation of a font description.
4049 static FontDescription* /*new*/ font_description_from_string(AT0)(AT0 /*char*/ str) nothrow {
4050 return pango_font_description_from_string(toCString!(char*)(str));
4054 // Computes a #PangoLogAttr for each character in @text. The @log_attrs
4055 // array must have one #PangoLogAttr for each position in @text; if
4056 // @text contains N characters, it has N+1 positions, including the
4057 // last position at the end of the text. @text should be an entire
4058 // paragraph; logical attributes can't be computed without context
4059 // (for example you need to see spaces on either side of a word to know
4060 // the word is a word).
4061 // <text>: text to process
4062 // <length>: length in bytes of @text
4063 // <level>: embedding level, or -1 if unknown
4064 // <language>: language tag
4065 // <log_attrs>: array with one #PangoLogAttr per character in @text, plus one extra, to be filled in
4066 // <attrs_len>: length of @log_attrs array
4067 static void get_log_attrs(AT0, AT1, AT2)(AT0 /*char*/ text, int length, int level, AT1 /*Language*/ language, AT2 /*LogAttr*/ log_attrs, int attrs_len) nothrow {
4068 pango_get_log_attrs(toCString!(char*)(text), length, level, UpCast!(Language*)(language), UpCast!(LogAttr*)(log_attrs), attrs_len);
4072 // If @ch has the Unicode mirrored property and there is another Unicode
4073 // character that typically has a glyph that is the mirror image of @ch's
4074 // glyph, puts that character in the address pointed to by @mirrored_ch.
4076 // Use g_unichar_get_mirror_char() instead; the docs for that function
4077 // provide full details.
4079 // filled in, %FALSE otherwise
4080 // RETURNS: %TRUE if @ch has a mirrored character and @mirrored_ch is
4081 // <ch>: a Unicode character
4082 // <mirrored_ch>: location to store the mirrored character
4083 static int get_mirror_char(AT0)(dchar ch, AT0 /*dchar*/ mirrored_ch) nothrow {
4084 return pango_get_mirror_char(ch, UpCast!(dchar*)(mirrored_ch));
4088 // VERSION: 1.16
4089 // MOVED TO: Gravity.get_for_matrix
4090 // Finds the gravity that best matches the rotation component
4091 // in a #PangoMatrix.
4093 // %PANGO_GRAVITY_AUTO, or %PANGO_GRAVITY_SOUTH if @matrix is %NULL
4094 // RETURNS: the gravity of @matrix, which will never be
4095 // <matrix>: a #PangoMatrix
4096 static Gravity gravity_get_for_matrix(AT0)(AT0 /*Matrix*/ matrix) nothrow {
4097 return pango_gravity_get_for_matrix(UpCast!(Matrix*)(matrix));
4101 // VERSION: 1.16
4102 // MOVED TO: Gravity.get_for_script
4103 // Based on the script, base gravity, and hint, returns actual gravity
4104 // to use in laying out a single #PangoItem.
4106 // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
4107 // preferred gravity of @script. To get the preferred gravity of a script,
4108 // pass %PANGO_GRAVITY_AUTO and %PANGO_GRAVITY_HINT_STRONG in.
4110 // with @script.
4111 // RETURNS: resolved gravity suitable to use for a run of text
4112 // <script>: #PangoScript to query
4113 // <base_gravity>: base gravity of the paragraph
4114 // <hint>: orientation hint
4115 static Gravity gravity_get_for_script()(Script script, Gravity base_gravity, GravityHint hint) nothrow {
4116 return pango_gravity_get_for_script(script, base_gravity, hint);
4120 // VERSION: 1.26
4121 // MOVED TO: Gravity.get_for_script_and_width
4122 // Based on the script, East Asian width, base gravity, and hint,
4123 // returns actual gravity to use in laying out a single character
4124 // or #PangoItem.
4126 // This function is similar to pango_gravity_get_for_script() except
4127 // that this function makes a distinction between narrow/half-width and
4128 // wide/full-width characters also. Wide/full-width characters always
4129 // stand <emph>upright</emph>, that is, they always take the base gravity,
4130 // whereas narrow/full-width characters are always rotated in vertical
4131 // context.
4133 // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
4134 // preferred gravity of @script.
4136 // with @script and @wide.
4137 // RETURNS: resolved gravity suitable to use for a run of text
4138 // <script>: #PangoScript to query
4139 // <wide>: %TRUE for wide characters as returned by g_unichar_iswide()
4140 // <base_gravity>: base gravity of the paragraph
4141 // <hint>: orientation hint
4142 static Gravity gravity_get_for_script_and_width()(Script script, int wide, Gravity base_gravity, GravityHint hint) nothrow {
4143 return pango_gravity_get_for_script_and_width(script, wide, base_gravity, hint);
4147 // VERSION: 1.16
4148 // MOVED TO: Gravity.to_rotation
4149 // Converts a #PangoGravity value to its natural rotation in radians.
4150 // @gravity should not be %PANGO_GRAVITY_AUTO.
4152 // Note that pango_matrix_rotate() takes angle in degrees, not radians.
4153 // So, to call pango_matrix_rotate() with the output of this function
4154 // you should multiply it by (180. / G_PI).
4155 // RETURNS: the rotation value corresponding to @gravity.
4156 // <gravity>: gravity to query
4157 static double gravity_to_rotation()(Gravity gravity) nothrow {
4158 return pango_gravity_to_rotation(gravity);
4162 // VERSION: 1.10
4163 // Checks @ch to see if it is a character that should not be
4164 // normally rendered on the screen. This includes all Unicode characters
4165 // with "ZERO WIDTH" in their name, as well as <firstterm>bidi</firstterm> formatting characters, and
4166 // a few other ones. This is totally different from g_unichar_iszerowidth()
4167 // and is at best misnamed.
4168 // RETURNS: %TRUE if @ch is a zero-width character, %FALSE otherwise
4169 // <ch>: a Unicode character
4170 static int is_zero_width()(dchar ch) nothrow {
4171 return pango_is_zero_width(ch);
4175 // Unintrospectable function: itemize() / pango_itemize()
4176 // Breaks a piece of text into segments with consistent
4177 // directional level and shaping engine. Each byte of @text will
4178 // be contained in exactly one of the items in the returned list;
4179 // the generated list of items will be in logical order (the start
4180 // offsets of the items are ascending).
4182 // @cached_iter should be an iterator over @attrs currently positioned at a
4183 // range before or containing @start_index; @cached_iter will be advanced to
4184 // the range covering the position just after @start_index + @length.
4185 // (i.e. if itemizing in a loop, just keep passing in the same @cached_iter).
4186 // RETURNS: a #GList of #PangoItem structures.
4187 // <context>: a structure holding information that affects
4188 // <text>: the text to itemize.
4189 // <start_index>: first byte in @text to process
4190 // <length>: the number of bytes (not characters) to process after @start_index. This must be >= 0.
4191 // <attrs>: the set of attributes that apply to @text.
4192 // <cached_iter>: Cached attribute iterator, or %NULL
4193 static GLib2.List* itemize(AT0, AT1, AT2, AT3)(AT0 /*Context*/ context, AT1 /*char*/ text, int start_index, int length, AT2 /*AttrList*/ attrs, AT3 /*AttrIterator*/ cached_iter) nothrow {
4194 return pango_itemize(UpCast!(Context*)(context), toCString!(char*)(text), start_index, length, UpCast!(AttrList*)(attrs), UpCast!(AttrIterator*)(cached_iter));
4198 // Unintrospectable function: itemize_with_base_dir() / pango_itemize_with_base_dir()
4199 // VERSION: 1.4
4200 // Like pango_itemize(), but the base direction to use when
4201 // computing bidirectional levels (see pango_context_set_base_dir ()),
4202 // is specified explicitly rather than gotten from the #PangoContext.
4204 // freed using pango_item_free() probably in combination with g_list_foreach(),
4205 // and the list itself using g_list_free().
4206 // RETURNS: a #GList of #PangoItem structures. The items should be
4207 // <context>: a structure holding information that affects
4208 // <base_dir>: base direction to use for bidirectional processing
4209 // <text>: the text to itemize.
4210 // <start_index>: first byte in @text to process
4211 // <length>: the number of bytes (not characters) to process after @start_index. This must be >= 0.
4212 // <attrs>: the set of attributes that apply to @text.
4213 // <cached_iter>: Cached attribute iterator, or %NULL
4214 static GLib2.List* itemize_with_base_dir(AT0, AT1, AT2, AT3)(AT0 /*Context*/ context, Direction base_dir, AT1 /*char*/ text, int start_index, int length, AT2 /*AttrList*/ attrs, AT3 /*AttrIterator*/ cached_iter) nothrow {
4215 return pango_itemize_with_base_dir(UpCast!(Context*)(context), base_dir, toCString!(char*)(text), start_index, length, UpCast!(AttrList*)(attrs), UpCast!(AttrIterator*)(cached_iter));
4219 // MOVED TO: Language.from_string
4220 // Take a RFC-3066 format language tag as a string and convert it to a
4221 // #PangoLanguage pointer that can be efficiently copied (copy the
4222 // pointer) and compared with other language tags (compare the
4223 // pointer.)
4225 // This function first canonicalizes the string by converting it to
4226 // lowercase, mapping '_' to '-', and stripping all characters other
4227 // than letters and '-'.
4229 // Use pango_language_get_default() if you want to get the #PangoLanguage for
4230 // the current locale of the process.
4232 // if @language was %NULL. The returned pointer will be valid
4233 // forever after, and should not be freed.
4234 // RETURNS: an opaque pointer to a #PangoLanguage structure, or %NULL
4235 // <language>: a string representing a language tag, or %NULL
4236 static Language* /*new*/ language_from_string(AT0)(AT0 /*char*/ language) nothrow {
4237 return pango_language_from_string(toCString!(char*)(language));
4241 // VERSION: 1.16
4242 // MOVED TO: Language.get_default
4243 // Returns the #PangoLanguage for the current locale of the process.
4244 // Note that this can change over the life of an application.
4246 // On Unix systems, this is the return value is derived from
4247 // <literal>setlocale(LC_CTYPE, NULL)</literal>, and the user can
4248 // affect this through the environment variables LC_ALL, LC_CTYPE or
4249 // LANG (checked in that order). The locale string typically is in
4250 // the form lang_COUNTRY, where lang is an ISO-639 language code, and
4251 // COUNTRY is an ISO-3166 country code. For instance, sv_FI for
4252 // Swedish as written in Finland or pt_BR for Portuguese as written in
4253 // Brazil.
4255 // On Windows, the C library does not use any such environment
4256 // variables, and setting them won't affect the behavior of functions
4257 // like ctime(). The user sets the locale through the Regional Options
4258 // in the Control Panel. The C library (in the setlocale() function)
4259 // does not use country and language codes, but country and language
4260 // names spelled out in English.
4261 // However, this function does check the above environment
4262 // variables, and does return a Unix-style locale string based on
4263 // either said environment variables or the thread's current locale.
4265 // Your application should call <literal>setlocale(LC_ALL, "");</literal>
4266 // for the user settings to take effect. Gtk+ does this in its initialization
4267 // functions automatically (by calling gtk_set_locale()).
4268 // See <literal>man setlocale</literal> for more details.
4270 // freed.
4271 // RETURNS: the default language as a #PangoLanguage, must not be
4272 static Language* /*new*/ language_get_default()() nothrow {
4273 return pango_language_get_default();
4277 // VERSION: 1.4
4278 // This will return the bidirectional embedding levels of the input paragraph
4279 // as defined by the Unicode Bidirectional Algorithm available at:
4281 // http://www.unicode.org/reports/tr9/
4283 // If the input base direction is a weak direction, the direction of the
4284 // characters in the text will determine the final resolved direction.
4286 // character (not byte), that should be freed using g_free.
4287 // RETURNS: a newly allocated array of embedding levels, one item per
4288 // <text>: the text to itemize.
4289 // <length>: the number of bytes (not characters) to process, or -1 if @text is nul-terminated and the length should be calculated.
4290 // <pbase_dir>: input base direction, and output resolved direction.
4291 static ubyte* log2vis_get_embedding_levels(AT0, AT1)(AT0 /*char*/ text, int length, AT1 /*Direction*/ pbase_dir) nothrow {
4292 return pango_log2vis_get_embedding_levels(toCString!(char*)(text), length, UpCast!(Direction*)(pbase_dir));
4296 // VERSION: 1.16
4297 // Parses an enum type and stores the result in @value.
4299 // If @str does not match the nick name of any of the possible values for the
4300 // enum and is not an integer, %FALSE is returned, a warning is issued
4301 // if @warn is %TRUE, and a
4302 // string representing the list of possible values is stored in
4303 // @possible_values. The list is slash-separated, eg.
4304 // "none/start/middle/end". If failed and @possible_values is not %NULL,
4305 // returned string should be freed using g_free().
4306 // RETURNS: %TRUE if @str was successfully parsed.
4307 // <type>: enum type to parse, eg. %PANGO_TYPE_ELLIPSIZE_MODE.
4308 // <str>: string to parse. May be %NULL.
4309 // <value>: integer to store the result in, or %NULL.
4310 // <warn>: if %TRUE, issue a g_warning() on bad input.
4311 // <possible_values>: place to store list of possible values on failure, or %NULL.
4312 static int parse_enum(AT0, AT1)(Type type, AT0 /*char*/ str, int* value, int warn, AT1 /*char**/ possible_values) nothrow {
4313 return pango_parse_enum(type, toCString!(char*)(str), value, warn, toCString!(char**)(possible_values));
4317 // Parses marked-up text (see
4318 // <link linkend="PangoMarkupFormat">markup format</link>) to create
4319 // a plain-text string and an attribute list.
4321 // If @accel_marker is nonzero, the given character will mark the
4322 // character following it as an accelerator. For example, @accel_marker
4323 // might be an ampersand or underscore. All characters marked
4324 // as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
4325 // and the first character so marked will be returned in @accel_char.
4326 // Two @accel_marker characters following each other produce a single
4327 // literal @accel_marker character.
4329 // If any error happens, none of the output arguments are touched except
4330 // for @error.
4331 // RETURNS: %FALSE if @error is set, otherwise %TRUE
4332 // <markup_text>: markup to parse (see <link linkend="PangoMarkupFormat">markup format</link>)
4333 // <length>: length of @markup_text, or -1 if nul-terminated
4334 // <accel_marker>: character that precedes an accelerator, or 0 for none
4335 // <attr_list>: address of return location for a #PangoAttrList, or %NULL
4336 // <text>: address of return location for text with tags stripped, or %NULL
4337 // <accel_char>: address of return location for accelerator char, or %NULL
4338 static int parse_markup(AT0, AT1, AT2, AT3, AT4)(AT0 /*char*/ markup_text, int length, dchar accel_marker, /*out*/ AT1 /*AttrList**/ attr_list, /*out*/ AT2 /*char**/ text, /*out*/ AT3 /*dchar*/ accel_char, AT4 /*GLib2.Error**/ error=null) nothrow {
4339 return pango_parse_markup(toCString!(char*)(markup_text), length, accel_marker, UpCast!(AttrList**)(attr_list), toCString!(char**)(text), UpCast!(dchar*)(accel_char), UpCast!(GLib2.Error**)(error));
4343 // Parses a font stretch. The allowed values are
4344 // "ultra_condensed", "extra_condensed", "condensed",
4345 // "semi_condensed", "normal", "semi_expanded", "expanded",
4346 // "extra_expanded" and "ultra_expanded". Case variations are
4347 // ignored and the '_' characters may be omitted.
4348 // RETURNS: %TRUE if @str was successfully parsed.
4349 // <str>: a string to parse.
4350 // <stretch>: a #PangoStretch to store the result in.
4351 // <warn>: if %TRUE, issue a g_warning() on bad input.
4352 static int parse_stretch(AT0, AT1)(AT0 /*char*/ str, AT1 /*Stretch*/ stretch, int warn) nothrow {
4353 return pango_parse_stretch(toCString!(char*)(str), UpCast!(Stretch*)(stretch), warn);
4357 // Parses a font style. The allowed values are "normal",
4358 // "italic" and "oblique", case variations being
4359 // ignored.
4360 // RETURNS: %TRUE if @str was successfully parsed.
4361 // <str>: a string to parse.
4362 // <style>: a #PangoStyle to store the result in.
4363 // <warn>: if %TRUE, issue a g_warning() on bad input.
4364 static int parse_style(AT0, AT1)(AT0 /*char*/ str, AT1 /*Style*/ style, int warn) nothrow {
4365 return pango_parse_style(toCString!(char*)(str), UpCast!(Style*)(style), warn);
4369 // Parses a font variant. The allowed values are "normal"
4370 // and "smallcaps" or "small_caps", case variations being
4371 // ignored.
4372 // RETURNS: %TRUE if @str was successfully parsed.
4373 // <str>: a string to parse.
4374 // <variant>: a #PangoVariant to store the result in.
4375 // <warn>: if %TRUE, issue a g_warning() on bad input.
4376 static int parse_variant(AT0, AT1)(AT0 /*char*/ str, AT1 /*Variant*/ variant, int warn) nothrow {
4377 return pango_parse_variant(toCString!(char*)(str), UpCast!(Variant*)(variant), warn);
4381 // Parses a font weight. The allowed values are "heavy",
4382 // "ultrabold", "bold", "normal", "light", "ultraleight"
4383 // and integers. Case variations are ignored.
4384 // RETURNS: %TRUE if @str was successfully parsed.
4385 // <str>: a string to parse.
4386 // <weight>: a #PangoWeight to store the result in.
4387 // <warn>: if %TRUE, issue a g_warning() on bad input.
4388 static int parse_weight(AT0, AT1)(AT0 /*char*/ str, AT1 /*Weight*/ weight, int warn) nothrow {
4389 return pango_parse_weight(toCString!(char*)(str), UpCast!(Weight*)(weight), warn);
4393 // VERSION: 1.12
4394 // Quantizes the thickness and position of a line, typically an
4395 // underline or strikethrough, to whole device pixels, that is integer
4396 // multiples of %PANGO_SCALE. The purpose of this function is to avoid
4397 // such lines looking blurry.
4399 // Care is taken to make sure @thickness is at least one pixel when this
4400 // function returns, but returned @position may become zero as a result
4401 // of rounding.
4402 // <thickness>: pointer to the thickness of a line, in Pango units
4403 // <position>: corresponding position
4404 static void quantize_line_geometry()(int* thickness, int* position) nothrow {
4405 pango_quantize_line_geometry(thickness, position);
4409 // Reads an entire line from a file into a buffer. Lines may
4410 // be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter
4411 // is not written into the buffer. Text after a '#' character is treated as
4412 // a comment and skipped. '\' can be used to escape a # character.
4413 // '\' proceeding a line delimiter combines adjacent lines. A '\' proceeding
4414 // any other character is ignored and written into the output buffer
4415 // unmodified.
4417 // the number of lines read (this is useful for maintaining
4418 // a line number counter which doesn't combine lines with '\')
4419 // RETURNS: 0 if the stream was already at an %EOF character, otherwise
4420 // <stream>: a stdio stream
4421 // <str>: #GString buffer into which to write the result
4422 static int read_line(AT0, AT1)(AT0 /*FILE*/ stream, AT1 /*GLib2.String*/ str) nothrow {
4423 return pango_read_line(UpCast!(FILE*)(stream), UpCast!(GLib2.String*)(str));
4427 // Unintrospectable function: reorder_items() / pango_reorder_items()
4428 // From a list of items in logical order and the associated
4429 // directional levels, produce a list in visual order.
4430 // The original list is unmodified.
4433 // (Please open a bug if you use this function.
4434 // It is not a particularly convenient interface, and the code
4435 // is duplicated elsewhere in Pango for that reason.)
4436 // RETURNS: a #GList of #PangoItem structures in visual order.
4437 // <logical_items>: a #GList of #PangoItem in logical order.
4438 static GLib2.List* reorder_items(AT0)(AT0 /*GLib2.List*/ logical_items) nothrow {
4439 return pango_reorder_items(UpCast!(GLib2.List*)(logical_items));
4443 // Scans an integer.
4444 // Leading white space is skipped.
4445 // RETURNS: %FALSE if a parse error occurred.
4446 // <pos>: in/out string position
4447 // <out>: an int into which to write the result
4448 static int scan_int(AT0)(AT0 /*char**/ pos, int* out_) nothrow {
4449 return pango_scan_int(toCString!(char**)(pos), out_);
4453 // Scans a string into a #GString buffer. The string may either
4454 // be a sequence of non-white-space characters, or a quoted
4455 // string with '"'. Instead a quoted string, '\"' represents
4456 // a literal quote. Leading white space outside of quotes is skipped.
4457 // RETURNS: %FALSE if a parse error occurred.
4458 // <pos>: in/out string position
4459 // <out>: a #GString into which to write the result
4460 static int scan_string(AT0, AT1)(AT0 /*char**/ pos, AT1 /*GLib2.String*/ out_) nothrow {
4461 return pango_scan_string(toCString!(char**)(pos), UpCast!(GLib2.String*)(out_));
4465 // Scans a word into a #GString buffer. A word consists
4466 // of [A-Za-z_] followed by zero or more [A-Za-z_0-9]
4467 // Leading white space is skipped.
4468 // RETURNS: %FALSE if a parse error occurred.
4469 // <pos>: in/out string position
4470 // <out>: a #GString into which to write the result
4471 static int scan_word(AT0, AT1)(AT0 /*char**/ pos, AT1 /*GLib2.String*/ out_) nothrow {
4472 return pango_scan_word(toCString!(char**)(pos), UpCast!(GLib2.String*)(out_));
4476 // VERSION: 1.4
4477 // MOVED TO: Script.for_unichar
4478 // Looks up the #PangoScript for a particular character (as defined by
4479 // Unicode Standard Annex #24). No check is made for @ch being a
4480 // valid Unicode character; if you pass in invalid character, the
4481 // result is undefined.
4483 // As of Pango 1.18, this function simply returns the return value of
4484 // g_unichar_get_script().
4485 // RETURNS: the #PangoScript for the character.
4486 // <ch>: a Unicode character
4487 static Script script_for_unichar()(dchar ch) nothrow {
4488 return pango_script_for_unichar(ch);
4492 // VERSION: 1.4
4493 // MOVED TO: Script.get_sample_language
4494 // Given a script, finds a language tag that is reasonably
4495 // representative of that script. This will usually be the
4496 // most widely spoken or used language written in that script:
4497 // for instance, the sample language for %PANGO_SCRIPT_CYRILLIC
4498 // is <literal>ru</literal> (Russian), the sample language
4499 // for %PANGO_SCRIPT_ARABIC is <literal>ar</literal>.
4501 // For some
4502 // scripts, no sample language will be returned because there
4503 // is no language that is sufficiently representative. The best
4504 // example of this is %PANGO_SCRIPT_HAN, where various different
4505 // variants of written Chinese, Japanese, and Korean all use
4506 // significantly different sets of Han characters and forms
4507 // of shared characters. No sample language can be provided
4508 // for many historical scripts as well.
4510 // As of 1.18, this function checks the environment variables
4511 // PANGO_LANGUAGE and LANGUAGE (checked in that order) first.
4512 // If one of them is set, it is parsed as a list of language tags
4513 // separated by colons or other separators. This function
4514 // will return the first language in the parsed list that Pango
4515 // believes may use @script for writing. This last predicate
4516 // is tested using pango_language_includes_script(). This can
4517 // be used to control Pango's font selection for non-primary
4518 // languages. For example, a PANGO_LANGUAGE enviroment variable
4519 // set to "en:fa" makes Pango choose fonts suitable for Persian (fa)
4520 // instead of Arabic (ar) when a segment of Arabic text is found
4521 // in an otherwise non-Arabic text. The same trick can be used to
4522 // choose a default language for %PANGO_SCRIPT_HAN when setting
4523 // context language is not feasible.
4525 // of the script, or %NULL if no such language exists.
4526 // RETURNS: a #PangoLanguage that is representative
4527 // <script>: a #PangoScript
4528 static Language* /*new*/ script_get_sample_language()(Script script) nothrow {
4529 return pango_script_get_sample_language(script);
4533 // Given a segment of text and the corresponding
4534 // #PangoAnalysis structure returned from pango_itemize(),
4535 // convert the characters into glyphs. You may also pass
4536 // in only a substring of the item from pango_itemize().
4537 // <text>: the text to process
4538 // <length>: the length (in bytes) of @text
4539 // <analysis>: #PangoAnalysis structure from pango_itemize()
4540 // <glyphs>: glyph string in which to store results
4541 static void shape(AT0, AT1, AT2)(AT0 /*char*/ text, int length, AT1 /*Analysis*/ analysis, AT2 /*GlyphString*/ glyphs) nothrow {
4542 pango_shape(toCString!(char*)(text), length, UpCast!(Analysis*)(analysis), UpCast!(GlyphString*)(glyphs));
4546 // Skips 0 or more characters of white space.
4548 // the position at a '\0' character.
4549 // RETURNS: %FALSE if skipping the white space leaves
4550 // <pos>: in/out string position
4551 static int skip_space(AT0)(AT0 /*char**/ pos) nothrow {
4552 return pango_skip_space(toCString!(char**)(pos));
4556 // Unintrospectable function: split_file_list() / pango_split_file_list()
4557 // Splits a %G_SEARCHPATH_SEPARATOR-separated list of files, stripping
4558 // white space and substituting ~/ with $HOME/.
4559 // RETURNS: a list of strings to be freed with g_strfreev()
4560 // <str>: a %G_SEARCHPATH_SEPARATOR separated list of filenames
4561 static char** split_file_list(AT0)(AT0 /*char*/ str) nothrow {
4562 return pango_split_file_list(toCString!(char*)(str));
4566 // Trims leading and trailing whitespace from a string.
4567 // RETURNS: A newly-allocated string that must be freed with g_free()
4568 // <str>: a string
4569 static char* /*new*/ trim_string(AT0)(AT0 /*char*/ str) nothrow {
4570 return pango_trim_string(toCString!(char*)(str));
4574 // Determines the inherent direction of a character; either
4575 // %PANGO_DIRECTION_LTR, %PANGO_DIRECTION_RTL, or
4576 // %PANGO_DIRECTION_NEUTRAL.
4578 // This function is useful to categorize characters into left-to-right
4579 // letters, right-to-left letters, and everything else. If full
4580 // Unicode bidirectional type of a character is needed,
4581 // pango_bidi_type_for_gunichar() can be used instead.
4582 // RETURNS: the direction of the character.
4583 // <ch>: a Unicode character
4584 static Direction unichar_direction()(dchar ch) nothrow {
4585 return pango_unichar_direction(ch);
4589 // VERSION: 1.16
4590 // Converts a floating-point number to Pango units: multiplies
4591 // it by %PANGO_SCALE and rounds to nearest integer.
4592 // RETURNS: the value in Pango units.
4593 // <d>: double floating-point value
4594 static int units_from_double()(double d) nothrow {
4595 return pango_units_from_double(d);
4599 // VERSION: 1.16
4600 // Converts a number in Pango units to floating-point: divides
4601 // it by %PANGO_SCALE.
4602 // RETURNS: the double value.
4603 // <i>: value in Pango units
4604 static double units_to_double()(int i) nothrow {
4605 return pango_units_to_double(i);
4609 // VERSION: 1.16
4610 // This is similar to the macro %PANGO_VERSION except that
4611 // it returns the encoded version of Pango available at run-time,
4612 // as opposed to the version available at compile-time.
4614 // A version number can be encoded into an integer using
4615 // PANGO_VERSION_ENCODE().
4617 // available at run time.
4618 // RETURNS: The encoded version of Pango library
4619 static int version_()() nothrow {
4620 return pango_version();
4624 // VERSION: 1.16
4625 // Checks that the Pango library in use is compatible with the
4626 // given version. Generally you would pass in the constants
4627 // %PANGO_VERSION_MAJOR, %PANGO_VERSION_MINOR, %PANGO_VERSION_MICRO
4628 // as the three arguments to this function; that produces
4629 // a check that the library in use at run-time is compatible with
4630 // the version of Pango the application or module was compiled against.
4632 // Compatibility is defined by two things: first the version
4633 // of the running library is newer than the version
4634 // @required_major.required_minor.@required_micro. Second
4635 // the running library must be binary compatible with the
4636 // version @required_major.required_minor.@required_micro
4637 // (same major version.)
4639 // For compile-time version checking use PANGO_VERSION_CHECK().
4641 // given version, or a string describing the version mismatch.
4642 // The returned string is owned by Pango and should not be modified
4643 // or freed.
4644 // RETURNS: %NULL if the Pango library is compatible with the
4645 // <required_major>: the required major version.
4646 // <required_minor>: the required minor version.
4647 // <required_micro>: the required major version.
4648 static char* version_check()(int required_major, int required_minor, int required_micro) nothrow {
4649 return pango_version_check(required_major, required_minor, required_micro);
4653 // VERSION: 1.16
4654 // This is similar to the macro %PANGO_VERSION_STRING except that
4655 // it returns the version of Pango available at run-time, as opposed to
4656 // the version available at compile-time.
4658 // available at run time.
4659 // The returned string is owned by Pango and should not be modified
4660 // or freed.
4661 // RETURNS: A string containing the version of Pango library
4662 static char* version_string()() nothrow {
4663 return pango_version_string();
4667 // C prototypes:
4669 extern (C) {
4670 Attribute* pango_attr_font_desc_new(FontDescription* desc) nothrow;
4671 AttrIterator* pango_attr_iterator_copy(AttrIterator* this_) nothrow;
4672 void pango_attr_iterator_destroy(AttrIterator* this_) nothrow;
4673 Attribute* pango_attr_iterator_get(AttrIterator* this_, AttrType type) nothrow;
4674 GLib2.SList* /*new*/ pango_attr_iterator_get_attrs(AttrIterator* this_) nothrow;
4675 void pango_attr_iterator_get_font(AttrIterator* this_, FontDescription* desc, Language** language, GLib2.SList** extra_attrs) nothrow;
4676 int pango_attr_iterator_next(AttrIterator* this_) nothrow;
4677 void pango_attr_iterator_range(AttrIterator* this_, int* start, int* end) nothrow;
4678 Attribute* pango_attr_language_new(Language* language) nothrow;
4679 AttrList* /*new*/ pango_attr_list_new() nothrow;
4680 void pango_attr_list_change(AttrList* this_, Attribute* attr) nothrow;
4681 AttrList* /*new*/ pango_attr_list_copy(AttrList* this_) nothrow;
4682 AttrList* /*new*/ pango_attr_list_filter(AttrList* this_, AttrFilterFunc func, void* data) nothrow;
4683 AttrIterator* pango_attr_list_get_iterator(AttrList* this_) nothrow;
4684 void pango_attr_list_insert(AttrList* this_, Attribute* attr) nothrow;
4685 void pango_attr_list_insert_before(AttrList* this_, Attribute* attr) nothrow;
4686 AttrList* /*new*/ pango_attr_list_ref(AttrList* this_) nothrow;
4687 void pango_attr_list_splice(AttrList* this_, AttrList* other, int pos, int len) nothrow;
4688 void pango_attr_list_unref(AttrList* this_) nothrow;
4689 Attribute* pango_attr_shape_new(Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4690 Attribute* pango_attr_shape_new_with_data(Rectangle* ink_rect, Rectangle* logical_rect, void* data, AttrDataCopyFunc copy_func, GLib2.DestroyNotify destroy_func) nothrow;
4691 Attribute* pango_attr_size_new(int size) nothrow;
4692 Attribute* pango_attr_size_new_absolute(int size) nothrow;
4693 Attribute* pango_attribute_copy(Attribute* this_) nothrow;
4694 void pango_attribute_destroy(Attribute* this_) nothrow;
4695 int pango_attribute_equal(Attribute* this_, Attribute* attr2) nothrow;
4696 void pango_attribute_init(Attribute* this_, AttrClass* klass) nothrow;
4697 Color* /*new*/ pango_color_copy(Color* this_) nothrow;
4698 void pango_color_free(Color* this_) nothrow;
4699 int pango_color_parse(Color* this_, char* spec) nothrow;
4700 char* /*new*/ pango_color_to_string(Color* this_) nothrow;
4701 Context* /*new*/ pango_context_new() nothrow;
4702 Direction pango_context_get_base_dir(Context* this_) nothrow;
4703 Gravity pango_context_get_base_gravity(Context* this_) nothrow;
4704 FontDescription* /*new*/ pango_context_get_font_description(Context* this_) nothrow;
4705 FontMap* pango_context_get_font_map(Context* this_) nothrow;
4706 Gravity pango_context_get_gravity(Context* this_) nothrow;
4707 GravityHint pango_context_get_gravity_hint(Context* this_) nothrow;
4708 Language* /*new*/ pango_context_get_language(Context* this_) nothrow;
4709 Matrix* pango_context_get_matrix(Context* this_) nothrow;
4710 FontMetrics* /*new*/ pango_context_get_metrics(Context* this_, FontDescription* desc, Language* language) nothrow;
4711 void pango_context_list_families(Context* this_, FontFamily*** families, int* n_families) nothrow;
4712 Font* pango_context_load_font(Context* this_, FontDescription* desc) nothrow;
4713 Fontset* pango_context_load_fontset(Context* this_, FontDescription* desc, Language* language) nothrow;
4714 void pango_context_set_base_dir(Context* this_, Direction direction) nothrow;
4715 void pango_context_set_base_gravity(Context* this_, Gravity gravity) nothrow;
4716 void pango_context_set_font_description(Context* this_, FontDescription* desc) nothrow;
4717 void pango_context_set_font_map(Context* this_, FontMap* font_map) nothrow;
4718 void pango_context_set_gravity_hint(Context* this_, GravityHint hint) nothrow;
4719 void pango_context_set_language(Context* this_, Language* language) nothrow;
4720 void pango_context_set_matrix(Context* this_, Matrix* matrix) nothrow;
4721 Coverage* pango_coverage_copy(Coverage* this_) nothrow;
4722 CoverageLevel pango_coverage_get(Coverage* this_, int index_) nothrow;
4723 void pango_coverage_max(Coverage* this_, Coverage* other) nothrow;
4724 Coverage* pango_coverage_ref(Coverage* this_) nothrow;
4725 void pango_coverage_set(Coverage* this_, int index_, CoverageLevel level) nothrow;
4726 void pango_coverage_to_bytes(Coverage* this_, ubyte** bytes, int* n_bytes) nothrow;
4727 void pango_coverage_unref(Coverage* this_) nothrow;
4728 Coverage* pango_coverage_from_bytes(ubyte* bytes, int n_bytes) nothrow;
4729 Coverage* pango_coverage_new() nothrow;
4730 void pango_font_descriptions_free(FontDescription** descs, int n_descs) nothrow;
4731 FontDescription* /*new*/ pango_font_describe(Font* this_) nothrow;
4732 FontDescription* /*new*/ pango_font_describe_with_absolute_size(Font* this_) nothrow;
4733 EngineShape* pango_font_find_shaper(Font* this_, Language* language, uint ch) nothrow;
4734 Coverage* pango_font_get_coverage(Font* this_, Language* language) nothrow;
4735 FontMap* pango_font_get_font_map(Font* this_) nothrow;
4736 void pango_font_get_glyph_extents(Font* this_, Glyph glyph, Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4737 FontMetrics* /*new*/ pango_font_get_metrics(Font* this_, Language* language) nothrow;
4738 FontDescription* /*new*/ pango_font_description_new() nothrow;
4739 int pango_font_description_better_match(FontDescription* this_, FontDescription* old_match, FontDescription* new_match) nothrow;
4740 FontDescription* /*new*/ pango_font_description_copy(FontDescription* this_) nothrow;
4741 FontDescription* /*new*/ pango_font_description_copy_static(FontDescription* this_) nothrow;
4742 int pango_font_description_equal(FontDescription* this_, FontDescription* desc2) nothrow;
4743 void pango_font_description_free(FontDescription* this_) nothrow;
4744 char* pango_font_description_get_family(FontDescription* this_) nothrow;
4745 Gravity pango_font_description_get_gravity(FontDescription* this_) nothrow;
4746 FontMask pango_font_description_get_set_fields(FontDescription* this_) nothrow;
4747 int pango_font_description_get_size(FontDescription* this_) nothrow;
4748 int pango_font_description_get_size_is_absolute(FontDescription* this_) nothrow;
4749 Stretch pango_font_description_get_stretch(FontDescription* this_) nothrow;
4750 Style pango_font_description_get_style(FontDescription* this_) nothrow;
4751 Variant pango_font_description_get_variant(FontDescription* this_) nothrow;
4752 Weight pango_font_description_get_weight(FontDescription* this_) nothrow;
4753 uint pango_font_description_hash(FontDescription* this_) nothrow;
4754 void pango_font_description_merge(FontDescription* this_, FontDescription* desc_to_merge, int replace_existing) nothrow;
4755 void pango_font_description_merge_static(FontDescription* this_, FontDescription* desc_to_merge, int replace_existing) nothrow;
4756 void pango_font_description_set_absolute_size(FontDescription* this_, double size) nothrow;
4757 void pango_font_description_set_family(FontDescription* this_, char* family) nothrow;
4758 void pango_font_description_set_family_static(FontDescription* this_, char* family) nothrow;
4759 void pango_font_description_set_gravity(FontDescription* this_, Gravity gravity) nothrow;
4760 void pango_font_description_set_size(FontDescription* this_, int size) nothrow;
4761 void pango_font_description_set_stretch(FontDescription* this_, Stretch stretch) nothrow;
4762 void pango_font_description_set_style(FontDescription* this_, Style style) nothrow;
4763 void pango_font_description_set_variant(FontDescription* this_, Variant variant) nothrow;
4764 void pango_font_description_set_weight(FontDescription* this_, Weight weight) nothrow;
4765 char* /*new*/ pango_font_description_to_filename(FontDescription* this_) nothrow;
4766 char* /*new*/ pango_font_description_to_string(FontDescription* this_) nothrow;
4767 void pango_font_description_unset_fields(FontDescription* this_, FontMask to_unset) nothrow;
4768 FontDescription* /*new*/ pango_font_description_from_string(char* str) nothrow;
4769 FontDescription* /*new*/ pango_font_face_describe(FontFace* this_) nothrow;
4770 char* pango_font_face_get_face_name(FontFace* this_) nothrow;
4771 int pango_font_face_is_synthesized(FontFace* this_) nothrow;
4772 void pango_font_face_list_sizes(FontFace* this_, int** sizes, int* n_sizes) nothrow;
4773 char* pango_font_family_get_name(FontFamily* this_) nothrow;
4774 int pango_font_family_is_monospace(FontFamily* this_) nothrow;
4775 void pango_font_family_list_faces(FontFamily* this_, FontFace*** faces, int* n_faces) nothrow;
4776 Context* pango_font_map_create_context(FontMap* this_) nothrow;
4777 void pango_font_map_list_families(FontMap* this_, FontFamily*** families, int* n_families) nothrow;
4778 Font* pango_font_map_load_font(FontMap* this_, Context* context, FontDescription* desc) nothrow;
4779 Fontset* pango_font_map_load_fontset(FontMap* this_, Context* context, FontDescription* desc, Language* language) nothrow;
4780 int pango_font_metrics_get_approximate_char_width(FontMetrics* this_) nothrow;
4781 int pango_font_metrics_get_approximate_digit_width(FontMetrics* this_) nothrow;
4782 int pango_font_metrics_get_ascent(FontMetrics* this_) nothrow;
4783 int pango_font_metrics_get_descent(FontMetrics* this_) nothrow;
4784 int pango_font_metrics_get_strikethrough_position(FontMetrics* this_) nothrow;
4785 int pango_font_metrics_get_strikethrough_thickness(FontMetrics* this_) nothrow;
4786 int pango_font_metrics_get_underline_position(FontMetrics* this_) nothrow;
4787 int pango_font_metrics_get_underline_thickness(FontMetrics* this_) nothrow;
4788 FontMetrics* /*new*/ pango_font_metrics_ref(FontMetrics* this_) nothrow;
4789 void pango_font_metrics_unref(FontMetrics* this_) nothrow;
4790 void pango_fontset_foreach(Fontset* this_, FontsetForeachFunc func, void* data) nothrow;
4791 Font* pango_fontset_get_font(Fontset* this_, uint wc) nothrow;
4792 FontMetrics* /*new*/ pango_fontset_get_metrics(Fontset* this_) nothrow;
4793 GLib2.SList* pango_glyph_item_apply_attrs(GlyphItem* this_, char* text, AttrList* list) nothrow;
4794 GlyphItem* /*new*/ pango_glyph_item_copy(GlyphItem* this_) nothrow;
4795 void pango_glyph_item_free(GlyphItem* this_) nothrow;
4796 void pango_glyph_item_get_logical_widths(GlyphItem* this_, char* text, int* logical_widths) nothrow;
4797 void pango_glyph_item_letter_space(GlyphItem* this_, char* text, LogAttr* log_attrs, int letter_spacing) nothrow;
4798 GlyphItem* /*new*/ pango_glyph_item_split(GlyphItem* this_, char* text, int split_index) nothrow;
4799 GlyphItemIter* /*new*/ pango_glyph_item_iter_copy(GlyphItemIter* this_) nothrow;
4800 void pango_glyph_item_iter_free(GlyphItemIter* this_) nothrow;
4801 int pango_glyph_item_iter_init_end(GlyphItemIter* this_, GlyphItem* glyph_item, char* text) nothrow;
4802 int pango_glyph_item_iter_init_start(GlyphItemIter* this_, GlyphItem* glyph_item, char* text) nothrow;
4803 int pango_glyph_item_iter_next_cluster(GlyphItemIter* this_) nothrow;
4804 int pango_glyph_item_iter_prev_cluster(GlyphItemIter* this_) nothrow;
4805 GlyphString* /*new*/ pango_glyph_string_new() nothrow;
4806 GlyphString* /*new*/ pango_glyph_string_copy(GlyphString* this_) nothrow;
4807 void pango_glyph_string_extents(GlyphString* this_, Font* font, Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4808 void pango_glyph_string_extents_range(GlyphString* this_, int start, int end, Font* font, Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4809 void pango_glyph_string_free(GlyphString* this_) nothrow;
4810 void pango_glyph_string_get_logical_widths(GlyphString* this_, char* text, int length, int embedding_level, int* logical_widths) nothrow;
4811 int pango_glyph_string_get_width(GlyphString* this_) nothrow;
4812 void pango_glyph_string_index_to_x(GlyphString* this_, char* text, int length, Analysis* analysis, int index_, int trailing, int* x_pos) nothrow;
4813 void pango_glyph_string_set_size(GlyphString* this_, int new_len) nothrow;
4814 void pango_glyph_string_x_to_index(GlyphString* this_, char* text, int length, Analysis* analysis, int x_pos, int* index_, int* trailing) nothrow;
4815 Item* /*new*/ pango_item_new() nothrow;
4816 Item* /*new*/ pango_item_copy(Item* this_) nothrow;
4817 void pango_item_free(Item* this_) nothrow;
4818 Item* /*new*/ pango_item_split(Item* this_, int split_index, int split_offset) nothrow;
4819 char* pango_language_get_sample_string(Language* this_) nothrow;
4820 Script* pango_language_get_scripts(Language* this_, int* num_scripts) nothrow;
4821 int pango_language_includes_script(Language* this_, Script script) nothrow;
4822 int pango_language_matches(Language* this_, char* range_list) nothrow;
4823 char* pango_language_to_string(Language* this_) nothrow;
4824 Language* /*new*/ pango_language_from_string(char* language) nothrow;
4825 Language* /*new*/ pango_language_get_default() nothrow;
4826 Layout* /*new*/ pango_layout_new(Context* context) nothrow;
4827 void pango_layout_context_changed(Layout* this_) nothrow;
4828 Layout* pango_layout_copy(Layout* this_) nothrow;
4829 Alignment pango_layout_get_alignment(Layout* this_) nothrow;
4830 AttrList* /*new*/ pango_layout_get_attributes(Layout* this_) nothrow;
4831 int pango_layout_get_auto_dir(Layout* this_) nothrow;
4832 int pango_layout_get_baseline(Layout* this_) nothrow;
4833 Context* pango_layout_get_context(Layout* this_) nothrow;
4834 void pango_layout_get_cursor_pos(Layout* this_, int index_, /*out*/ Rectangle* strong_pos, /*out*/ Rectangle* weak_pos) nothrow;
4835 EllipsizeMode pango_layout_get_ellipsize(Layout* this_) nothrow;
4836 void pango_layout_get_extents(Layout* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) nothrow;
4837 FontDescription* pango_layout_get_font_description(Layout* this_) nothrow;
4838 int pango_layout_get_height(Layout* this_) nothrow;
4839 int pango_layout_get_indent(Layout* this_) nothrow;
4840 LayoutIter* /*new*/ pango_layout_get_iter(Layout* this_) nothrow;
4841 int pango_layout_get_justify(Layout* this_) nothrow;
4842 LayoutLine* /*new*/ pango_layout_get_line(Layout* this_, int line) nothrow;
4843 int pango_layout_get_line_count(Layout* this_) nothrow;
4844 LayoutLine* /*new*/ pango_layout_get_line_readonly(Layout* this_, int line) nothrow;
4845 GLib2.SList* pango_layout_get_lines(Layout* this_) nothrow;
4846 GLib2.SList* pango_layout_get_lines_readonly(Layout* this_) nothrow;
4847 void pango_layout_get_log_attrs(Layout* this_, /*out*/ LogAttr** attrs, /*out*/ int* n_attrs) nothrow;
4848 void pango_layout_get_pixel_extents(Layout* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) nothrow;
4849 void pango_layout_get_pixel_size(Layout* this_, /*out*/ int* width, /*out*/ int* height) nothrow;
4850 int pango_layout_get_single_paragraph_mode(Layout* this_) nothrow;
4851 void pango_layout_get_size(Layout* this_, /*out*/ int* width, /*out*/ int* height) nothrow;
4852 int pango_layout_get_spacing(Layout* this_) nothrow;
4853 TabArray* /*new*/ pango_layout_get_tabs(Layout* this_) nothrow;
4854 char* pango_layout_get_text(Layout* this_) nothrow;
4855 int pango_layout_get_unknown_glyphs_count(Layout* this_) nothrow;
4856 int pango_layout_get_width(Layout* this_) nothrow;
4857 WrapMode pango_layout_get_wrap(Layout* this_) nothrow;
4858 void pango_layout_index_to_line_x(Layout* this_, int index_, int trailing, /*out*/ int* line, int* x_pos) nothrow;
4859 void pango_layout_index_to_pos(Layout* this_, int index_, /*out*/ Rectangle* pos) nothrow;
4860 int pango_layout_is_ellipsized(Layout* this_) nothrow;
4861 int pango_layout_is_wrapped(Layout* this_) nothrow;
4862 void pango_layout_move_cursor_visually(Layout* this_, int strong, int old_index, int old_trailing, int direction, /*out*/ int* new_index, int* new_trailing) nothrow;
4863 void pango_layout_set_alignment(Layout* this_, Alignment alignment) nothrow;
4864 void pango_layout_set_attributes(Layout* this_, AttrList* attrs) nothrow;
4865 void pango_layout_set_auto_dir(Layout* this_, int auto_dir) nothrow;
4866 void pango_layout_set_ellipsize(Layout* this_, EllipsizeMode ellipsize) nothrow;
4867 void pango_layout_set_font_description(Layout* this_, FontDescription* desc) nothrow;
4868 void pango_layout_set_height(Layout* this_, int height) nothrow;
4869 void pango_layout_set_indent(Layout* this_, int indent) nothrow;
4870 void pango_layout_set_justify(Layout* this_, int justify) nothrow;
4871 void pango_layout_set_markup(Layout* this_, char* markup, int length) nothrow;
4872 void pango_layout_set_markup_with_accel(Layout* this_, char* markup, int length, dchar accel_marker, dchar* accel_char) nothrow;
4873 void pango_layout_set_single_paragraph_mode(Layout* this_, int setting) nothrow;
4874 void pango_layout_set_spacing(Layout* this_, int spacing) nothrow;
4875 void pango_layout_set_tabs(Layout* this_, TabArray* tabs) nothrow;
4876 void pango_layout_set_text(Layout* this_, char* text, int length) nothrow;
4877 void pango_layout_set_width(Layout* this_, int width) nothrow;
4878 void pango_layout_set_wrap(Layout* this_, WrapMode wrap) nothrow;
4879 int pango_layout_xy_to_index(Layout* this_, int x, int y, /*out*/ int* index_, /*out*/ int* trailing) nothrow;
4880 int pango_layout_iter_at_last_line(LayoutIter* this_) nothrow;
4881 LayoutIter* /*new*/ pango_layout_iter_copy(LayoutIter* this_) nothrow;
4882 void pango_layout_iter_free(LayoutIter* this_) nothrow;
4883 int pango_layout_iter_get_baseline(LayoutIter* this_) nothrow;
4884 void pango_layout_iter_get_char_extents(LayoutIter* this_, Rectangle* logical_rect) nothrow;
4885 void pango_layout_iter_get_cluster_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4886 int pango_layout_iter_get_index(LayoutIter* this_) nothrow;
4887 Layout* pango_layout_iter_get_layout(LayoutIter* this_) nothrow;
4888 void pango_layout_iter_get_layout_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4889 LayoutLine* /*new*/ pango_layout_iter_get_line(LayoutIter* this_) nothrow;
4890 void pango_layout_iter_get_line_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4891 LayoutLine* /*new*/ pango_layout_iter_get_line_readonly(LayoutIter* this_) nothrow;
4892 void pango_layout_iter_get_line_yrange(LayoutIter* this_, int* y0_, int* y1_) nothrow;
4893 LayoutRun* pango_layout_iter_get_run(LayoutIter* this_) nothrow;
4894 void pango_layout_iter_get_run_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect) nothrow;
4895 LayoutRun* pango_layout_iter_get_run_readonly(LayoutIter* this_) nothrow;
4896 int pango_layout_iter_next_char(LayoutIter* this_) nothrow;
4897 int pango_layout_iter_next_cluster(LayoutIter* this_) nothrow;
4898 int pango_layout_iter_next_line(LayoutIter* this_) nothrow;
4899 int pango_layout_iter_next_run(LayoutIter* this_) nothrow;
4900 void pango_layout_line_get_extents(LayoutLine* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) nothrow;
4901 void pango_layout_line_get_pixel_extents(LayoutLine* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) nothrow;
4902 void pango_layout_line_get_x_ranges(LayoutLine* this_, int start_index, int end_index, /*out*/ int** ranges, /*out*/ int* n_ranges) nothrow;
4903 void pango_layout_line_index_to_x(LayoutLine* this_, int index_, int trailing, /*out*/ int* x_pos) nothrow;
4904 LayoutLine* /*new*/ pango_layout_line_ref(LayoutLine* this_) nothrow;
4905 void pango_layout_line_unref(LayoutLine* this_) nothrow;
4906 int pango_layout_line_x_to_index(LayoutLine* this_, int x_pos, /*out*/ int* index_, /*out*/ int* trailing) nothrow;
4907 void pango_matrix_concat(Matrix* this_, Matrix* new_matrix) nothrow;
4908 Matrix* /*new*/ pango_matrix_copy(Matrix* this_) nothrow;
4909 void pango_matrix_free(Matrix* this_) nothrow;
4910 double pango_matrix_get_font_scale_factor(Matrix* this_) nothrow;
4911 void pango_matrix_rotate(Matrix* this_, double degrees) nothrow;
4912 void pango_matrix_scale(Matrix* this_, double scale_x, double scale_y) nothrow;
4913 void pango_matrix_transform_distance(Matrix* this_, double* dx, double* dy) nothrow;
4914 void pango_matrix_transform_pixel_rectangle(Matrix* this_, Rectangle* rect) nothrow;
4915 void pango_matrix_transform_point(Matrix* this_, double* x, double* y) nothrow;
4916 void pango_matrix_transform_rectangle(Matrix* this_, Rectangle* rect) nothrow;
4917 void pango_matrix_translate(Matrix* this_, double tx, double ty) nothrow;
4918 void pango_renderer_activate(Renderer* this_) nothrow;
4919 void pango_renderer_deactivate(Renderer* this_) nothrow;
4920 void pango_renderer_draw_error_underline(Renderer* this_, int x, int y, int width, int height) nothrow;
4921 void pango_renderer_draw_glyph(Renderer* this_, Font* font, Glyph glyph, double x, double y) nothrow;
4922 void pango_renderer_draw_glyph_item(Renderer* this_, char* text, GlyphItem* glyph_item, int x, int y) nothrow;
4923 void pango_renderer_draw_glyphs(Renderer* this_, Font* font, GlyphString* glyphs, int x, int y) nothrow;
4924 void pango_renderer_draw_layout(Renderer* this_, Layout* layout, int x, int y) nothrow;
4925 void pango_renderer_draw_layout_line(Renderer* this_, LayoutLine* line, int x, int y) nothrow;
4926 void pango_renderer_draw_rectangle(Renderer* this_, RenderPart part, int x, int y, int width, int height) nothrow;
4927 void pango_renderer_draw_trapezoid(Renderer* this_, RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22) nothrow;
4928 Color* /*new*/ pango_renderer_get_color(Renderer* this_, RenderPart part) nothrow;
4929 Layout* pango_renderer_get_layout(Renderer* this_) nothrow;
4930 LayoutLine* /*new*/ pango_renderer_get_layout_line(Renderer* this_) nothrow;
4931 Matrix* pango_renderer_get_matrix(Renderer* this_) nothrow;
4932 void pango_renderer_part_changed(Renderer* this_, RenderPart part) nothrow;
4933 void pango_renderer_set_color(Renderer* this_, RenderPart part, Color* color) nothrow;
4934 void pango_renderer_set_matrix(Renderer* this_, Matrix* matrix) nothrow;
4935 void pango_script_iter_free(ScriptIter* this_) nothrow;
4936 void pango_script_iter_get_range(ScriptIter* this_, char** start, char** end, Script* script) nothrow;
4937 int pango_script_iter_next(ScriptIter* this_) nothrow;
4938 ScriptIter* pango_script_iter_new(char* text, int length) nothrow;
4939 TabArray* /*new*/ pango_tab_array_new(int initial_size, int positions_in_pixels) nothrow;
4940 TabArray* /*new*/ pango_tab_array_new_with_positions(int size, int positions_in_pixels, TabAlign first_alignment, int first_position, ...) nothrow;
4941 TabArray* /*new*/ pango_tab_array_copy(TabArray* this_) nothrow;
4942 void pango_tab_array_free(TabArray* this_) nothrow;
4943 int pango_tab_array_get_positions_in_pixels(TabArray* this_) nothrow;
4944 int pango_tab_array_get_size(TabArray* this_) nothrow;
4945 void pango_tab_array_get_tab(TabArray* this_, int tab_index, TabAlign* alignment, int* location) nothrow;
4946 void pango_tab_array_get_tabs(TabArray* this_, TabAlign** alignments, int** locations) nothrow;
4947 void pango_tab_array_resize(TabArray* this_, int new_size) nothrow;
4948 void pango_tab_array_set_tab(TabArray* this_, int tab_index, TabAlign alignment, int location) nothrow;
4949 Attribute* pango_attr_background_new(ushort red, ushort green, ushort blue) nothrow;
4950 Attribute* pango_attr_fallback_new(int enable_fallback) nothrow;
4951 Attribute* pango_attr_family_new(char* family) nothrow;
4952 Attribute* pango_attr_foreground_new(ushort red, ushort green, ushort blue) nothrow;
4953 Attribute* pango_attr_gravity_hint_new(GravityHint hint) nothrow;
4954 Attribute* pango_attr_gravity_new(Gravity gravity) nothrow;
4955 Attribute* pango_attr_letter_spacing_new(int letter_spacing) nothrow;
4956 Attribute* pango_attr_rise_new(int rise) nothrow;
4957 Attribute* pango_attr_scale_new(double scale_factor) nothrow;
4958 Attribute* pango_attr_stretch_new(Stretch stretch) nothrow;
4959 Attribute* pango_attr_strikethrough_color_new(ushort red, ushort green, ushort blue) nothrow;
4960 Attribute* pango_attr_strikethrough_new(int strikethrough) nothrow;
4961 Attribute* pango_attr_style_new(Style style) nothrow;
4962 char* pango_attr_type_get_name(AttrType type) nothrow;
4963 AttrType pango_attr_type_register(char* name) nothrow;
4964 Attribute* pango_attr_underline_color_new(ushort red, ushort green, ushort blue) nothrow;
4965 Attribute* pango_attr_underline_new(Underline underline) nothrow;
4966 Attribute* pango_attr_variant_new(Variant variant) nothrow;
4967 Attribute* pango_attr_weight_new(Weight weight) nothrow;
4968 BidiType pango_bidi_type_for_unichar(dchar ch) nothrow;
4969 void pango_break(char* text, int length, Analysis* analysis, LogAttr* attrs, int attrs_len) nothrow;
4970 void pango_extents_to_pixels(Rectangle* inclusive, Rectangle* nearest) nothrow;
4971 Direction pango_find_base_dir(char* text, int length) nothrow;
4972 void pango_find_paragraph_boundary(char* text, int length, int* paragraph_delimiter_index, int* next_paragraph_start) nothrow;
4973 void pango_get_log_attrs(char* text, int length, int level, Language* language, LogAttr* log_attrs, int attrs_len) nothrow;
4974 int pango_get_mirror_char(dchar ch, dchar* mirrored_ch) nothrow;
4975 Gravity pango_gravity_get_for_matrix(Matrix* matrix) nothrow;
4976 Gravity pango_gravity_get_for_script(Script script, Gravity base_gravity, GravityHint hint) nothrow;
4977 Gravity pango_gravity_get_for_script_and_width(Script script, int wide, Gravity base_gravity, GravityHint hint) nothrow;
4978 double pango_gravity_to_rotation(Gravity gravity) nothrow;
4979 int pango_is_zero_width(dchar ch) nothrow;
4980 GLib2.List* pango_itemize(Context* context, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter) nothrow;
4981 GLib2.List* pango_itemize_with_base_dir(Context* context, Direction base_dir, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter) nothrow;
4982 ubyte* pango_log2vis_get_embedding_levels(char* text, int length, Direction* pbase_dir) nothrow;
4983 int pango_parse_enum(Type type, char* str, int* value, int warn, char** possible_values) nothrow;
4984 int pango_parse_markup(char* markup_text, int length, dchar accel_marker, /*out*/ AttrList** attr_list, /*out*/ char** text, /*out*/ dchar* accel_char, GLib2.Error** error) nothrow;
4985 int pango_parse_stretch(char* str, Stretch* stretch, int warn) nothrow;
4986 int pango_parse_style(char* str, Style* style, int warn) nothrow;
4987 int pango_parse_variant(char* str, Variant* variant, int warn) nothrow;
4988 int pango_parse_weight(char* str, Weight* weight, int warn) nothrow;
4989 void pango_quantize_line_geometry(int* thickness, int* position) nothrow;
4990 int pango_read_line(FILE* stream, GLib2.String* str) nothrow;
4991 GLib2.List* pango_reorder_items(GLib2.List* logical_items) nothrow;
4992 int pango_scan_int(char** pos, int* out_) nothrow;
4993 int pango_scan_string(char** pos, GLib2.String* out_) nothrow;
4994 int pango_scan_word(char** pos, GLib2.String* out_) nothrow;
4995 Script pango_script_for_unichar(dchar ch) nothrow;
4996 Language* /*new*/ pango_script_get_sample_language(Script script) nothrow;
4997 void pango_shape(char* text, int length, Analysis* analysis, GlyphString* glyphs) nothrow;
4998 int pango_skip_space(char** pos) nothrow;
4999 char** pango_split_file_list(char* str) nothrow;
5000 char* /*new*/ pango_trim_string(char* str) nothrow;
5001 Direction pango_unichar_direction(dchar ch) nothrow;
5002 int pango_units_from_double(double d) nothrow;
5003 double pango_units_to_double(int i) nothrow;
5004 int pango_version() nothrow;
5005 char* pango_version_check(int required_major, int required_minor, int required_micro) nothrow;
5006 char* pango_version_string() nothrow;