Regenerate. Cogl works now.
[girtod.git] / gtk2 / pango.d
blob3c01863a8198f8495656b6026eb858621821467f
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; }
32 // <--- mixin/Pango__MODULE_HEAD.d ---
34 alias uint Glyph;
35 alias int GlyphUnit;
36 alias GlyphItem LayoutRun;
37 enum int ANALYSIS_FLAG_CENTERED_BASELINE = 1;
38 enum int ATTR_INDEX_FROM_TEXT_BEGINNING = 0;
39 enum Alignment {
40 LEFT = 0,
41 CENTER = 1,
42 RIGHT = 2
44 struct Analysis {
45 EngineShape* shape_engine;
46 EngineLang* lang_engine;
47 Font* font;
48 ubyte level, gravity, flags, script;
49 Language* language;
50 GLib2.SList* extra_attrs;
53 struct AttrClass {
54 AttrType type;
55 // Unintrospectable functionp: copy() / ()
56 extern (C) Attribute* function (Attribute* attr) copy;
57 extern (C) void function (Attribute* attr) destroy;
58 extern (C) int function (Attribute* attr1, Attribute* attr2) equal;
61 struct AttrColor {
62 Attribute attr;
63 Color color;
66 // Unintrospectable callback: AttrDataCopyFunc() / ()
67 extern (C) alias void* function (const(void)* data) AttrDataCopyFunc;
69 extern (C) alias int function (Attribute* attribute, void* data) AttrFilterFunc;
71 struct AttrFloat {
72 Attribute attr;
73 double value;
76 struct AttrFontDesc {
77 Attribute attr;
78 FontDescription* desc;
81 struct AttrInt {
82 Attribute attr;
83 int value;
86 struct AttrIterator {
88 // Unintrospectable method: copy() / pango_attr_iterator_copy()
89 // Copy a #PangoAttrIterator
90 // be freed with pango_attr_iterator_destroy().
91 // RETURNS: the newly allocated #PangoAttrIterator, which should
92 AttrIterator* copy()() {
93 return pango_attr_iterator_copy(&this);
95 // Destroy a #PangoAttrIterator and free all associated memory.
96 void destroy()() {
97 pango_attr_iterator_destroy(&this);
100 // Unintrospectable method: get() / pango_attr_iterator_get()
101 // Find the current attribute of a particular type at the iterator
102 // location. When multiple attributes of the same type overlap,
103 // the attribute whose range starts closest to the current location
104 // is used.
105 // if no attribute of that type applies to the current
106 // location.
107 // RETURNS: the current attribute of the given type, or %NULL
108 // <type>: the type of attribute to find.
109 Attribute* get()(AttrType type) {
110 return pango_attr_iterator_get(&this, type);
113 // VERSION: 1.2
114 // Gets a list of all attributes at the current position of the
115 // iterator.
116 // all attributes for the current range.
117 // To free this value, call pango_attribute_destroy() on
118 // each value and g_slist_free() on the list.
119 // RETURNS: a list of
120 GLib2.SList* /*new*/ get_attrs()() {
121 return pango_attr_iterator_get_attrs(&this);
124 // Get the font and other attributes at the current iterator position.
125 // <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>.
126 // <language>: if non-%NULL, location to store language tag for item, or %NULL if none is found.
127 // <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.
128 void get_font()(FontDescription* desc, Language** language, GLib2.SList** extra_attrs) {
129 pango_attr_iterator_get_font(&this, desc, language, extra_attrs);
132 // Advance the iterator until the next change of style.
133 // RETURNS: %FALSE if the iterator is at the end of the list, otherwise %TRUE
134 int next()() {
135 return pango_attr_iterator_next(&this);
138 // Get the range of the current segment. Note that the
139 // stored return values are signed, not unsigned like
140 // the values in #PangoAttribute. To deal with this API
141 // oversight, stored return values that wouldn't fit into
142 // a signed integer are clamped to %G_MAXINT.
143 // <start>: location to store the start of the range
144 // <end>: location to store the end of the range
145 void range()(int* start, int* end) {
146 pango_attr_iterator_range(&this, start, end);
150 struct AttrLanguage {
151 Attribute attr;
152 Language* value;
155 struct AttrList {
157 // Create a new empty attribute list with a reference count of one.
158 // be freed with pango_attr_list_unref().
159 // RETURNS: the newly allocated #PangoAttrList, which should
160 static AttrList* /*new*/ new_()() {
161 return pango_attr_list_new();
164 // Insert the given attribute into the #PangoAttrList. It will
165 // replace any attributes of the same type on that segment
166 // and be merged with any adjoining attributes that are identical.
167 // This function is slower than pango_attr_list_insert() for
168 // creating a attribute list in order (potentially much slower
169 // for large lists). However, pango_attr_list_insert() is not
170 // suitable for continually changing a set of attributes
171 // since it never removes or combines existing attributes.
172 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
173 void change()(Attribute* attr) {
174 pango_attr_list_change(&this, attr);
177 // Copy @list and return an identical new list.
178 // reference count of one, which should
179 // be freed with pango_attr_list_unref().
180 // Returns %NULL if @list was %NULL.
181 // RETURNS: the newly allocated #PangoAttrList, with a
182 AttrList* /*new*/ copy()() {
183 return pango_attr_list_copy(&this);
186 // Unintrospectable method: filter() / pango_attr_list_filter()
187 // VERSION: 1.2
188 // Given a #PangoAttrList and callback function, removes any elements
189 // of @list for which @func returns %TRUE and inserts them into
190 // a new list.
191 // no attributes of the given types were found.
192 // RETURNS: the new #PangoAttrList or %NULL if
193 // <func>: callback function; returns %TRUE if an attribute should be filtered out.
194 // <data>: Data to be passed to @func
195 AttrList* /*new*/ filter()(AttrFilterFunc func, void* data) {
196 return pango_attr_list_filter(&this, func, data);
199 // Unintrospectable method: get_iterator() / pango_attr_list_get_iterator()
200 // Create a iterator initialized to the beginning of the list.
201 // be freed with pango_attr_iterator_destroy().
202 // RETURNS: the newly allocated #PangoAttrIterator, which should
203 AttrIterator* get_iterator()() {
204 return pango_attr_list_get_iterator(&this);
207 // Insert the given attribute into the #PangoAttrList. It will
208 // be inserted after all other attributes with a matching
209 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
210 void insert()(Attribute* attr) {
211 pango_attr_list_insert(&this, attr);
214 // Insert the given attribute into the #PangoAttrList. It will
215 // be inserted before all other attributes with a matching
216 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
217 void insert_before()(Attribute* attr) {
218 pango_attr_list_insert_before(&this, attr);
221 // VERSION: 1.10
222 // Increase the reference count of the given attribute list by one.
223 // RETURNS: The attribute list passed in
224 AttrList* /*new*/ ref_()() {
225 return pango_attr_list_ref(&this);
228 // This function opens up a hole in @list, fills it in with attributes from
229 // the left, and then merges @other on top of the hole.
230 // This operation is equivalent to stretching every attribute
231 // that applies at position @pos in @list by an amount @len,
232 // and then calling pango_attr_list_change() with a copy
233 // of each attribute in @other in sequence (offset in position by @pos).
234 // This operation proves useful for, for instance, inserting
235 // a pre-edit string in the middle of an edit buffer.
236 // <other>: another #PangoAttrList
237 // <pos>: the position in @list at which to insert @other
238 // <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)
239 void splice()(AttrList* other, int pos, int len) {
240 pango_attr_list_splice(&this, other, pos, len);
243 // Decrease the reference count of the given attribute list by one.
244 // If the result is zero, free the attribute list and the attributes
245 // it contains.
246 void unref()() {
247 pango_attr_list_unref(&this);
251 struct AttrShape {
252 Attribute attr;
253 Rectangle ink_rect, logical_rect;
254 void* data;
255 AttrDataCopyFunc copy_func;
256 GLib2.DestroyNotify destroy_func;
259 struct AttrSize {
260 Attribute attr;
261 int size;
262 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
263 uint, "absolute", 1,
264 uint, "__dummy32A", 31));
267 struct AttrString {
268 Attribute attr;
269 char* value;
272 enum AttrType {
273 INVALID = 0,
274 LANGUAGE = 1,
275 FAMILY = 2,
276 STYLE = 3,
277 WEIGHT = 4,
278 VARIANT = 5,
279 STRETCH = 6,
280 SIZE = 7,
281 FONT_DESC = 8,
282 FOREGROUND = 9,
283 BACKGROUND = 10,
284 UNDERLINE = 11,
285 STRIKETHROUGH = 12,
286 RISE = 13,
287 SHAPE = 14,
288 SCALE = 15,
289 FALLBACK = 16,
290 LETTER_SPACING = 17,
291 UNDERLINE_COLOR = 18,
292 STRIKETHROUGH_COLOR = 19,
293 ABSOLUTE_SIZE = 20,
294 GRAVITY = 21,
295 GRAVITY_HINT = 22
297 struct Attribute {
298 AttrClass* klass;
299 uint start_index, end_index;
302 // Unintrospectable method: copy() / pango_attribute_copy()
303 // Make a copy of an attribute.
304 // freed with pango_attribute_destroy().
305 // RETURNS: the newly allocated #PangoAttribute, which should be
306 Attribute* copy()() {
307 return pango_attribute_copy(&this);
309 // Destroy a #PangoAttribute and free all associated memory.
310 void destroy()() {
311 pango_attribute_destroy(&this);
314 // Compare two attributes for equality. This compares only the
315 // actual value of the two attributes and not the ranges that the
316 // attributes apply to.
317 // RETURNS: %TRUE if the two attributes have the same value.
318 // <attr2>: another #PangoAttribute
319 int equal()(Attribute* attr2) {
320 return pango_attribute_equal(&this, attr2);
323 // VERSION: 1.20
324 // Initializes @attr's klass to @klass,
325 // it's start_index to %PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING
326 // and end_index to %PANGO_ATTR_INDEX_TO_TEXT_END
327 // such that the attribute applies
328 // to the entire text by default.
329 // <klass>: a #PangoAttributeClass
330 void init()(AttrClass* klass) {
331 pango_attribute_init(&this, klass);
336 // The #PangoBidiType type represents the bidirectional character
337 // type of a Unicode character as specified by the
338 // <ulink url="http://www.unicode.org/reports/tr9/">Unicode bidirectional algorithm</ulink>.
339 enum BidiType /* Version 1.22 */ {
340 L = 0,
341 LRE = 1,
342 LRO = 2,
343 R = 3,
344 AL = 4,
345 RLE = 5,
346 RLO = 6,
347 PDF = 7,
348 EN = 8,
349 ES = 9,
350 ET = 10,
351 AN = 11,
352 CS = 12,
353 NSM = 13,
354 BN = 14,
355 B = 15,
356 S = 16,
357 WS = 17,
358 ON = 18
360 struct Color {
361 ushort red, green, blue;
364 // Creates a copy of @src, which should be freed with
365 // pango_color_free(). Primarily used by language bindings,
366 // not that useful otherwise (since colors can just be copied
367 // by assignment in C).
368 // be freed with pango_color_free(), or %NULL
369 // if @src was %NULL.
370 // RETURNS: the newly allocated #PangoColor, which should
371 Color* /*new*/ copy()() {
372 return pango_color_copy(&this);
374 // Frees a color allocated by pango_color_copy().
375 void free()() {
376 pango_color_free(&this);
379 // Fill in the fields of a color from a string specification. The
380 // string can either one of a large set of standard names. (Taken
381 // from the X11 <filename>rgb.txt</filename> file), or it can be a hex value in the
382 // form '&num;rgb' '&num;rrggbb' '&num;rrrgggbbb' or '&num;rrrrggggbbbb' where
383 // 'r', 'g' and 'b' are hex digits of the red, green, and blue
384 // components of the color, respectively. (White in the four
385 // forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and '&num;ffffffffffff')
386 // otherwise false.
387 // RETURNS: %TRUE if parsing of the specifier succeeded,
388 // <spec>: a string specifying the new color
389 int parse()(char* spec) {
390 return pango_color_parse(&this, spec);
393 // VERSION: 1.16
394 // Returns a textual specification of @color in the hexadecimal form
395 // <literal>&num;rrrrggggbbbb</literal>, where <literal>r</literal>,
396 // <literal>g</literal> and <literal>b</literal> are hex digits representing
397 // the red, green, and blue components respectively.
398 // RETURNS: a newly-allocated text string that must be freed with g_free().
399 char* /*new*/ to_string()() {
400 return pango_color_to_string(&this);
404 struct Context /* : GObject.Object */ {
405 alias method_parent this;
406 alias method_parent super_;
407 alias method_parent object;
408 GObject2.Object method_parent;
411 // Creates a new #PangoContext initialized to default values.
412 // This function is not particularly useful as it should always
413 // be followed by a pango_context_set_font_map() call, and the
414 // function pango_font_map_create_context() does these two steps
415 // together and hence users are recommended to use that.
416 // If you are using Pango as part of a higher-level system,
417 // that system may have it's own way of create a #PangoContext.
418 // For instance, the GTK+ toolkit has, among others,
419 // gdk_pango_context_get_for_screen(), and
420 // gtk_widget_get_pango_context(). Use those instead.
421 // be freed with g_object_unref().
422 // RETURNS: the newly allocated #PangoContext, which should
423 static Context* /*new*/ new_()() {
424 return pango_context_new();
427 // Retrieves the base direction for the context. See
428 // pango_context_set_base_dir().
429 // RETURNS: the base direction for the context.
430 Direction get_base_dir()() {
431 return pango_context_get_base_dir(&this);
434 // VERSION: 1.16
435 // Retrieves the base gravity for the context. See
436 // pango_context_set_base_gravity().
437 // RETURNS: the base gravity for the context.
438 Gravity get_base_gravity()() {
439 return pango_context_get_base_gravity(&this);
442 // Retrieve the default font description for the context.
443 // This value must not be modified or freed.
444 // RETURNS: a pointer to the context's default font description.
445 FontDescription* /*new*/ get_font_description()() {
446 return pango_context_get_font_description(&this);
449 // Unintrospectable method: get_font_map() / pango_context_get_font_map()
450 // VERSION: 1.6
451 // Gets the #PangoFontmap used to look up fonts for this context.
452 // is owned by Pango and should not be unreferenced.
453 // RETURNS: the font map for the #PangoContext. This value
454 FontMap* get_font_map()() {
455 return pango_context_get_font_map(&this);
458 // VERSION: 1.16
459 // Retrieves the gravity for the context. This is similar to
460 // pango_context_get_base_gravity(), except for when the base gravity
461 // is %PANGO_GRAVITY_AUTO for which pango_gravity_get_for_matrix() is used
462 // to return the gravity from the current context matrix.
463 // RETURNS: the resolved gravity for the context.
464 Gravity get_gravity()() {
465 return pango_context_get_gravity(&this);
468 // VERSION: 1.16
469 // Retrieves the gravity hint for the context. See
470 // pango_context_set_gravity_hint() for details.
471 // RETURNS: the gravity hint for the context.
472 GravityHint get_gravity_hint()() {
473 return pango_context_get_gravity_hint(&this);
476 // Retrieves the global language tag for the context.
477 // RETURNS: the global language tag.
478 Language* /*new*/ get_language()() {
479 return pango_context_get_language(&this);
482 // VERSION: 1.6
483 // Gets the transformation matrix that will be applied when
484 // rendering with this context. See pango_context_set_matrix().
485 // (which is the same as the identity matrix). The returned
486 // matrix is owned by Pango and must not be modified or
487 // freed.
488 // RETURNS: the matrix, or %NULL if no matrix has been set
489 Matrix* get_matrix()() {
490 return pango_context_get_matrix(&this);
493 // Get overall metric information for a particular font
494 // description. Since the metrics may be substantially different for
495 // different scripts, a language tag can be provided to indicate that
496 // the metrics should be retrieved that correspond to the script(s)
497 // used by that language.
498 // The #PangoFontDescription is interpreted in the same way as
499 // by pango_itemize(), and the family name may be a comma separated
500 // list of figures. If characters from multiple of these families
501 // would be used to render the string, then the returned fonts would
502 // be a composite of the metrics for the fonts loaded for the
503 // individual families.
504 // when finished using the object.
505 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
506 // <desc>: a #PangoFontDescription structure. %NULL means that the font description from the context will be used.
507 // <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.
508 FontMetrics* /*new*/ get_metrics()(FontDescription* desc, Language* language) {
509 return pango_context_get_metrics(&this, desc, language);
512 // List all families for a context.
513 // <families>: location to store a pointer to an array of #PangoFontFamily *. This array should be freed with g_free().
514 // <n_families>: location to store the number of elements in @descs
515 void list_families()(FontFamily*** families, int* n_families) {
516 pango_context_list_families(&this, families, n_families);
519 // Unintrospectable method: load_font() / pango_context_load_font()
520 // Loads the font in one of the fontmaps in the context
521 // that is the closest match for @desc.
522 // RETURNS: the font loaded, or %NULL if no font matched.
523 // <desc>: a #PangoFontDescription describing the font to load
524 Font* load_font()(FontDescription* desc) {
525 return pango_context_load_font(&this, desc);
528 // Unintrospectable method: load_fontset() / pango_context_load_fontset()
529 // Load a set of fonts in the context that can be used to render
530 // a font matching @desc.
531 // RETURNS: the fontset, or %NULL if no font matched.
532 // <desc>: a #PangoFontDescription describing the fonts to load
533 // <language>: a #PangoLanguage the fonts will be used for
534 Fontset* load_fontset()(FontDescription* desc, Language* language) {
535 return pango_context_load_fontset(&this, desc, language);
538 // Sets the base direction for the context.
539 // The base direction is used in applying the Unicode bidirectional
540 // algorithm; if the @direction is %PANGO_DIRECTION_LTR or
541 // %PANGO_DIRECTION_RTL, then the value will be used as the paragraph
542 // direction in the Unicode bidirectional algorithm. A value of
543 // %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only
544 // for paragraphs that do not contain any strong characters themselves.
545 // <direction>: the new base direction
546 void set_base_dir()(Direction direction) {
547 pango_context_set_base_dir(&this, direction);
550 // VERSION: 1.16
551 // Sets the base gravity for the context.
552 // The base gravity is used in laying vertical text out.
553 // <gravity>: the new base gravity
554 void set_base_gravity()(Gravity gravity) {
555 pango_context_set_base_gravity(&this, gravity);
558 // Set the default font description for the context
559 // <desc>: the new pango font description
560 void set_font_description()(FontDescription* desc) {
561 pango_context_set_font_description(&this, desc);
564 // Sets the font map to be searched when fonts are looked-up in this context.
565 // This is only for internal use by Pango backends, a #PangoContext obtained
566 // via one of the recommended methods should already have a suitable font map.
567 // <font_map>: the #PangoFontMap to set.
568 void set_font_map()(FontMap* font_map) {
569 pango_context_set_font_map(&this, font_map);
572 // VERSION: 1.16
573 // Sets the gravity hint for the context.
574 // The gravity hint is used in laying vertical text out, and is only relevant
575 // if gravity of the context as returned by pango_context_get_gravity()
576 // is set %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST.
577 // <hint>: the new gravity hint
578 void set_gravity_hint()(GravityHint hint) {
579 pango_context_set_gravity_hint(&this, hint);
582 // Sets the global language tag for the context. The default language
583 // for the locale of the running process can be found using
584 // pango_language_get_default().
585 // <language>: the new language tag.
586 void set_language()(Language* language) {
587 pango_context_set_language(&this, language);
590 // VERSION: 1.6
591 // Sets the transformation matrix that will be applied when rendering
592 // with this context. Note that reported metrics are in the user space
593 // coordinates before the application of the matrix, not device-space
594 // coordinates after the application of the matrix. So, they don't scale
595 // with the matrix, though they may change slightly for different
596 // matrices, depending on how the text is fit to the pixel grid.
597 // <matrix>: a #PangoMatrix, or %NULL to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)
598 void set_matrix()(Matrix* matrix) {
599 pango_context_set_matrix(&this, matrix);
603 struct ContextClass {
606 struct Coverage {
608 // Unintrospectable method: copy() / pango_coverage_copy()
609 // Copy an existing #PangoCoverage. (This function may now be unnecessary
610 // since we refcount the structure. File a bug if you use it.)
611 // with a reference count of one, which
612 // should be freed with pango_coverage_unref().
613 // RETURNS: the newly allocated #PangoCoverage,
614 Coverage* copy()() {
615 return pango_coverage_copy(&this);
618 // Determine whether a particular index is covered by @coverage
619 // RETURNS: the coverage level of @coverage for character @index_.
620 // <index_>: the index to check
621 CoverageLevel get()(int index_) {
622 return pango_coverage_get(&this, index_);
625 // Set the coverage for each index in @coverage to be the max (better)
626 // value of the current coverage for the index and the coverage for
627 // the corresponding index in @other.
628 // <other>: another #PangoCoverage
629 void max()(Coverage* other) {
630 pango_coverage_max(&this, other);
633 // Unintrospectable method: ref() / pango_coverage_ref()
634 // Increase the reference count on the #PangoCoverage by one
635 // RETURNS: @coverage
636 Coverage* ref_()() {
637 return pango_coverage_ref(&this);
640 // Modify a particular index within @coverage
641 // <index_>: the index to modify
642 // <level>: the new level for @index_
643 void set()(int index_, CoverageLevel level) {
644 pango_coverage_set(&this, index_, level);
647 // Convert a #PangoCoverage structure into a flat binary format
648 // <bytes>: location to store result (must be freed with g_free())
649 // <n_bytes>: location to store size of result
650 void to_bytes()(ubyte** bytes, int* n_bytes) {
651 pango_coverage_to_bytes(&this, bytes, n_bytes);
654 // Decrease the reference count on the #PangoCoverage by one.
655 // If the result is zero, free the coverage and all associated memory.
656 void unref()() {
657 pango_coverage_unref(&this);
661 enum CoverageLevel {
662 NONE = 0,
663 FALLBACK = 1,
664 APPROXIMATE = 2,
665 EXACT = 3
668 // The #PangoDirection type represents a direction in the
669 // Unicode bidirectional algorithm; not every value in this
670 // enumeration makes sense for every usage of #PangoDirection;
671 // for example, the return value of pango_unichar_direction()
672 // and pango_find_base_dir() cannot be %PANGO_DIRECTION_WEAK_LTR
673 // or %PANGO_DIRECTION_WEAK_RTL, since every character is either
674 // neutral or has a strong direction; on the other hand
675 // %PANGO_DIRECTION_NEUTRAL doesn't make sense to pass
676 // to pango_itemize_with_base_dir().
677 // The %PANGO_DIRECTION_TTB_LTR, %PANGO_DIRECTION_TTB_RTL
678 // values come from an earlier interpretation of this
679 // enumeration as the writing direction of a block of
680 // text and are no longer used; See #PangoGravity for how
681 // vertical text is handled in Pango.
682 enum Direction {
683 LTR = 0,
684 RTL = 1,
685 TTB_LTR = 2,
686 TTB_RTL = 3,
687 WEAK_LTR = 4,
688 WEAK_RTL = 5,
689 NEUTRAL = 6
691 enum ENGINE_TYPE_LANG = "PangoEngineLang";
692 enum ENGINE_TYPE_SHAPE = "PangoEngineShape";
694 // The #PangoEllipsizeMode type describes what sort of (if any)
695 // ellipsization should be applied to a line of text. In
696 // the ellipsization process characters are removed from the
697 // text in order to make it fit to a given width and replaced
698 // with an ellipsis.
699 enum EllipsizeMode {
700 NONE = 0,
701 START = 1,
702 MIDDLE = 2,
703 END = 3
705 struct EngineLang {
708 struct EngineShape {
711 struct Font /* : GObject.Object */ {
712 alias method_parent this;
713 alias method_parent super_;
714 alias method_parent object;
715 GObject2.Object method_parent;
718 // Frees an array of font descriptions.
719 // <descs>: a pointer to an array of #PangoFontDescription, may be %NULL
720 // <n_descs>: number of font descriptions in @descs
721 static void descriptions_free()(FontDescription** descs, int n_descs) {
722 pango_font_descriptions_free(descs, n_descs);
725 // Returns a description of the font, with font size set in points.
726 // Use pango_font_describe_with_absolute_size() if you want the font
727 // size in device units.
728 // RETURNS: a newly-allocated #PangoFontDescription object.
729 FontDescription* /*new*/ describe()() {
730 return pango_font_describe(&this);
733 // VERSION: 1.14
734 // Returns a description of the font, with absolute font size set
735 // (in device units). Use pango_font_describe() if you want the font
736 // size in points.
737 // RETURNS: a newly-allocated #PangoFontDescription object.
738 FontDescription* /*new*/ describe_with_absolute_size()() {
739 return pango_font_describe_with_absolute_size(&this);
742 // Unintrospectable method: find_shaper() / pango_font_find_shaper()
743 // Finds the best matching shaper for a font for a particular
744 // language tag and character point.
745 // RETURNS: the best matching shaper.
746 // <language>: the language tag
747 // <ch>: a Unicode character.
748 EngineShape* find_shaper()(Language* language, uint ch) {
749 return pango_font_find_shaper(&this, language, ch);
752 // Unintrospectable method: get_coverage() / pango_font_get_coverage()
753 // Computes the coverage map for a given font and language tag.
754 // RETURNS: a newly-allocated #PangoCoverage object.
755 // <language>: the language tag
756 Coverage* get_coverage()(Language* language) {
757 return pango_font_get_coverage(&this, language);
760 // Unintrospectable method: get_font_map() / pango_font_get_font_map()
761 // VERSION: 1.10
762 // Gets the font map for which the font was created.
763 // Note that the font maintains a <firstterm>weak</firstterm> reference
764 // to the font map, so if all references to font map are dropped, the font
765 // map will be finalized even if there are fonts created with the font
766 // map that are still alive. In that case this function will return %NULL.
767 // It is the responsibility of the user to ensure that the font map is kept
768 // alive. In most uses this is not an issue as a #PangoContext holds
769 // a reference to the font map.
770 // RETURNS: the #PangoFontMap for the font, or %NULL if @font is %NULL.
771 FontMap* get_font_map()() {
772 return pango_font_get_font_map(&this);
775 // Gets the logical and ink extents of a glyph within a font. The
776 // coordinate system for each rectangle has its origin at the
777 // base line and horizontal origin of the character with increasing
778 // coordinates extending to the right and down. The macros PANGO_ASCENT(),
779 // PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert
780 // from the extents rectangle to more traditional font metrics. The units
781 // of the rectangles are in 1/PANGO_SCALE of a device unit.
782 // If @font is %NULL, this function gracefully sets some sane values in the
783 // output variables and returns.
784 // <glyph>: the glyph index
785 // <ink_rect>: rectangle used to store the extents of the glyph as drawn or %NULL to indicate that the result is not needed.
786 // <logical_rect>: rectangle used to store the logical extents of the glyph or %NULL to indicate that the result is not needed.
787 void get_glyph_extents()(Glyph glyph, Rectangle* ink_rect, Rectangle* logical_rect) {
788 pango_font_get_glyph_extents(&this, glyph, ink_rect, logical_rect);
791 // Gets overall metric information for a font. Since the metrics may be
792 // substantially different for different scripts, a language tag can
793 // be provided to indicate that the metrics should be retrieved that
794 // correspond to the script(s) used by that language.
795 // If @font is %NULL, this function gracefully sets some sane values in the
796 // output variables and returns.
797 // when finished using the object.
798 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
799 // <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.
800 FontMetrics* /*new*/ get_metrics()(Language* language) {
801 return pango_font_get_metrics(&this, language);
805 struct FontDescription {
807 // Creates a new font description structure with all fields unset.
808 // should be freed using pango_font_description_free().
809 // RETURNS: the newly allocated #PangoFontDescription, which
810 static FontDescription* /*new*/ new_()() {
811 return pango_font_description_new();
814 // Determines if the style attributes of @new_match are a closer match
815 // for @desc than those of @old_match are, or if @old_match is %NULL,
816 // determines if @new_match is a match at all.
817 // Approximate matching is done for
818 // weight and style; other style attributes must match exactly.
819 // Style attributes are all attributes other than family and size-related
820 // attributes. Approximate matching for style considers PANGO_STYLE_OBLIQUE
821 // and PANGO_STYLE_ITALIC as matches, but not as good a match as when the
822 // styles are equal.
823 // Note that @old_match must match @desc.
824 // RETURNS: %TRUE if @new_match is a better match
825 // <old_match>: a #PangoFontDescription, or %NULL
826 // <new_match>: a #PangoFontDescription
827 int better_match()(FontDescription* old_match, FontDescription* new_match) {
828 return pango_font_description_better_match(&this, old_match, new_match);
831 // Make a copy of a #PangoFontDescription.
832 // be freed with pango_font_description_free(), or %NULL
833 // if @desc was %NULL.
834 // RETURNS: the newly allocated #PangoFontDescription, which should
835 FontDescription* /*new*/ copy()() {
836 return pango_font_description_copy(&this);
839 // Like pango_font_description_copy(), but only a shallow copy is made
840 // of the family name and other allocated fields. The result can only
841 // be used until @desc is modified or freed. This is meant to be used
842 // when the copy is only needed temporarily.
843 // be freed with pango_font_description_free(), or %NULL
844 // if @desc was %NULL.
845 // RETURNS: the newly allocated #PangoFontDescription, which should
846 FontDescription* /*new*/ copy_static()() {
847 return pango_font_description_copy_static(&this);
850 // Compares two font descriptions for equality. Two font descriptions
851 // are considered equal if the fonts they describe are provably identical.
852 // This means that their masks do not have to match, as long as other fields
853 // are all the same. (Two font descriptions may result in identical fonts
854 // being loaded, but still compare %FALSE.)
855 // %FALSE otherwise.
856 // RETURNS: %TRUE if the two font descriptions are identical,
857 // <desc2>: another #PangoFontDescription
858 int equal()(FontDescription* desc2) {
859 return pango_font_description_equal(&this, desc2);
861 // Frees a font description.
862 void free()() {
863 pango_font_description_free(&this);
866 // Gets the family name field of a font description. See
867 // pango_font_description_set_family().
868 // %NULL if not previously set. This has the same life-time
869 // as the font description itself and should not be freed.
870 // RETURNS: the family name field for the font description, or
871 char* get_family()() {
872 return pango_font_description_get_family(&this);
875 // VERSION: 1.16
876 // Gets the gravity field of a font description. See
877 // pango_font_description_set_gravity().
878 // pango_font_description_get_set_fields() to find out if
879 // the field was explicitly set or not.
880 // RETURNS: the gravity field for the font description. Use
881 Gravity get_gravity()() {
882 return pango_font_description_get_gravity(&this);
885 // Determines which fields in a font description have been set.
886 // fields in @desc that have been set.
887 // RETURNS: a bitmask with bits set corresponding to the
888 FontMask get_set_fields()() {
889 return pango_font_description_get_set_fields(&this);
892 // Gets the size field of a font description.
893 // See pango_font_description_set_size().
894 // You must call pango_font_description_get_size_is_absolute()
895 // to find out which is the case. Returns 0 if the size field has not
896 // previously been set or it has been set to 0 explicitly.
897 // Use pango_font_description_get_set_fields() to
898 // find out if the field was explicitly set or not.
899 // RETURNS: the size field for the font description in points or device units.
900 int get_size()() {
901 return pango_font_description_get_size(&this);
904 // VERSION: 1.8
905 // Determines whether the size of the font is in points (not absolute) or device units (absolute).
906 // See pango_font_description_set_size() and pango_font_description_set_absolute_size().
907 // points or device units. Use pango_font_description_get_set_fields() to
908 // find out if the size field of the font description was explicitly set or not.
909 // RETURNS: whether the size for the font description is in
910 int get_size_is_absolute()() {
911 return pango_font_description_get_size_is_absolute(&this);
914 // Gets the stretch field of a font description.
915 // See pango_font_description_set_stretch().
916 // pango_font_description_get_set_fields() to find out if
917 // the field was explicitly set or not.
918 // RETURNS: the stretch field for the font description. Use
919 Stretch get_stretch()() {
920 return pango_font_description_get_stretch(&this);
923 // Gets the style field of a #PangoFontDescription. See
924 // pango_font_description_set_style().
925 // Use pango_font_description_get_set_fields() to find out if
926 // the field was explicitly set or not.
927 // RETURNS: the style field for the font description.
928 Style get_style()() {
929 return pango_font_description_get_style(&this);
932 // Gets the variant field of a #PangoFontDescription. See
933 // pango_font_description_set_variant().
934 // pango_font_description_get_set_fields() to find out if
935 // the field was explicitly set or not.
936 // RETURNS: the variant field for the font description. Use
937 Variant get_variant()() {
938 return pango_font_description_get_variant(&this);
941 // Gets the weight field of a font description. See
942 // pango_font_description_set_weight().
943 // pango_font_description_get_set_fields() to find out if
944 // the field was explicitly set or not.
945 // RETURNS: the weight field for the font description. Use
946 Weight get_weight()() {
947 return pango_font_description_get_weight(&this);
950 // Computes a hash of a #PangoFontDescription structure suitable
951 // to be used, for example, as an argument to g_hash_table_new().
952 // The hash value is independent of @desc->mask.
953 // RETURNS: the hash value.
954 uint hash()() {
955 return pango_font_description_hash(&this);
958 // Merges the fields that are set in @desc_to_merge into the fields in
959 // are not already set are affected. If %TRUE, then fields that are
960 // already set will be replaced as well.
961 // If @desc_to_merge is %NULL, this function performs nothing.
962 // <desc_to_merge>: the #PangoFontDescription to merge from, or %NULL
963 // <replace_existing>: if %TRUE, replace fields in @desc with the corresponding values from @desc_to_merge, even if they are already exist.
964 void merge()(FontDescription* desc_to_merge, int replace_existing) {
965 pango_font_description_merge(&this, desc_to_merge, replace_existing);
968 // Like pango_font_description_merge(), but only a shallow copy is made
969 // of the family name and other allocated fields. @desc can only be
970 // used until @desc_to_merge is modified or freed. This is meant
971 // to be used when the merged font description is only needed temporarily.
972 // <desc_to_merge>: the #PangoFontDescription to merge from
973 // <replace_existing>: if %TRUE, replace fields in @desc with the corresponding values from @desc_to_merge, even if they are already exist.
974 void merge_static()(FontDescription* desc_to_merge, int replace_existing) {
975 pango_font_description_merge_static(&this, desc_to_merge, replace_existing);
978 // VERSION: 1.8
979 // Sets the size field of a font description, in device units. This is mutually
980 // exclusive with pango_font_description_set_size() which sets the font size
981 // in points.
982 // <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.
983 void set_absolute_size()(double size) {
984 pango_font_description_set_absolute_size(&this, size);
987 // Sets the family name field of a font description. The family
988 // name represents a family of related font styles, and will
989 // resolve to a particular #PangoFontFamily. In some uses of
990 // #PangoFontDescription, it is also possible to use a comma
991 // separated list of family names for this field.
992 // <family>: a string representing the family name.
993 void set_family()(char* family) {
994 pango_font_description_set_family(&this, family);
997 // Like pango_font_description_set_family(), except that no
998 // copy of @family is made. The caller must make sure that the
999 // string passed in stays around until @desc has been freed
1000 // or the name is set again. This function can be used if
1001 // if @desc is only needed temporarily.
1002 // <family>: a string representing the family name.
1003 void set_family_static()(char* family) {
1004 pango_font_description_set_family_static(&this, family);
1007 // VERSION: 1.16
1008 // Sets the gravity field of a font description. The gravity field
1009 // specifies how the glyphs should be rotated. If @gravity is
1010 // %PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on
1011 // the font description.
1012 // This function is seldom useful to the user. Gravity should normally
1013 // be set on a #PangoContext.
1014 // <gravity>: the gravity for the font description.
1015 void set_gravity()(Gravity gravity) {
1016 pango_font_description_set_gravity(&this, gravity);
1019 // Sets the size field of a font description in fractional points. This is mutually
1020 // exclusive with pango_font_description_set_absolute_size().
1021 // <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.
1022 void set_size()(int size) {
1023 pango_font_description_set_size(&this, size);
1026 // Sets the stretch field of a font description. The stretch field
1027 // specifies how narrow or wide the font should be.
1028 // <stretch>: the stretch for the font description
1029 void set_stretch()(Stretch stretch) {
1030 pango_font_description_set_stretch(&this, stretch);
1033 // Sets the style field of a #PangoFontDescription. The
1034 // #PangoStyle enumeration describes whether the font is slanted and
1035 // the manner in which it is slanted; it can be either
1036 // #PANGO_STYLE_NORMAL, #PANGO_STYLE_ITALIC, or #PANGO_STYLE_OBLIQUE.
1037 // Most fonts will either have a italic style or an oblique
1038 // style, but not both, and font matching in Pango will
1039 // match italic specifications with oblique fonts and vice-versa
1040 // if an exact match is not found.
1041 // <style>: the style for the font description
1042 void set_style()(Style style) {
1043 pango_font_description_set_style(&this, style);
1046 // Sets the variant field of a font description. The #PangoVariant
1047 // can either be %PANGO_VARIANT_NORMAL or %PANGO_VARIANT_SMALL_CAPS.
1048 // <variant>: the variant type for the font description.
1049 void set_variant()(Variant variant) {
1050 pango_font_description_set_variant(&this, variant);
1053 // Sets the weight field of a font description. The weight field
1054 // specifies how bold or light the font should be. In addition
1055 // to the values of the #PangoWeight enumeration, other intermediate
1056 // numeric values are possible.
1057 // <weight>: the weight for the font description.
1058 void set_weight()(Weight weight) {
1059 pango_font_description_set_weight(&this, weight);
1062 // Creates a filename representation of a font description. The
1063 // filename is identical to the result from calling
1064 // pango_font_description_to_string(), but with underscores instead of
1065 // characters that are untypical in filenames, and in lower case only.
1066 // RETURNS: a new string that must be freed with g_free().
1067 char* /*new*/ to_filename()() {
1068 return pango_font_description_to_filename(&this);
1071 // Creates a string representation of a font description. See
1072 // pango_font_description_from_string() for a description of the
1073 // format of the string representation. The family list in the
1074 // string description will only have a terminating comma if the
1075 // last word of the list is a valid style option.
1076 // RETURNS: a new string that must be freed with g_free().
1077 char* /*new*/ to_string()() {
1078 return pango_font_description_to_string(&this);
1081 // Unsets some of the fields in a #PangoFontDescription. The unset
1082 // fields will get back to their default values.
1083 // <to_unset>: bitmask of fields in the @desc to unset.
1084 void unset_fields()(FontMask to_unset) {
1085 pango_font_description_unset_fields(&this, to_unset);
1089 struct FontFace /* : GObject.Object */ {
1090 alias method_parent this;
1091 alias method_parent super_;
1092 alias method_parent object;
1093 GObject2.Object method_parent;
1096 // Returns the family, style, variant, weight and stretch of
1097 // a #PangoFontFace. The size field of the resulting font description
1098 // will be unset.
1099 // holding the description of the face. Use pango_font_description_free()
1100 // to free the result.
1101 // RETURNS: a newly-created #PangoFontDescription structure
1102 FontDescription* /*new*/ describe()() {
1103 return pango_font_face_describe(&this);
1106 // Gets a name representing the style of this face among the
1107 // different faces in the #PangoFontFamily for the face. This
1108 // name is unique among all faces in the family and is suitable
1109 // for displaying to users.
1110 // owned by the face object and must not be modified or freed.
1111 // RETURNS: the face name for the face. This string is
1112 char* get_face_name()() {
1113 return pango_font_face_get_face_name(&this);
1116 // VERSION: 1.18
1117 // Returns whether a #PangoFontFace is synthesized by the underlying
1118 // font rendering engine from another face, perhaps by shearing, emboldening,
1119 // or lightening it.
1120 // RETURNS: whether @face is synthesized.
1121 int is_synthesized()() {
1122 return pango_font_face_is_synthesized(&this);
1125 // VERSION: 1.4
1126 // List the available sizes for a font. This is only applicable to bitmap
1127 // fonts. For scalable fonts, stores %NULL at the location pointed to by
1128 // are in Pango units and are sorted in ascending order.
1129 // <sizes>: location to store a pointer to an array of int. This array should be freed with g_free().
1130 // <n_sizes>: location to store the number of elements in @sizes
1131 void list_sizes()(int** sizes, int* n_sizes) {
1132 pango_font_face_list_sizes(&this, sizes, n_sizes);
1136 struct FontFamily /* : GObject.Object */ {
1137 alias method_parent this;
1138 alias method_parent super_;
1139 alias method_parent object;
1140 GObject2.Object method_parent;
1143 // Gets the name of the family. The name is unique among all
1144 // fonts for the font backend and can be used in a #PangoFontDescription
1145 // to specify that a face from this family is desired.
1146 // by the family object and must not be modified or freed.
1147 // RETURNS: the name of the family. This string is owned
1148 char* get_name()() {
1149 return pango_font_family_get_name(&this);
1152 // VERSION: 1.4
1153 // A monospace font is a font designed for text display where the the
1154 // characters form a regular grid. For Western languages this would
1155 // mean that the advance width of all characters are the same, but
1156 // this categorization also includes Asian fonts which include
1157 // g_unichar_iswide() returns a result that indicates whether a
1158 // character is typically double-width in a monospace font.
1159 // The best way to find out the grid-cell size is to call
1160 // pango_font_metrics_get_approximate_digit_width(), since the results
1161 // of pango_font_metrics_get_approximate_char_width() may be affected
1162 // by double-width characters.
1163 // RETURNS: %TRUE if the family is monospace.
1164 int is_monospace()() {
1165 return pango_font_family_is_monospace(&this);
1168 // Lists the different font faces that make up @family. The faces
1169 // in a family share a common design, but differ in slant, weight,
1170 // width and other aspects.
1171 // <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.
1172 // <n_faces>: location to store number of elements in @faces.
1173 void list_faces()(FontFace*** faces, int* n_faces) {
1174 pango_font_family_list_faces(&this, faces, n_faces);
1178 struct FontMap /* : GObject.Object */ {
1179 alias method_parent this;
1180 alias method_parent super_;
1181 alias method_parent object;
1182 GObject2.Object method_parent;
1185 // Unintrospectable method: create_context() / pango_font_map_create_context()
1186 // VERSION: 1.22
1187 // Creates a #PangoContext connected to @fontmap. This is equivalent
1188 // to pango_context_new() followed by pango_context_set_font_map().
1189 // If you are using Pango as part of a higher-level system,
1190 // that system may have it's own way of create a #PangoContext.
1191 // For instance, the GTK+ toolkit has, among others,
1192 // gdk_pango_context_get_for_screen(), and
1193 // gtk_widget_get_pango_context(). Use those instead.
1194 // be freed with g_object_unref().
1195 // RETURNS: the newly allocated #PangoContext, which should
1196 Context* create_context()() {
1197 return pango_font_map_create_context(&this);
1200 // List all families for a fontmap.
1201 // <families>: location to store a pointer to an array of #PangoFontFamily *. This array should be freed with g_free().
1202 // <n_families>: location to store the number of elements in @families
1203 void list_families()(FontFamily*** families, int* n_families) {
1204 pango_font_map_list_families(&this, families, n_families);
1207 // Unintrospectable method: load_font() / pango_font_map_load_font()
1208 // Load the font in the fontmap that is the closest match for @desc.
1209 // RETURNS: the font loaded, or %NULL if no font matched.
1210 // <context>: the #PangoContext the font will be used with
1211 // <desc>: a #PangoFontDescription describing the font to load
1212 Font* load_font()(Context* context, FontDescription* desc) {
1213 return pango_font_map_load_font(&this, context, desc);
1216 // Unintrospectable method: load_fontset() / pango_font_map_load_fontset()
1217 // Load a set of fonts in the fontmap that can be used to render
1218 // a font matching @desc.
1219 // RETURNS: the fontset, or %NULL if no font matched.
1220 // <context>: the #PangoContext the font will be used with
1221 // <desc>: a #PangoFontDescription describing the font to load
1222 // <language>: a #PangoLanguage the fonts will be used for
1223 Fontset* load_fontset()(Context* context, FontDescription* desc, Language* language) {
1224 return pango_font_map_load_fontset(&this, context, desc, language);
1228 enum FontMask {
1229 FAMILY = 1,
1230 STYLE = 2,
1231 VARIANT = 4,
1232 WEIGHT = 8,
1233 STRETCH = 16,
1234 SIZE = 32,
1235 GRAVITY = 64
1237 struct FontMetrics {
1239 // Gets the approximate character width for a font metrics structure.
1240 // This is merely a representative value useful, for example, for
1241 // determining the initial size for a window. Actual characters in
1242 // text will be wider and narrower than this.
1243 // RETURNS: the character width, in Pango units.
1244 int get_approximate_char_width()() {
1245 return pango_font_metrics_get_approximate_char_width(&this);
1248 // Gets the approximate digit width for a font metrics structure.
1249 // This is merely a representative value useful, for example, for
1250 // determining the initial size for a window. Actual digits in
1251 // text can be wider or narrower than this, though this value
1252 // is generally somewhat more accurate than the result of
1253 // pango_font_metrics_get_approximate_char_width() for digits.
1254 // RETURNS: the digit width, in Pango units.
1255 int get_approximate_digit_width()() {
1256 return pango_font_metrics_get_approximate_digit_width(&this);
1259 // Gets the ascent from a font metrics structure. The ascent is
1260 // the distance from the baseline to the logical top of a line
1261 // of text. (The logical top may be above or below the top of the
1262 // actual drawn ink. It is necessary to lay out the text to figure
1263 // where the ink will be.)
1264 // RETURNS: the ascent, in Pango units.
1265 int get_ascent()() {
1266 return pango_font_metrics_get_ascent(&this);
1269 // Gets the descent from a font metrics structure. The descent is
1270 // the distance from the baseline to the logical bottom of a line
1271 // of text. (The logical bottom may be above or below the bottom of the
1272 // actual drawn ink. It is necessary to lay out the text to figure
1273 // where the ink will be.)
1274 // RETURNS: the descent, in Pango units.
1275 int get_descent()() {
1276 return pango_font_metrics_get_descent(&this);
1279 // VERSION: 1.6
1280 // Gets the suggested position to draw the strikethrough.
1281 // The value returned is the distance <emphasis>above</emphasis> the
1282 // baseline of the top of the strikethrough.
1283 // RETURNS: the suggested strikethrough position, in Pango units.
1284 int get_strikethrough_position()() {
1285 return pango_font_metrics_get_strikethrough_position(&this);
1288 // VERSION: 1.6
1289 // Gets the suggested thickness to draw for the strikethrough.
1290 // RETURNS: the suggested strikethrough thickness, in Pango units.
1291 int get_strikethrough_thickness()() {
1292 return pango_font_metrics_get_strikethrough_thickness(&this);
1295 // VERSION: 1.6
1296 // Gets the suggested position to draw the underline.
1297 // The value returned is the distance <emphasis>above</emphasis> the
1298 // baseline of the top of the underline. Since most fonts have
1299 // underline positions beneath the baseline, this value is typically
1300 // negative.
1301 // RETURNS: the suggested underline position, in Pango units.
1302 int get_underline_position()() {
1303 return pango_font_metrics_get_underline_position(&this);
1306 // VERSION: 1.6
1307 // Gets the suggested thickness to draw for the underline.
1308 // RETURNS: the suggested underline thickness, in Pango units.
1309 int get_underline_thickness()() {
1310 return pango_font_metrics_get_underline_thickness(&this);
1313 // Increase the reference count of a font metrics structure by one.
1314 // RETURNS: @metrics
1315 FontMetrics* /*new*/ ref_()() {
1316 return pango_font_metrics_ref(&this);
1319 // Decrease the reference count of a font metrics structure by one. If
1320 // the result is zero, frees the structure and any associated
1321 // memory.
1322 void unref()() {
1323 pango_font_metrics_unref(&this);
1327 struct Fontset /* : GObject.Object */ {
1328 alias method_parent this;
1329 alias method_parent super_;
1330 alias method_parent object;
1331 GObject2.Object method_parent;
1334 // Unintrospectable method: foreach() / pango_fontset_foreach()
1335 // VERSION: 1.4
1336 // Iterates through all the fonts in a fontset, calling @func for
1337 // each one. If @func returns %TRUE, that stops the iteration.
1338 // <func>: Callback function
1339 // <data>: data to pass to the callback function
1340 void foreach_()(FontsetForeachFunc func, void* data) {
1341 pango_fontset_foreach(&this, func, data);
1344 // Unintrospectable method: get_font() / pango_fontset_get_font()
1345 // Returns the font in the fontset that contains the best glyph for the
1346 // Unicode character @wc.
1347 // with the font.
1348 // RETURNS: a #PangoFont. The caller must call g_object_unref when finished
1349 // <wc>: a Unicode character
1350 Font* get_font()(uint wc) {
1351 return pango_fontset_get_font(&this, wc);
1354 // Get overall metric information for the fonts in the fontset.
1355 // when finished using the object.
1356 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
1357 FontMetrics* /*new*/ get_metrics()() {
1358 return pango_fontset_get_metrics(&this);
1363 // VERSION: 1.4
1364 // A callback function used by pango_fontset_foreach() when enumerating
1365 // the fonts in a fontset.
1366 // RETURNS: if %TRUE, stop iteration and return immediately.
1367 // <fontset>: a #PangoFontset
1368 // <font>: a font from @fontset
1369 // <data>: callback data
1370 extern (C) alias int function (Fontset* fontset, Font* font, void* data) FontsetForeachFunc;
1372 struct GlyphGeometry {
1373 GlyphUnit width, x_offset, y_offset;
1376 struct GlyphInfo {
1377 Glyph glyph;
1378 GlyphGeometry geometry;
1379 GlyphVisAttr attr;
1382 struct GlyphItem {
1383 Item* item;
1384 GlyphString* glyphs;
1387 // Unintrospectable method: apply_attrs() / pango_glyph_item_apply_attrs()
1388 // VERSION: 1.2
1389 // Splits a shaped item (PangoGlyphItem) into multiple items based
1390 // on an attribute list. The idea is that if you have attributes
1391 // that don't affect shaping, such as color or underline, to avoid
1392 // affecting shaping, you filter them out (pango_attr_list_filter()),
1393 // apply the shaping process and then reapply them to the result using
1394 // this function.
1395 // All attributes that start or end inside a cluster are applied
1396 // to that cluster; for instance, if half of a cluster is underlined
1397 // and the other-half strikethrough, then the cluster will end
1398 // up with both underline and strikethrough attributes. In these
1399 // cases, it may happen that item->extra_attrs for some of the
1400 // result items can have multiple attributes of the same type.
1401 // This function takes ownership of @glyph_item; it will be reused
1402 // as one of the elements in the list.
1403 // the list using g_slist_free().
1404 // RETURNS: a list of glyph items resulting from splitting
1405 // <text>: text that @list applies to
1406 // <list>: a #PangoAttrList
1407 GLib2.SList* apply_attrs()(char* text, AttrList* list) {
1408 return pango_glyph_item_apply_attrs(&this, text, list);
1411 // VERSION: 1.20
1412 // Make a deep copy of an existing #PangoGlyphItem structure.
1413 // be freed with pango_glyph_item_free(), or %NULL
1414 // if @orig was %NULL.
1415 // RETURNS: the newly allocated #PangoGlyphItem, which should
1416 GlyphItem* /*new*/ copy()() {
1417 return pango_glyph_item_copy(&this);
1420 // VERSION: 1.6
1421 // Frees a #PangoGlyphItem and resources to which it points.
1422 void free()() {
1423 pango_glyph_item_free(&this);
1426 // VERSION: 1.26
1427 // Given a #PangoGlyphItem and the corresponding
1428 // text, determine the screen width corresponding to each character. When
1429 // multiple characters compose a single cluster, the width of the entire
1430 // cluster is divided equally among the characters.
1431 // See also pango_glyph_string_get_logical_widths().
1432 // <text>: text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text)
1433 // <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.
1434 void get_logical_widths()(char* text, int* logical_widths) {
1435 pango_glyph_item_get_logical_widths(&this, text, logical_widths);
1438 // VERSION: 1.6
1439 // Adds spacing between the graphemes of @glyph_item to
1440 // give the effect of typographic letter spacing.
1441 // <text>: text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text)
1442 // <log_attrs>: logical attributes for the item (the first logical attribute refers to the position before the first character in the item)
1443 // <letter_spacing>: amount of letter spacing to add in Pango units. May be negative, though too large negative values will give ugly results.
1444 void letter_space()(char* text, LogAttr* log_attrs, int letter_spacing) {
1445 pango_glyph_item_letter_space(&this, text, log_attrs, letter_spacing);
1448 // VERSION: 1.2
1449 // Modifies @orig to cover only the text after @split_index, and
1450 // returns a new item that covers the text before @split_index that
1451 // used to be in @orig. You can think of @split_index as the length of
1452 // the returned item. @split_index may not be 0, and it may not be
1453 // greater than or equal to the length of @orig (that is, there must
1454 // be at least one byte assigned to each item, you can't create a
1455 // zero-length item).
1456 // This function is similar in function to pango_item_split() (and uses
1457 // it internally.)
1458 // with pango_glyph_item_free().
1459 // RETURNS: the newly allocated item representing text before
1460 // <text>: text to which positions in @orig apply
1461 // <split_index>: byte index of position to split item, relative to the start of the item
1462 GlyphItem* /*new*/ split()(char* text, int split_index) {
1463 return pango_glyph_item_split(&this, text, split_index);
1467 struct GlyphItemIter {
1468 GlyphItem* glyph_item;
1469 char* text;
1470 int start_glyph, start_index, start_char, end_glyph, end_index, end_char;
1473 // VERSION: 1.22
1474 // Make a shallow copy of an existing #PangoGlyphItemIter structure.
1475 // be freed with pango_glyph_item_iter_free(), or %NULL
1476 // if @orig was %NULL.
1477 // RETURNS: the newly allocated #PangoGlyphItemIter, which should
1478 GlyphItemIter* /*new*/ copy()() {
1479 return pango_glyph_item_iter_copy(&this);
1482 // VERSION: 1.22
1483 // Frees a #PangoGlyphItemIter created by pango_glyph_item_iter_copy().
1484 void free()() {
1485 pango_glyph_item_iter_free(&this);
1488 // VERSION: 1.22
1489 // Initializes a #PangoGlyphItemIter structure to point to the
1490 // last cluster in a glyph item.
1491 // See #PangoGlyphItemIter for details of cluster orders.
1492 // RETURNS: %FALSE if there are no clusters in the glyph item
1493 // <glyph_item>: the glyph item to iterate over
1494 // <text>: text corresponding to the glyph item
1495 int init_end()(GlyphItem* glyph_item, char* text) {
1496 return pango_glyph_item_iter_init_end(&this, glyph_item, text);
1499 // VERSION: 1.22
1500 // Initializes a #PangoGlyphItemIter structure to point to the
1501 // first cluster in a glyph item.
1502 // See #PangoGlyphItemIter for details of cluster orders.
1503 // RETURNS: %FALSE if there are no clusters in the glyph item
1504 // <glyph_item>: the glyph item to iterate over
1505 // <text>: text corresponding to the glyph item
1506 int init_start()(GlyphItem* glyph_item, char* text) {
1507 return pango_glyph_item_iter_init_start(&this, glyph_item, text);
1510 // VERSION: 1.22
1511 // Advances the iterator to the next cluster in the glyph item.
1512 // See #PangoGlyphItemIter for details of cluster orders.
1513 // last cluster.
1514 // RETURNS: %TRUE if the iterator was advanced, %FALSE if we were already on the
1515 int next_cluster()() {
1516 return pango_glyph_item_iter_next_cluster(&this);
1519 // VERSION: 1.22
1520 // Moves the iterator to the preceding cluster in the glyph item.
1521 // See #PangoGlyphItemIter for details of cluster orders.
1522 // first cluster.
1523 // RETURNS: %TRUE if the iterator was moved, %FALSE if we were already on the
1524 int prev_cluster()() {
1525 return pango_glyph_item_iter_prev_cluster(&this);
1529 struct GlyphString {
1530 int num_glyphs;
1531 GlyphInfo* glyphs;
1532 int* log_clusters;
1533 private int space;
1536 // Create a new #PangoGlyphString.
1537 // should be freed with pango_glyph_string_free().
1538 // RETURNS: the newly allocated #PangoGlyphString, which
1539 static GlyphString* /*new*/ new_()() {
1540 return pango_glyph_string_new();
1543 // Copy a glyph string and associated storage.
1544 // should be freed with pango_glyph_string_free(),
1545 // or %NULL if @string was %NULL.
1546 // RETURNS: the newly allocated #PangoGlyphString, which
1547 GlyphString* /*new*/ copy()() {
1548 return pango_glyph_string_copy(&this);
1551 // Compute the logical and ink extents of a glyph string. See the documentation
1552 // for pango_font_get_glyph_extents() for details about the interpretation
1553 // of the rectangles.
1554 // <font>: a #PangoFont
1555 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn or %NULL to indicate that the result is not needed.
1556 // <logical_rect>: rectangle used to store the logical extents of the glyph string or %NULL to indicate that the result is not needed.
1557 void extents()(Font* font, Rectangle* ink_rect, Rectangle* logical_rect) {
1558 pango_glyph_string_extents(&this, font, ink_rect, logical_rect);
1561 // or %NULL to indicate that the result is not needed.
1562 // or %NULL to indicate that the result is not needed.
1563 // Computes the extents of a sub-portion of a glyph string. The extents are
1564 // relative to the start of the glyph string range (the origin of their
1565 // coordinate system is at the start of the range, not at the start of the entire
1566 // glyph string).
1567 // <start>: start index
1568 // <end>: end index (the range is the set of bytes with
1569 // <font>: a #PangoFont
1570 // <ink_rect>: rectangle used to store the extents of the glyph string range as drawn
1571 // <logical_rect>: rectangle used to store the logical extents of the glyph string range
1572 void extents_range()(int start, int end, Font* font, Rectangle* ink_rect, Rectangle* logical_rect) {
1573 pango_glyph_string_extents_range(&this, start, end, font, ink_rect, logical_rect);
1575 // Free a glyph string and associated storage.
1576 void free()() {
1577 pango_glyph_string_free(&this);
1580 // Given a #PangoGlyphString resulting from pango_shape() and the corresponding
1581 // text, determine the screen width corresponding to each character. When
1582 // multiple characters compose a single cluster, the width of the entire
1583 // cluster is divided equally among the characters.
1584 // See also pango_glyph_item_get_logical_widths().
1585 // <text>: the text corresponding to the glyphs
1586 // <length>: the length of @text, in bytes
1587 // <embedding_level>: the embedding level of the string
1588 // <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.
1589 void get_logical_widths()(char* text, int length, int embedding_level, int* logical_widths) {
1590 pango_glyph_string_get_logical_widths(&this, text, length, embedding_level, logical_widths);
1593 // VERSION: 1.14
1594 // Computes the logical width of the glyph string as can also be computed
1595 // using pango_glyph_string_extents(). However, since this only computes the
1596 // width, it's much faster. This is in fact only a convenience function that
1597 // computes the sum of geometry.width for each glyph in the @glyphs.
1598 // RETURNS: the logical width of the glyph string.
1599 int get_width()() {
1600 return pango_glyph_string_get_width(&this);
1603 // Converts from character position to x position. (X position
1604 // is measured from the left edge of the run). Character positions
1605 // are computed by dividing up each cluster into equal portions.
1606 // <text>: the text for the run
1607 // <length>: the number of bytes (not characters) in @text.
1608 // <analysis>: the analysis information return from pango_itemize()
1609 // <index_>: the byte index within @text
1610 // <trailing>: whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character.
1611 // <x_pos>: location to store result
1612 void index_to_x()(char* text, int length, Analysis* analysis, int index_, int trailing, int* x_pos) {
1613 pango_glyph_string_index_to_x(&this, text, length, analysis, index_, trailing, x_pos);
1616 // Resize a glyph string to the given length.
1617 // <new_len>: the new length of the string.
1618 void set_size()(int new_len) {
1619 pango_glyph_string_set_size(&this, new_len);
1622 // Convert from x offset to character position. Character positions
1623 // are computed by dividing up each cluster into equal portions.
1624 // In scripts where positioning within a cluster is not allowed
1625 // (such as Thai), the returned value may not be a valid cursor
1626 // position; the caller must combine the result with the logical
1627 // attributes for the text to compute the valid cursor position.
1628 // <text>: the text for the run
1629 // <length>: the number of bytes (not characters) in text.
1630 // <analysis>: the analysis information return from pango_itemize()
1631 // <x_pos>: the x offset (in Pango units)
1632 // <index_>: location to store calculated byte index within @text
1633 // <trailing>: location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.
1634 void x_to_index()(char* text, int length, Analysis* analysis, int x_pos, int* index_, int* trailing) {
1635 pango_glyph_string_x_to_index(&this, text, length, analysis, x_pos, index_, trailing);
1639 struct GlyphVisAttr {
1640 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
1641 uint, "is_cluster_start", 1,
1642 uint, "__dummy32A", 31));
1646 // The #PangoGravity type represents the orientation of glyphs in a segment
1647 // of text. This is useful when rendering vertical text layouts. In
1648 // those situations, the layout is rotated using a non-identity PangoMatrix,
1649 // and then glyph orientation is controlled using #PangoGravity.
1650 // Not every value in this enumeration makes sense for every usage of
1651 // #PangoGravity; for example, %PANGO_GRAVITY_AUTO only can be passed to
1652 // pango_context_set_base_gravity() and can only be returned by
1653 // pango_context_get_base_gravity().
1654 enum Gravity /* Version 1.16 */ {
1655 SOUTH = 0,
1656 EAST = 1,
1657 NORTH = 2,
1658 WEST = 3,
1659 AUTO = 4
1662 // The #PangoGravityHint defines how horizontal scripts should behave in a
1663 // vertical context. That is, English excerpt in a vertical paragraph for
1664 // example.
1665 // See #PangoGravity.
1666 enum GravityHint /* Version 1.16 */ {
1667 NATURAL = 0,
1668 STRONG = 1,
1669 LINE = 2
1671 struct Item {
1672 int offset, length, num_chars;
1673 Analysis analysis;
1676 // Creates a new #PangoItem structure initialized to default values.
1677 // be freed with pango_item_free().
1678 // RETURNS: the newly allocated #PangoItem, which should
1679 static Item* /*new*/ new_()() {
1680 return pango_item_new();
1683 // Copy an existing #PangoItem structure.
1684 // be freed with pango_item_free(), or %NULL if
1685 // RETURNS: the newly allocated #PangoItem, which should
1686 Item* /*new*/ copy()() {
1687 return pango_item_copy(&this);
1689 // Free a #PangoItem and all associated memory.
1690 void free()() {
1691 pango_item_free(&this);
1694 // Modifies @orig to cover only the text after @split_index, and
1695 // returns a new item that covers the text before @split_index that
1696 // used to be in @orig. You can think of @split_index as the length of
1697 // the returned item. @split_index may not be 0, and it may not be
1698 // greater than or equal to the length of @orig (that is, there must
1699 // be at least one byte assigned to each item, you can't create a
1700 // zero-length item). @split_offset is the length of the first item in
1701 // chars, and must be provided because the text used to generate the
1702 // item isn't available, so pango_item_split() can't count the char
1703 // length of the split items itself.
1704 // should be freed with pango_item_free().
1705 // RETURNS: new item representing text before @split_index, which
1706 // <split_index>: byte index of position to split item, relative to the start of the item
1707 // <split_offset>: number of chars between start of @orig and @split_index
1708 Item* /*new*/ split()(int split_index, int split_offset) {
1709 return pango_item_split(&this, split_index, split_offset);
1713 struct Language {
1715 // Get a string that is representative of the characters needed to
1716 // render a particular language.
1717 // The sample text may be a pangram, but is not necessarily. It is chosen to
1718 // be demonstrative of normal text in the language, as well as exposing font
1719 // feature requirements unique to the language. It is suitable for use
1720 // as sample text in a font selection dialog.
1721 // If @language is %NULL, the default language as found by
1722 // pango_language_get_default() is used.
1723 // If Pango does not have a sample string for @language, the classic
1724 // "The quick brown fox..." is returned. This can be detected by
1725 // comparing the returned pointer value to that returned for (non-existent)
1726 // language code "xx". That is, compare to:
1727 // <informalexample><programlisting>
1728 // pango_language_get_sample_string (pango_language_from_string ("xx"))
1729 // </programlisting></informalexample>
1730 // and should not be freed.
1731 // RETURNS: the sample string. This value is owned by Pango
1732 char* get_sample_string()() {
1733 return pango_language_get_sample_string(&this);
1736 // VERSION: 1.22
1737 // Determines the scripts used to to write @language.
1738 // If nothing is known about the language tag @language,
1739 // or if @language is %NULL, then %NULL is returned.
1740 // The list of scripts returned starts with the script that the
1741 // language uses most and continues to the one it uses least.
1742 // The value @num_script points at will be set to the number
1743 // of scripts in the returned array (or zero if %NULL is returned).
1744 // Most languages use only one script for writing, but there are
1745 // some that use two (Latin and Cyrillic for example), and a few
1746 // use three (Japanese for example). Applications should not make
1747 // any assumptions on the maximum number of scripts returned
1748 // though, except that it is positive if the return value is not
1749 // %NULL, and it is a small number.
1750 // The pango_language_includes_script() function uses this function
1751 // internally.
1752 // number of entries in the array stored in @num_scripts, or
1753 // %NULL if Pango does not have any information about this
1754 // particular language tag (also the case if @language is %NULL).
1755 // The returned array is owned by Pango and should not be modified
1756 // or freed.
1757 // RETURNS: An array of #PangoScript values, with the
1758 // <num_scripts>: location to return number of scripts, or %NULL
1759 Script* get_scripts()(int* num_scripts) {
1760 return pango_language_get_scripts(&this, num_scripts);
1763 // VERSION: 1.4
1764 // Determines if @script is one of the scripts used to
1765 // write @language. The returned value is conservative;
1766 // if nothing is known about the language tag @language,
1767 // %TRUE will be returned, since, as far as Pango knows,
1768 // This routine is used in Pango's itemization process when
1769 // determining if a supplied language tag is relevant to
1770 // a particular section of text. It probably is not useful for
1771 // applications in most circumstances.
1772 // This function uses pango_language_get_scripts() internally.
1773 // to write @language or if nothing is known about @language
1774 // (including the case that @language is %NULL),
1775 // %FALSE otherwise.
1776 // RETURNS: %TRUE if @script is one of the scripts used
1777 // <script>: a #PangoScript
1778 int includes_script()(Script script) {
1779 return pango_language_includes_script(&this, script);
1782 // Checks if a language tag matches one of the elements in a list of
1783 // language ranges. A language tag is considered to match a range
1784 // in the list if the range is '*', the range is exactly the tag,
1785 // or the range is a prefix of the tag, and the character after it
1786 // in the tag is '-'.
1787 // RETURNS: %TRUE if a match was found.
1788 // <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()
1789 int matches()(char* range_list) {
1790 return pango_language_matches(&this, range_list);
1793 // Gets the RFC-3066 format string representing the given language tag.
1794 // Pango and should not be freed.
1795 // RETURNS: a string representing the language tag. This is owned by
1796 char* to_string()() {
1797 return pango_language_to_string(&this);
1801 struct Layout /* : GObject.Object */ {
1802 alias method_parent this;
1803 alias method_parent super_;
1804 alias method_parent object;
1805 GObject2.Object method_parent;
1808 // Create a new #PangoLayout object with attributes initialized to
1809 // default values for a particular #PangoContext.
1810 // count of one, which should be freed with
1811 // g_object_unref().
1812 // RETURNS: the newly allocated #PangoLayout, with a reference
1813 // <context>: a #PangoContext
1814 static Layout* /*new*/ new_()(Context* context) {
1815 return pango_layout_new(context);
1818 // Forces recomputation of any state in the #PangoLayout that
1819 // might depend on the layout's context. This function should
1820 // be called if you make changes to the context subsequent
1821 // to creating the layout.
1822 void context_changed()() {
1823 pango_layout_context_changed(&this);
1826 // Unintrospectable method: copy() / pango_layout_copy()
1827 // Does a deep copy-by-value of the @src layout. The attribute list,
1828 // tab array, and text from the original layout are all copied by
1829 // value.
1830 // count of one, which should be freed with
1831 // g_object_unref().
1832 // RETURNS: the newly allocated #PangoLayout, with a reference
1833 Layout* copy()() {
1834 return pango_layout_copy(&this);
1837 // positioned within the horizontal space available.
1838 // RETURNS: the alignment.
1839 Alignment get_alignment()() {
1840 return pango_layout_get_alignment(&this);
1843 // Gets the attribute list for the layout, if any.
1844 // RETURNS: a #PangoAttrList.
1845 AttrList* /*new*/ get_attributes()() {
1846 return pango_layout_get_attributes(&this);
1849 // VERSION: 1.4
1850 // Gets whether to calculate the bidirectional base direction
1851 // for the layout according to the contents of the layout.
1852 // See pango_layout_set_auto_dir().
1853 // is computed from the layout's contents, %FALSE otherwise.
1854 // RETURNS: %TRUE if the bidirectional base direction
1855 int get_auto_dir()() {
1856 return pango_layout_get_auto_dir(&this);
1859 // VERSION: 1.22
1860 // Gets the Y position of baseline of the first line in @layout.
1861 // RETURNS: baseline of first line, from top of @layout.
1862 int get_baseline()() {
1863 return pango_layout_get_baseline(&this);
1866 // Retrieves the #PangoContext used for this layout.
1867 // This does not have an additional refcount added, so if you want to
1868 // keep a copy of this around, you must reference it yourself.
1869 // RETURNS: the #PangoContext for the layout.
1870 Context* get_context()() {
1871 return pango_layout_get_context(&this);
1874 // Given an index within a layout, determines the positions that of the
1875 // strong and weak cursors if the insertion point is at that
1876 // index. The position of each cursor is stored as a zero-width
1877 // rectangle. The strong cursor location is the location where
1878 // characters of the directionality equal to the base direction of the
1879 // layout are inserted. The weak cursor location is the location
1880 // where characters of the directionality opposite to the base
1881 // direction of the layout are inserted.
1882 // <index_>: the byte index of the cursor
1883 // <strong_pos>: location to store the strong cursor position (may be %NULL)
1884 // <weak_pos>: location to store the weak cursor position (may be %NULL)
1885 void get_cursor_pos()(int index_, /*out*/ Rectangle* strong_pos, /*out*/ Rectangle* weak_pos) {
1886 pango_layout_get_cursor_pos(&this, index_, strong_pos, weak_pos);
1889 // VERSION: 1.6
1890 // Gets the type of ellipsization being performed for @layout.
1891 // See pango_layout_set_ellipsize()
1892 // Use pango_layout_is_ellipsized() to query whether any paragraphs
1893 // were actually ellipsized.
1894 // RETURNS: the current ellipsization mode for @layout.
1895 EllipsizeMode get_ellipsize()() {
1896 return pango_layout_get_ellipsize(&this);
1899 // Computes the logical and ink extents of @layout. Logical extents
1900 // are usually what you want for positioning things. Note that both extents
1901 // may have non-zero x and y. You may want to use those to offset where you
1902 // render the layout. Not doing that is a very typical bug that shows up as
1903 // right-to-left layouts not being correctly positioned in a layout with
1904 // a set width.
1905 // The extents are given in layout coordinates and in Pango units; layout
1906 // coordinates begin at the top left corner of the layout.
1907 // <ink_rect>: rectangle used to store the extents of the layout as drawn or %NULL to indicate that the result is not needed.
1908 // <logical_rect>: rectangle used to store the logical extents of the layout or %NULL to indicate that the result is not needed.
1909 void get_extents()(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
1910 pango_layout_get_extents(&this, ink_rect, logical_rect);
1913 // VERSION: 1.8
1914 // Gets the font description for the layout, if any.
1915 // or %NULL if the font description from the layout's
1916 // context is inherited. This value is owned by the layout
1917 // and must not be modified or freed.
1918 // RETURNS: a pointer to the layout's font description,
1919 FontDescription* get_font_description()() {
1920 return pango_layout_get_font_description(&this);
1923 // VERSION: 1.20
1924 // Gets the height of layout used for ellipsization. See
1925 // pango_layout_set_height() for details.
1926 // number of lines if negative.
1927 // RETURNS: the height, in Pango units if positive, or
1928 int get_height()() {
1929 return pango_layout_get_height(&this);
1932 // Gets the paragraph indent width in Pango units. A negative value
1933 // indicates a hanging indentation.
1934 // RETURNS: the indent in Pango units.
1935 int get_indent()() {
1936 return pango_layout_get_indent(&this);
1939 // Returns an iterator to iterate over the visual extents of the layout.
1940 // pango_layout_iter_free().
1941 // RETURNS: the new #PangoLayoutIter that should be freed using
1942 LayoutIter* /*new*/ get_iter()() {
1943 return pango_layout_get_iter(&this);
1946 // Gets whether each complete line should be stretched to fill the entire
1947 // width of the layout.
1948 // RETURNS: the justify.
1949 int get_justify()() {
1950 return pango_layout_get_justify(&this);
1953 // Retrieves a particular line from a #PangoLayout.
1954 // Use the faster pango_layout_get_line_readonly() if you do not plan
1955 // to modify the contents of the line (glyphs, glyph widths, etc.).
1956 // index is out of range. This layout line can
1957 // be ref'ed and retained, but will become invalid
1958 // if changes are made to the #PangoLayout.
1959 // RETURNS: the requested #PangoLayoutLine, or %NULL if the
1960 // <line>: the index of a line, which must be between 0 and <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.
1961 LayoutLine* /*new*/ get_line()(int line) {
1962 return pango_layout_get_line(&this, line);
1965 // Retrieves the count of lines for the @layout.
1966 // RETURNS: the line count.
1967 int get_line_count()() {
1968 return pango_layout_get_line_count(&this);
1971 // VERSION: 1.16
1972 // Retrieves a particular line from a #PangoLayout.
1973 // This is a faster alternative to pango_layout_get_line(),
1974 // but the user is not expected
1975 // to modify the contents of the line (glyphs, glyph widths, etc.).
1976 // index is out of range. This layout line can
1977 // be ref'ed and retained, but will become invalid
1978 // if changes are made to the #PangoLayout.
1979 // No changes should be made to the line.
1980 // RETURNS: the requested #PangoLayoutLine, or %NULL if the
1981 // <line>: the index of a line, which must be between 0 and <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.
1982 LayoutLine* /*new*/ get_line_readonly()(int line) {
1983 return pango_layout_get_line_readonly(&this, line);
1986 // Returns the lines of the @layout as a list.
1987 // Use the faster pango_layout_get_lines_readonly() if you do not plan
1988 // to modify the contents of the lines (glyphs, glyph widths, etc.).
1989 // the lines in the layout. This points to internal data of the #PangoLayout
1990 // and must be used with care. It will become invalid on any change to the layout's
1991 // text or properties.
1992 // RETURNS: a #GSList containing
1993 GLib2.SList* get_lines()() {
1994 return pango_layout_get_lines(&this);
1997 // VERSION: 1.16
1998 // Returns the lines of the @layout as a list.
1999 // This is a faster alternative to pango_layout_get_lines(),
2000 // but the user is not expected
2001 // to modify the contents of the lines (glyphs, glyph widths, etc.).
2002 // the lines in the layout. This points to internal data of the #PangoLayout and
2003 // must be used with care. It will become invalid on any change to the layout's
2004 // text or properties. No changes should be made to the lines.
2005 // RETURNS: a #GSList containing
2006 GLib2.SList* get_lines_readonly()() {
2007 return pango_layout_get_lines_readonly(&this);
2010 // Retrieves an array of logical attributes for each character in
2011 // the @layout.
2012 // <attrs>: location to store a pointer to an array of logical attributes This value must be freed with g_free().
2013 // <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.)
2014 void get_log_attrs()(/*out*/ LogAttr** attrs, /*out*/ int* n_attrs) {
2015 pango_layout_get_log_attrs(&this, attrs, n_attrs);
2018 // Computes the logical and ink extents of @layout in device units.
2019 // This function just calls pango_layout_get_extents() followed by
2020 // two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect
2021 // such that the rounded rectangles fully contain the unrounded one (that is,
2022 // passes them as first argument to pango_extents_to_pixels()).
2023 // <ink_rect>: rectangle used to store the extents of the layout as drawn or %NULL to indicate that the result is not needed.
2024 // <logical_rect>: rectangle used to store the logical extents of the layout or %NULL to indicate that the result is not needed.
2025 void get_pixel_extents()(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
2026 pango_layout_get_pixel_extents(&this, ink_rect, logical_rect);
2029 // Determines the logical width and height of a #PangoLayout
2030 // in device units. (pango_layout_get_size() returns the width
2031 // and height scaled by %PANGO_SCALE.) This
2032 // is simply a convenience function around
2033 // pango_layout_get_pixel_extents().
2034 // <width>: location to store the logical width, or %NULL
2035 // <height>: location to store the logical height, or %NULL
2036 void get_pixel_size()(/*out*/ int* width, /*out*/ int* height) {
2037 pango_layout_get_pixel_size(&this, width, height);
2040 // Obtains the value set by pango_layout_set_single_paragraph_mode().
2041 // paragraph separator characters, %FALSE otherwise.
2042 // RETURNS: %TRUE if the layout does not break paragraphs at
2043 int get_single_paragraph_mode()() {
2044 return pango_layout_get_single_paragraph_mode(&this);
2047 // Determines the logical width and height of a #PangoLayout
2048 // in Pango units (device units scaled by %PANGO_SCALE). This
2049 // is simply a convenience function around pango_layout_get_extents().
2050 // <width>: location to store the logical width, or %NULL
2051 // <height>: location to store the logical height, or %NULL
2052 void get_size()(/*out*/ int* width, /*out*/ int* height) {
2053 pango_layout_get_size(&this, width, height);
2056 // Gets the amount of spacing between the lines of the layout.
2057 // RETURNS: the spacing in Pango units.
2058 int get_spacing()() {
2059 return pango_layout_get_spacing(&this);
2062 // Gets the current #PangoTabArray used by this layout. If no
2063 // #PangoTabArray has been set, then the default tabs are in use
2064 // and %NULL is returned. Default tabs are every 8 spaces.
2065 // The return value should be freed with pango_tab_array_free().
2066 // RETURNS: a copy of the tabs for this layout, or %NULL.
2067 TabArray* /*new*/ get_tabs()() {
2068 return pango_layout_get_tabs(&this);
2071 // Gets the text in the layout. The returned text should not
2072 // be freed or modified.
2073 // RETURNS: the text in the @layout.
2074 char* get_text()() {
2075 return pango_layout_get_text(&this);
2078 // VERSION: 1.16
2079 // Counts the number unknown glyphs in @layout. That is, zero if
2080 // glyphs for all characters in the layout text were found, or more
2081 // than zero otherwise.
2082 // This function can be used to determine if there are any fonts
2083 // available to render all characters in a certain string, or when
2084 // used in combination with %PANGO_ATTR_FALLBACK, to check if a
2085 // certain font supports all the characters in the string.
2086 // RETURNS: The number of unknown glyphs in @layout.
2087 int get_unknown_glyphs_count()() {
2088 return pango_layout_get_unknown_glyphs_count(&this);
2091 // Gets the width to which the lines of the #PangoLayout should wrap.
2092 // RETURNS: the width in Pango units, or -1 if no width set.
2093 int get_width()() {
2094 return pango_layout_get_width(&this);
2097 // Gets the wrap mode for the layout.
2098 // Use pango_layout_is_wrapped() to query whether any paragraphs
2099 // were actually wrapped.
2100 // RETURNS: active wrap mode.
2101 WrapMode get_wrap()() {
2102 return pango_layout_get_wrap(&this);
2105 // Converts from byte @index_ within the @layout to line and X position.
2106 // (X position is measured from the left edge of the line)
2107 // <index_>: the byte index of a grapheme within the layout.
2108 // <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.
2109 // <line>: location to store resulting line index. (which will between 0 and pango_layout_get_line_count(layout) - 1)
2110 void index_to_line_x()(int index_, int trailing, /*out*/ int* line, int* x_pos) {
2111 pango_layout_index_to_line_x(&this, index_, trailing, line, x_pos);
2114 // Converts from an index within a #PangoLayout to the onscreen position
2115 // corresponding to the grapheme at that index, which is represented
2116 // as rectangle. Note that <literal>pos->x</literal> is always the leading
2117 // edge of the grapheme and <literal>pos->x + pos->width</literal> the trailing
2118 // edge of the grapheme. If the directionality of the grapheme is right-to-left,
2119 // then <literal>pos->width</literal> will be negative.
2120 // <index_>: byte index within @layout
2121 // <pos>: rectangle in which to store the position of the grapheme
2122 void index_to_pos()(int index_, /*out*/ Rectangle* pos) {
2123 pango_layout_index_to_pos(&this, index_, pos);
2126 // VERSION: 1.16
2127 // Queries whether the layout had to ellipsize any paragraphs.
2128 // This returns %TRUE if the ellipsization mode for @layout
2129 // is not %PANGO_ELLIPSIZE_NONE, a positive width is set on @layout,
2130 // and there are paragraphs exceeding that width that have to be
2131 // ellipsized.
2132 // otherwise.
2133 // RETURNS: %TRUE if any paragraphs had to be ellipsized, %FALSE
2134 int is_ellipsized()() {
2135 return pango_layout_is_ellipsized(&this);
2138 // VERSION: 1.16
2139 // Queries whether the layout had to wrap any paragraphs.
2140 // This returns %TRUE if a positive width is set on @layout,
2141 // ellipsization mode of @layout is set to %PANGO_ELLIPSIZE_NONE,
2142 // and there are paragraphs exceeding the layout width that have
2143 // to be wrapped.
2144 // otherwise.
2145 // RETURNS: %TRUE if any paragraphs had to be wrapped, %FALSE
2146 int is_wrapped()() {
2147 return pango_layout_is_wrapped(&this);
2150 // Computes a new cursor position from an old position and
2151 // a count of positions to move visually. If @direction is positive,
2152 // then the new strong cursor position will be one position
2153 // to the right of the old cursor position. If @direction is negative,
2154 // then the new strong cursor position will be one position
2155 // to the left of the old cursor position.
2156 // In the presence of bidirectional text, the correspondence
2157 // between logical and visual order will depend on the direction
2158 // of the current run, and there may be jumps when the cursor
2159 // is moved off of the end of a run.
2160 // Motion here is in cursor positions, not in characters, so a
2161 // single call to pango_layout_move_cursor_visually() may move the
2162 // cursor over multiple characters when multiple characters combine
2163 // to form a single grapheme.
2164 // <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.
2165 // <old_index>: the byte index of the grapheme for the old index
2166 // <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.
2167 // <direction>: direction to move cursor. A negative value indicates motion to the left.
2168 // <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.
2169 // <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.
2170 void move_cursor_visually()(int strong, int old_index, int old_trailing, int direction, /*out*/ int* new_index, int* new_trailing) {
2171 pango_layout_move_cursor_visually(&this, strong, old_index, old_trailing, direction, new_index, new_trailing);
2174 // positioned within the horizontal space available.
2175 // <alignment>: the alignment
2176 void set_alignment()(Alignment alignment) {
2177 pango_layout_set_alignment(&this, alignment);
2180 // Sets the text attributes for a layout object.
2181 // References @attrs, so the caller can unref its reference.
2182 // <attrs>: a #PangoAttrList, can be %NULL
2183 void set_attributes()(AttrList* attrs) {
2184 pango_layout_set_attributes(&this, attrs);
2187 // VERSION: 1.4
2188 // Sets whether to calculate the bidirectional base direction
2189 // for the layout according to the contents of the layout;
2190 // when this flag is on (the default), then paragraphs in
2191 // (Arabic and Hebrew principally), will have right-to-left
2192 // layout, paragraphs with letters from other scripts will
2193 // have left-to-right layout. Paragraphs with only neutral
2194 // characters get their direction from the surrounding paragraphs.
2195 // When %FALSE, the choice between left-to-right and
2196 // right-to-left layout is done according to the base direction
2197 // of the layout's #PangoContext. (See pango_context_set_base_dir()).
2198 // When the auto-computed direction of a paragraph differs from the
2199 // base direction of the context, the interpretation of
2200 // %PANGO_ALIGN_LEFT and %PANGO_ALIGN_RIGHT are swapped.
2201 // <auto_dir>: if %TRUE, compute the bidirectional base direction from the layout's contents.
2202 void set_auto_dir()(int auto_dir) {
2203 pango_layout_set_auto_dir(&this, auto_dir);
2206 // VERSION: 1.6
2207 // Sets the type of ellipsization being performed for @layout.
2208 // Depending on the ellipsization mode @ellipsize text is
2209 // removed from the start, middle, or end of text so they
2210 // fit within the width and height of layout set with
2211 // pango_layout_set_width() and pango_layout_set_height().
2212 // If the layout contains characters such as newlines that
2213 // force it to be layed out in multiple paragraphs, then whether
2214 // each paragraph is ellipsized separately or the entire layout
2215 // is ellipsized as a whole depends on the set height of the layout.
2216 // See pango_layout_set_height() for details.
2217 // <ellipsize>: the new ellipsization mode for @layout
2218 void set_ellipsize()(EllipsizeMode ellipsize) {
2219 pango_layout_set_ellipsize(&this, ellipsize);
2222 // Sets the default font description for the layout. If no font
2223 // description is set on the layout, the font description from
2224 // the layout's context is used.
2225 // <desc>: the new #PangoFontDescription, or %NULL to unset the current font description
2226 void set_font_description()(FontDescription* desc) {
2227 pango_layout_set_font_description(&this, desc);
2230 // VERSION: 1.20
2231 // Sets the height to which the #PangoLayout should be ellipsized at. There
2232 // are two different behaviors, based on whether @height is positive or
2233 // negative.
2234 // If @height is positive, it will be the maximum height of the layout. Only
2235 // lines would be shown that would fit, and if there is any text omitted,
2236 // an ellipsis added. At least one line is included in each paragraph regardless
2237 // of how small the height value is. A value of zero will render exactly one
2238 // line for the entire layout.
2239 // If @height is negative, it will be the (negative of) maximum number of lines per
2240 // paragraph. That is, the total number of lines shown may well be more than
2241 // this value if the layout contains multiple paragraphs of text.
2242 // The default value of -1 means that first line of each paragraph is ellipsized.
2243 // This behvaior may be changed in the future to act per layout instead of per
2244 // paragraph. File a bug against pango at <ulink
2245 // url="http://bugzilla.gnome.org/">http://bugzilla.gnome.org/</ulink> if your
2246 // code relies on this behavior.
2247 // Height setting only has effect if a positive width is set on
2248 // The behavior is undefined if a height other than -1 is set and
2249 // ellipsization mode is set to %PANGO_ELLIPSIZE_NONE, and may change in the
2250 // future.
2251 // <height>: the desired height of the layout in Pango units if positive, or desired number of lines if negative.
2252 void set_height()(int height) {
2253 pango_layout_set_height(&this, height);
2256 // Sets the width in Pango units to indent each paragraph. A negative value
2257 // of @indent will produce a hanging indentation. That is, the first line will
2258 // have the full width, and subsequent lines will be indented by the
2259 // absolute value of @indent.
2260 // The indent setting is ignored if layout alignment is set to
2261 // %PANGO_ALIGN_CENTER.
2262 // <indent>: the amount by which to indent.
2263 void set_indent()(int indent) {
2264 pango_layout_set_indent(&this, indent);
2267 // Sets whether each complete line should be stretched to
2268 // fill the entire width of the layout. This stretching is typically
2269 // done by adding whitespace, but for some scripts (such as Arabic),
2270 // the justification may be done in more complex ways, like extending
2271 // the characters.
2272 // Note that this setting is not implemented and so is ignored in Pango
2273 // older than 1.18.
2274 // <justify>: whether the lines in the layout should be justified.
2275 void set_justify()(int justify) {
2276 pango_layout_set_justify(&this, justify);
2279 // Same as pango_layout_set_markup_with_accel(), but
2280 // the markup text isn't scanned for accelerators.
2281 // <markup>: marked-up text
2282 // <length>: length of marked-up text in bytes, or -1 if @markup is nul-terminated
2283 void set_markup()(char* markup, int length) {
2284 pango_layout_set_markup(&this, markup, length);
2287 // Sets the layout text and attribute list from marked-up text (see
2288 // <link linkend="PangoMarkupFormat">markup format</link>). Replaces
2289 // the current text and attribute list.
2290 // If @accel_marker is nonzero, the given character will mark the
2291 // character following it as an accelerator. For example, @accel_marker
2292 // might be an ampersand or underscore. All characters marked
2293 // as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
2294 // and the first character so marked will be returned in @accel_char.
2295 // Two @accel_marker characters following each other produce a single
2296 // literal @accel_marker character.
2297 // <markup>: marked-up text (see <link linkend="PangoMarkupFormat">markup format</link>)
2298 // <length>: length of marked-up text in bytes, or -1 if @markup is nul-terminated
2299 // <accel_marker>: marker for accelerators in the text
2300 // <accel_char>: return location for first located accelerator, or %NULL
2301 void set_markup_with_accel()(char* markup, int length, dchar accel_marker, dchar* accel_char) {
2302 pango_layout_set_markup_with_accel(&this, markup, length, accel_marker, accel_char);
2305 // If @setting is %TRUE, do not treat newlines and similar characters
2306 // as paragraph separators; instead, keep all text in a single paragraph,
2307 // and display a glyph for paragraph separator characters. Used when
2308 // you want to allow editing of newlines on a single text line.
2309 // <setting>: new setting
2310 void set_single_paragraph_mode()(int setting) {
2311 pango_layout_set_single_paragraph_mode(&this, setting);
2314 // Sets the amount of spacing in Pango unit between the lines of the
2315 // layout.
2316 // <spacing>: the amount of spacing
2317 void set_spacing()(int spacing) {
2318 pango_layout_set_spacing(&this, spacing);
2321 // Sets the tabs to use for @layout, overriding the default tabs
2322 // (by default, tabs are every 8 spaces). If @tabs is %NULL, the default
2323 // tabs are reinstated. @tabs is copied into the layout; you must
2324 // free your copy of @tabs yourself.
2325 // <tabs>: a #PangoTabArray, or %NULL
2326 void set_tabs()(TabArray* tabs) {
2327 pango_layout_set_tabs(&this, tabs);
2330 // Sets the text of the layout.
2331 // Note that if you have used
2332 // pango_layout_set_markup() or pango_layout_set_markup_with_accel() on
2333 // the attributes set on the layout from the markup as this function does not
2334 // clear attributes.
2335 // <text>: a valid UTF-8 string
2336 // <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.
2337 void set_text()(char* text, int length) {
2338 pango_layout_set_text(&this, text, length);
2341 // Sets the width to which the lines of the #PangoLayout should wrap or
2342 // <width>: the desired width in Pango units, or -1 to indicate that no wrapping or ellipsization should be performed.
2343 void set_width()(int width) {
2344 pango_layout_set_width(&this, width);
2347 // Sets the wrap mode; the wrap mode only has effect if a width
2348 // is set on the layout with pango_layout_set_width().
2349 // To turn off wrapping, set the width to -1.
2350 // <wrap>: the wrap mode
2351 void set_wrap()(WrapMode wrap) {
2352 pango_layout_set_wrap(&this, wrap);
2355 // Converts from X and Y position within a layout to the byte
2356 // index to the character at that logical position. If the
2357 // Y position is not inside the layout, the closest position is chosen
2358 // (the position will be clamped inside the layout). If the
2359 // X position is not within the layout, then the start or the
2360 // end of the line is chosen as described for pango_layout_x_to_index().
2361 // If either the X or Y positions were not inside the layout, then the
2362 // function returns %FALSE; on an exact hit, it returns %TRUE.
2363 // RETURNS: %TRUE if the coordinates were inside text, %FALSE otherwise.
2364 // <x>: the X offset (in Pango units) from the left edge of the layout.
2365 // <y>: the Y offset (in Pango units) from the top edge of the layout
2366 // <index_>: location to store calculated byte index
2367 // <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.
2368 int xy_to_index()(int x, int y, /*out*/ int* index_, /*out*/ int* trailing) {
2369 return pango_layout_xy_to_index(&this, x, y, index_, trailing);
2373 struct LayoutClass {
2376 struct LayoutIter {
2378 // Determines whether @iter is on the last line of the layout.
2379 // RETURNS: %TRUE if @iter is on the last line.
2380 int at_last_line()() {
2381 return pango_layout_iter_at_last_line(&this);
2384 // VERSION: 1.20
2385 // Copies a #PangLayoutIter.
2386 // be freed with pango_layout_iter_free(), or %NULL if
2387 // RETURNS: the newly allocated #PangoLayoutIter, which should
2388 LayoutIter* /*new*/ copy()() {
2389 return pango_layout_iter_copy(&this);
2391 // Frees an iterator that's no longer in use.
2392 void free()() {
2393 pango_layout_iter_free(&this);
2396 // Gets the Y position of the current line's baseline, in layout
2397 // coordinates (origin at top left of the entire layout).
2398 // RETURNS: baseline of current line.
2399 int get_baseline()() {
2400 return pango_layout_iter_get_baseline(&this);
2403 // Gets the extents of the current character, in layout coordinates
2404 // (origin is the top left of the entire layout). Only logical extents
2405 // can sensibly be obtained for characters; ink extents make sense only
2406 // down to the level of clusters.
2407 // <logical_rect>: rectangle to fill with logical extents
2408 void get_char_extents()(Rectangle* logical_rect) {
2409 pango_layout_iter_get_char_extents(&this, logical_rect);
2412 // Gets the extents of the current cluster, in layout coordinates
2413 // (origin is the top left of the entire layout).
2414 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2415 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2416 void get_cluster_extents()(Rectangle* ink_rect, Rectangle* logical_rect) {
2417 pango_layout_iter_get_cluster_extents(&this, ink_rect, logical_rect);
2420 // Gets the current byte index. Note that iterating forward by char
2421 // moves in visual order, not logical order, so indexes may not be
2422 // sequential. Also, the index may be equal to the length of the text
2423 // in the layout, if on the %NULL run (see pango_layout_iter_get_run()).
2424 // RETURNS: current byte index.
2425 int get_index()() {
2426 return pango_layout_iter_get_index(&this);
2429 // Unintrospectable method: get_layout() / pango_layout_iter_get_layout()
2430 // VERSION: 1.20
2431 // Gets the layout associated with a #PangoLayoutIter.
2432 // RETURNS: the layout associated with @iter.
2433 Layout* get_layout()() {
2434 return pango_layout_iter_get_layout(&this);
2437 // Obtains the extents of the #PangoLayout being iterated
2438 // over. @ink_rect or @logical_rect can be %NULL if you
2439 // aren't interested in them.
2440 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2441 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2442 void get_layout_extents()(Rectangle* ink_rect, Rectangle* logical_rect) {
2443 pango_layout_iter_get_layout_extents(&this, ink_rect, logical_rect);
2446 // Gets the current line.
2447 // Use the faster pango_layout_iter_get_line_readonly() if you do not plan
2448 // to modify the contents of the line (glyphs, glyph widths, etc.).
2449 // RETURNS: the current line.
2450 LayoutLine* /*new*/ get_line()() {
2451 return pango_layout_iter_get_line(&this);
2454 // Obtains the extents of the current line. @ink_rect or @logical_rect
2455 // can be %NULL if you aren't interested in them. Extents are in layout
2456 // coordinates (origin is the top-left corner of the entire
2457 // #PangoLayout). Thus the extents returned by this function will be
2458 // the same width/height but not at the same x/y as the extents
2459 // returned from pango_layout_line_get_extents().
2460 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2461 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2462 void get_line_extents()(Rectangle* ink_rect, Rectangle* logical_rect) {
2463 pango_layout_iter_get_line_extents(&this, ink_rect, logical_rect);
2466 // VERSION: 1.16
2467 // Gets the current line for read-only access.
2468 // This is a faster alternative to pango_layout_iter_get_line(),
2469 // but the user is not expected
2470 // to modify the contents of the line (glyphs, glyph widths, etc.).
2471 // RETURNS: the current line, that should not be modified.
2472 LayoutLine* /*new*/ get_line_readonly()() {
2473 return pango_layout_iter_get_line_readonly(&this);
2476 // Divides the vertical space in the #PangoLayout being iterated over
2477 // between the lines in the layout, and returns the space belonging to
2478 // the current line. A line's range includes the line's logical
2479 // extents, plus half of the spacing above and below the line, if
2480 // pango_layout_set_spacing() has been called to set layout spacing.
2481 // The Y positions are in layout coordinates (origin at top left of the
2482 // entire layout).
2483 // <y0_>: start of line
2484 // <y1_>: end of line
2485 void get_line_yrange()(int* y0_, int* y1_) {
2486 pango_layout_iter_get_line_yrange(&this, y0_, y1_);
2489 // Unintrospectable method: get_run() / pango_layout_iter_get_run()
2490 // Gets the current run. When iterating by run, at the end of each
2491 // line, there's a position with a %NULL run, so this function can return
2492 // %NULL. The %NULL run at the end of each line ensures that all lines have
2493 // at least one run, even lines consisting of only a newline.
2494 // Use the faster pango_layout_iter_get_run_readonly() if you do not plan
2495 // to modify the contents of the run (glyphs, glyph widths, etc.).
2496 // RETURNS: the current run.
2497 LayoutRun* get_run()() {
2498 return pango_layout_iter_get_run(&this);
2501 // Gets the extents of the current run in layout coordinates
2502 // (origin is the top left of the entire layout).
2503 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2504 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2505 void get_run_extents()(Rectangle* ink_rect, Rectangle* logical_rect) {
2506 pango_layout_iter_get_run_extents(&this, ink_rect, logical_rect);
2509 // Unintrospectable method: get_run_readonly() / pango_layout_iter_get_run_readonly()
2510 // VERSION: 1.16
2511 // Gets the current run. When iterating by run, at the end of each
2512 // line, there's a position with a %NULL run, so this function can return
2513 // %NULL. The %NULL run at the end of each line ensures that all lines have
2514 // at least one run, even lines consisting of only a newline.
2515 // This is a faster alternative to pango_layout_iter_get_run(),
2516 // but the user is not expected
2517 // to modify the contents of the run (glyphs, glyph widths, etc.).
2518 // RETURNS: the current run, that should not be modified.
2519 LayoutRun* get_run_readonly()() {
2520 return pango_layout_iter_get_run_readonly(&this);
2523 // Moves @iter forward to the next character in visual order. If @iter was already at
2524 // the end of the layout, returns %FALSE.
2525 // RETURNS: whether motion was possible.
2526 int next_char()() {
2527 return pango_layout_iter_next_char(&this);
2530 // Moves @iter forward to the next cluster in visual order. If @iter
2531 // was already at the end of the layout, returns %FALSE.
2532 // RETURNS: whether motion was possible.
2533 int next_cluster()() {
2534 return pango_layout_iter_next_cluster(&this);
2537 // Moves @iter forward to the start of the next line. If @iter is
2538 // already on the last line, returns %FALSE.
2539 // RETURNS: whether motion was possible.
2540 int next_line()() {
2541 return pango_layout_iter_next_line(&this);
2544 // Moves @iter forward to the next run in visual order. If @iter was
2545 // already at the end of the layout, returns %FALSE.
2546 // RETURNS: whether motion was possible.
2547 int next_run()() {
2548 return pango_layout_iter_next_run(&this);
2552 struct LayoutLine {
2553 Layout* layout;
2554 int start_index, length;
2555 GLib2.SList* runs;
2556 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2557 uint, "is_paragraph_start", 1,
2558 uint, "resolved_dir", 3,
2559 uint, "__dummy32A", 28));
2562 // Computes the logical and ink extents of a layout line. See
2563 // pango_font_get_glyph_extents() for details about the interpretation
2564 // of the rectangles.
2565 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn, or %NULL
2566 // <logical_rect>: rectangle used to store the logical extents of the glyph string, or %NULL
2567 void get_extents()(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
2568 pango_layout_line_get_extents(&this, ink_rect, logical_rect);
2571 // Computes the logical and ink extents of @layout_line in device units.
2572 // This function just calls pango_layout_line_get_extents() followed by
2573 // two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect
2574 // such that the rounded rectangles fully contain the unrounded one (that is,
2575 // passes them as first argument to pango_extents_to_pixels()).
2576 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn, or %NULL
2577 // <logical_rect>: rectangle used to store the logical extents of the glyph string, or %NULL
2578 void get_pixel_extents()(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
2579 pango_layout_line_get_pixel_extents(&this, ink_rect, logical_rect);
2582 // Gets a list of visual ranges corresponding to a given logical range.
2583 // This list is not necessarily minimal - there may be consecutive
2584 // ranges which are adjacent. The ranges will be sorted from left to
2585 // right. The ranges are with respect to the left edge of the entire
2586 // layout, not with respect to the line.
2587 // <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.
2588 // <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.
2589 // <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.
2590 // <n_ranges>: The number of ranges stored in @ranges.
2591 void get_x_ranges()(int start_index, int end_index, /*out*/ int** ranges, /*out*/ int* n_ranges) {
2592 pango_layout_line_get_x_ranges(&this, start_index, end_index, ranges, n_ranges);
2595 // Converts an index within a line to a X position.
2596 // <index_>: byte offset of a grapheme within the layout
2597 // <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.
2598 // <x_pos>: location to store the x_offset (in Pango unit)
2599 void index_to_x()(int index_, int trailing, /*out*/ int* x_pos) {
2600 pango_layout_line_index_to_x(&this, index_, trailing, x_pos);
2603 // VERSION: 1.10
2604 // Increase the reference count of a #PangoLayoutLine by one.
2605 // RETURNS: the line passed in.
2606 LayoutLine* /*new*/ ref_()() {
2607 return pango_layout_line_ref(&this);
2610 // Decrease the reference count of a #PangoLayoutLine by one.
2611 // If the result is zero, the line and all associated memory
2612 // will be freed.
2613 void unref()() {
2614 pango_layout_line_unref(&this);
2617 // Converts from x offset to the byte index of the corresponding
2618 // character within the text of the layout. If @x_pos is outside the line,
2619 // in the line. This determination is based on the resolved direction
2620 // of the paragraph; for example, if the resolved direction is
2621 // right-to-left, then an X position to the right of the line (after it)
2622 // results in 0 being stored in @index_ and @trailing. An X position to the
2623 // left of the line results in @index_ pointing to the (logical) last
2624 // grapheme in the line and @trailing being set to the number of characters
2625 // in that grapheme. The reverse is true for a left-to-right line.
2626 // RETURNS: %FALSE if @x_pos was outside the line, %TRUE if inside
2627 // <x_pos>: the X offset (in Pango units) from the left edge of the line.
2628 // <index_>: location to store calculated byte index for the grapheme in which the user clicked.
2629 // <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.
2630 int x_to_index()(int x_pos, /*out*/ int* index_, /*out*/ int* trailing) {
2631 return pango_layout_line_x_to_index(&this, x_pos, index_, trailing);
2635 struct LogAttr {
2636 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2637 uint, "is_line_break", 1,
2638 uint, "is_mandatory_break", 1,
2639 uint, "is_char_break", 1,
2640 uint, "is_white", 1,
2641 uint, "is_cursor_position", 1,
2642 uint, "is_word_start", 1,
2643 uint, "is_word_end", 1,
2644 uint, "is_sentence_boundary", 1,
2645 uint, "is_sentence_start", 1,
2646 uint, "is_sentence_end", 1,
2647 uint, "backspace_deletes_character", 1,
2648 uint, "is_expandable_space", 1,
2649 uint, "is_word_boundary", 1,
2650 uint, "__dummy32A", 19));
2654 // A structure specifying a transformation between user-space
2655 // coordinates and device coordinates. The transformation
2656 // is given by
2657 // <programlisting>
2658 // x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0;
2659 // y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;
2660 // </programlisting>
2661 struct Matrix /* Version 1.6 */ {
2662 double xx, xy, yx, yy, x0, y0;
2665 // VERSION: 1.6
2666 // Changes the transformation represented by @matrix to be the
2667 // transformation given by first applying transformation
2668 // given by @new_matrix then applying the original transformation.
2669 // <new_matrix>: a #PangoMatrix
2670 void concat()(Matrix* new_matrix) {
2671 pango_matrix_concat(&this, new_matrix);
2674 // VERSION: 1.6
2675 // Copies a #PangoMatrix.
2676 // be freed with pango_matrix_free(), or %NULL if
2677 // RETURNS: the newly allocated #PangoMatrix, which should
2678 Matrix* /*new*/ copy()() {
2679 return pango_matrix_copy(&this);
2682 // VERSION: 1.6
2683 // Free a #PangoMatrix created with pango_matrix_copy().
2684 void free()() {
2685 pango_matrix_free(&this);
2688 // VERSION: 1.12
2689 // Returns the scale factor of a matrix on the height of the font.
2690 // That is, the scale factor in the direction perpendicular to the
2691 // vector that the X coordinate is mapped to.
2692 // or 1.0 if @matrix is %NULL.
2693 // RETURNS: the scale factor of @matrix on the height of the font,
2694 double get_font_scale_factor()() {
2695 return pango_matrix_get_font_scale_factor(&this);
2698 // VERSION: 1.6
2699 // Changes the transformation represented by @matrix to be the
2700 // transformation given by first rotating by @degrees degrees
2701 // counter-clockwise then applying the original transformation.
2702 // <degrees>: degrees to rotate counter-clockwise
2703 void rotate()(double degrees) {
2704 pango_matrix_rotate(&this, degrees);
2707 // VERSION: 1.6
2708 // Changes the transformation represented by @matrix to be the
2709 // transformation given by first scaling by @sx in the X direction
2710 // and @sy in the Y direction then applying the original
2711 // transformation.
2712 // <scale_x>: amount to scale by in X direction
2713 // <scale_y>: amount to scale by in Y direction
2714 void scale()(double scale_x, double scale_y) {
2715 pango_matrix_scale(&this, scale_x, scale_y);
2718 // VERSION: 1.16
2719 // Transforms the distance vector (@dx,@dy) by @matrix. This is
2720 // similar to pango_matrix_transform_point() except that the translation
2721 // components of the transformation are ignored. The calculation of
2722 // the returned vector is as follows:
2723 // <programlisting>
2724 // dx2 = dx1 * xx + dy1 * xy;
2725 // dy2 = dx1 * yx + dy1 * yy;
2726 // </programlisting>
2727 // Affine transformations are position invariant, so the same vector
2728 // always transforms to the same vector. If (@x1,@y1) transforms
2729 // to (@x2,@y2) then (@x1+@dx1,@y1+@dy1) will transform to
2730 // (@x1+@dx2,@y1+@dy2) for all values of @x1 and @x2.
2731 // <dx>: in/out X component of a distance vector
2732 // <dy>: yn/out Y component of a distance vector
2733 void transform_distance()(double* dx, double* dy) {
2734 pango_matrix_transform_distance(&this, dx, dy);
2737 // VERSION: 1.16
2738 // First transforms the @rect using @matrix, then calculates the bounding box
2739 // of the transformed rectangle. The rectangle should be in device units
2740 // (pixels).
2741 // This function is useful for example when you want to draw a rotated
2742 // should be and how much you should shift the layout when rendering.
2743 // For better accuracy, you should use pango_matrix_transform_rectangle() on
2744 // original rectangle in Pango units and convert to pixels afterward
2745 // using pango_extents_to_pixels()'s first argument.
2746 // <rect>: in/out bounding box in device units, or %NULL
2747 void transform_pixel_rectangle()(Rectangle* rect) {
2748 pango_matrix_transform_pixel_rectangle(&this, rect);
2751 // VERSION: 1.16
2752 // Transforms the point (@x, @y) by @matrix.
2753 // <x>: in/out X position
2754 // <y>: in/out Y position
2755 void transform_point()(double* x, double* y) {
2756 pango_matrix_transform_point(&this, x, y);
2759 // VERSION: 1.16
2760 // First transforms @rect using @matrix, then calculates the bounding box
2761 // of the transformed rectangle. The rectangle should be in Pango units.
2762 // This function is useful for example when you want to draw a rotated
2763 // should be and how much you should shift the layout when rendering.
2764 // If you have a rectangle in device units (pixels), use
2765 // pango_matrix_transform_pixel_rectangle().
2766 // If you have the rectangle in Pango units and want to convert to
2767 // transformed pixel bounding box, it is more accurate to transform it first
2768 // (using this function) and pass the result to pango_extents_to_pixels(),
2769 // first argument, for an inclusive rounded rectangle.
2770 // However, there are valid reasons that you may want to convert
2771 // to pixels first and then transform, for example when the transformed
2772 // coordinates may overflow in Pango units (large matrix translation for
2773 // example).
2774 // <rect>: in/out bounding box in Pango units, or %NULL
2775 void transform_rectangle()(Rectangle* rect) {
2776 pango_matrix_transform_rectangle(&this, rect);
2779 // VERSION: 1.6
2780 // Changes the transformation represented by @matrix to be the
2781 // transformation given by first translating by (@tx, @ty)
2782 // then applying the original transformation.
2783 // <tx>: amount to translate in the X direction
2784 // <ty>: amount to translate in the Y direction
2785 void translate()(double tx, double ty) {
2786 pango_matrix_translate(&this, tx, ty);
2790 enum RENDER_TYPE_NONE = "PangoRenderNone";
2791 struct Rectangle {
2792 int x, y, width, height;
2796 // #PangoRenderPart defines different items to render for such
2797 // purposes as setting colors.
2798 enum RenderPart /* Version 1.8 */ {
2799 FOREGROUND = 0,
2800 BACKGROUND = 1,
2801 UNDERLINE = 2,
2802 STRIKETHROUGH = 3
2805 // #PangoRenderer is a base class for objects that are used to
2806 // render Pango objects such as #PangoGlyphString and
2807 // #PangoLayout.
2808 struct Renderer /* : GObject.Object */ /* Version 1.8 */ {
2809 alias parent_instance this;
2810 alias parent_instance super_;
2811 alias parent_instance object;
2812 GObject2.Object parent_instance;
2813 private Underline underline;
2814 private int strikethrough;
2815 private int active_count;
2816 Matrix* matrix;
2817 private RendererPrivate* priv;
2820 // VERSION: 1.8
2821 // Does initial setup before rendering operations on @renderer.
2822 // pango_renderer_deactivate() should be called when done drawing.
2823 // Calls such as pango_renderer_draw_layout() automatically
2824 // activate the layout before drawing on it. Calls to
2825 // pango_renderer_activate() and pango_renderer_deactivate() can
2826 // be nested and the renderer will only be initialized and
2827 // deinitialized once.
2828 void activate()() {
2829 pango_renderer_activate(&this);
2832 // VERSION: 1.8
2833 // Cleans up after rendering operations on @renderer. See
2834 // docs for pango_renderer_activate().
2835 void deactivate()() {
2836 pango_renderer_deactivate(&this);
2839 // VERSION: 1.8
2840 // Draw a squiggly line that approximately covers the given rectangle
2841 // in the style of an underline used to indicate a spelling error.
2842 // (The width of the underline is rounded to an integer number
2843 // of up/down segments and the resulting rectangle is centered
2844 // in the original rectangle)
2845 // This should be called while @renderer is already active. Use
2846 // pango_renderer_activate() to activate a renderer.
2847 // <x>: X coordinate of underline, in Pango units in user coordinate system
2848 // <y>: Y coordinate of underline, in Pango units in user coordinate system
2849 // <width>: width of underline, in Pango units in user coordinate system
2850 // <height>: height of underline, in Pango units in user coordinate system
2851 void draw_error_underline()(int x, int y, int width, int height) {
2852 pango_renderer_draw_error_underline(&this, x, y, width, height);
2855 // VERSION: 1.8
2856 // Draws a single glyph with coordinates in device space.
2857 // <font>: a #PangoFont
2858 // <glyph>: the glyph index of a single glyph
2859 // <x>: X coordinate of left edge of baseline of glyph
2860 // <y>: Y coordinate of left edge of baseline of glyph
2861 void draw_glyph()(Font* font, Glyph glyph, double x, double y) {
2862 pango_renderer_draw_glyph(&this, font, glyph, x, y);
2865 // VERSION: 1.22
2866 // Draws the glyphs in @glyph_item with the specified #PangoRenderer,
2867 // embedding the text associated with the glyphs in the output if the
2868 // output format supports it (PDF for example).
2869 // Note that @text is the start of the text for layout, which is then
2870 // indexed by <literal>@glyph_item->item->offset</literal>.
2871 // If @text is %NULL, this simply calls pango_renderer_draw_glyphs().
2872 // The default implementation of this method simply falls back to
2873 // pango_renderer_draw_glyphs().
2874 // <text>: the UTF-8 text that @glyph_item refers to, or %NULL
2875 // <glyph_item>: a #PangoGlyphItem
2876 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2877 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2878 void draw_glyph_item()(char* text, GlyphItem* glyph_item, int x, int y) {
2879 pango_renderer_draw_glyph_item(&this, text, glyph_item, x, y);
2882 // VERSION: 1.8
2883 // Draws the glyphs in @glyphs with the specified #PangoRenderer.
2884 // <font>: a #PangoFont
2885 // <glyphs>: a #PangoGlyphString
2886 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2887 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2888 void draw_glyphs()(Font* font, GlyphString* glyphs, int x, int y) {
2889 pango_renderer_draw_glyphs(&this, font, glyphs, x, y);
2892 // VERSION: 1.8
2893 // Draws @layout with the specified #PangoRenderer.
2894 // <layout>: a #PangoLayout
2895 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2896 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2897 void draw_layout()(Layout* layout, int x, int y) {
2898 pango_renderer_draw_layout(&this, layout, x, y);
2901 // VERSION: 1.8
2902 // Draws @line with the specified #PangoRenderer.
2903 // <line>: a #PangoLayoutLine
2904 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2905 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2906 void draw_layout_line()(LayoutLine* line, int x, int y) {
2907 pango_renderer_draw_layout_line(&this, line, x, y);
2910 // VERSION: 1.8
2911 // Draws an axis-aligned rectangle in user space coordinates with the
2912 // specified #PangoRenderer.
2913 // This should be called while @renderer is already active. Use
2914 // pango_renderer_activate() to activate a renderer.
2915 // <part>: type of object this rectangle is part of
2916 // <x>: X position at which to draw rectangle, in user space coordinates in Pango units
2917 // <y>: Y position at which to draw rectangle, in user space coordinates in Pango units
2918 // <width>: width of rectangle in Pango units in user space coordinates
2919 // <height>: height of rectangle in Pango units in user space coordinates
2920 void draw_rectangle()(RenderPart part, int x, int y, int width, int height) {
2921 pango_renderer_draw_rectangle(&this, part, x, y, width, height);
2924 // VERSION: 1.8
2925 // Draws a trapezoid with the parallel sides aligned with the X axis
2926 // using the given #PangoRenderer; coordinates are in device space.
2927 // <part>: type of object this trapezoid is part of
2928 // <y1_>: Y coordinate of top of trapezoid
2929 // <x11>: X coordinate of left end of top of trapezoid
2930 // <x21>: X coordinate of right end of top of trapezoid
2931 // <y2>: Y coordinate of bottom of trapezoid
2932 // <x12>: X coordinate of left end of bottom of trapezoid
2933 // <x22>: X coordinate of right end of bottom of trapezoid
2934 void draw_trapezoid()(RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22) {
2935 pango_renderer_draw_trapezoid(&this, part, y1_, x11, x21, y2, x12, x22);
2938 // VERSION: 1.8
2939 // Gets the current rendering color for the specified part.
2940 // if it hasn't been set and should be inherited from the
2941 // environment.
2942 // RETURNS: the color for the specified part, or %NULL
2943 // <part>: the part to get the color for
2944 Color* /*new*/ get_color()(RenderPart part) {
2945 return pango_renderer_get_color(&this, part);
2948 // Unintrospectable method: get_layout() / pango_renderer_get_layout()
2949 // VERSION: 1.20
2950 // Gets the layout currently being rendered using @renderer.
2951 // Calling this function only makes sense from inside a subclass's
2952 // methods, like in its draw_shape<!---->() for example.
2953 // The returned layout should not be modified while still being
2954 // rendered.
2955 // rendered using @renderer at this time.
2956 // RETURNS: the layout, or %NULL if no layout is being
2957 Layout* get_layout()() {
2958 return pango_renderer_get_layout(&this);
2961 // VERSION: 1.20
2962 // Gets the layout line currently being rendered using @renderer.
2963 // Calling this function only makes sense from inside a subclass's
2964 // methods, like in its draw_shape<!---->() for example.
2965 // The returned layout line should not be modified while still being
2966 // rendered.
2967 // rendered using @renderer at this time.
2968 // RETURNS: the layout line, or %NULL if no layout line is being
2969 LayoutLine* /*new*/ get_layout_line()() {
2970 return pango_renderer_get_layout_line(&this);
2973 // VERSION: 1.8
2974 // Gets the transformation matrix that will be applied when
2975 // rendering. See pango_renderer_set_matrix().
2976 // (which is the same as the identity matrix). The returned
2977 // matrix is owned by Pango and must not be modified or
2978 // freed.
2979 // RETURNS: the matrix, or %NULL if no matrix has been set
2980 Matrix* get_matrix()() {
2981 return pango_renderer_get_matrix(&this);
2984 // VERSION: 1.8
2985 // Informs Pango that the way that the rendering is done
2986 // for @part has changed in a way that would prevent multiple
2987 // pieces being joined together into one drawing call. For
2988 // instance, if a subclass of #PangoRenderer was to add a stipple
2989 // option for drawing underlines, it needs to call
2990 // <informalexample><programlisting>
2991 // pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);
2992 // </programlisting></informalexample>
2993 // When the stipple changes or underlines with different stipples
2994 // might be joined together. Pango automatically calls this for
2995 // changes to colors. (See pango_renderer_set_color())
2996 // <part>: the part for which rendering has changed.
2997 void part_changed()(RenderPart part) {
2998 pango_renderer_part_changed(&this, part);
3001 // VERSION: 1.8
3002 // Sets the color for part of the rendering.
3003 // <part>: the part to change the color of
3004 // <color>: the new color or %NULL to unset the current color
3005 void set_color()(RenderPart part, Color* color) {
3006 pango_renderer_set_color(&this, part, color);
3009 // VERSION: 1.8
3010 // Sets the transformation matrix that will be applied when rendering.
3011 // <matrix>: a #PangoMatrix, or %NULL to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)
3012 void set_matrix()(Matrix* matrix) {
3013 pango_renderer_set_matrix(&this, matrix);
3017 // Class structure for #PangoRenderer.
3018 struct RendererClass /* Version 1.8 */ {
3019 private GObject2.ObjectClass parent_class;
3021 // <font>: a #PangoFont
3022 // <glyphs>: a #PangoGlyphString
3023 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3024 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3025 extern (C) void function (Renderer* renderer, Font* font, GlyphString* glyphs, int x, int y) draw_glyphs;
3027 // <part>: type of object this rectangle is part of
3028 // <x>: X position at which to draw rectangle, in user space coordinates in Pango units
3029 // <y>: Y position at which to draw rectangle, in user space coordinates in Pango units
3030 // <width>: width of rectangle in Pango units in user space coordinates
3031 // <height>: height of rectangle in Pango units in user space coordinates
3032 extern (C) void function (Renderer* renderer, RenderPart part, int x, int y, int width, int height) draw_rectangle;
3034 // <x>: X coordinate of underline, in Pango units in user coordinate system
3035 // <y>: Y coordinate of underline, in Pango units in user coordinate system
3036 // <width>: width of underline, in Pango units in user coordinate system
3037 // <height>: height of underline, in Pango units in user coordinate system
3038 extern (C) void function (Renderer* renderer, int x, int y, int width, int height) draw_error_underline;
3039 extern (C) void function (Renderer* renderer, AttrShape* attr, int x, int y) draw_shape;
3041 // <part>: type of object this trapezoid is part of
3042 // <y1_>: Y coordinate of top of trapezoid
3043 // <x11>: X coordinate of left end of top of trapezoid
3044 // <x21>: X coordinate of right end of top of trapezoid
3045 // <y2>: Y coordinate of bottom of trapezoid
3046 // <x12>: X coordinate of left end of bottom of trapezoid
3047 // <x22>: X coordinate of right end of bottom of trapezoid
3048 extern (C) void function (Renderer* renderer, RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22) draw_trapezoid;
3050 // <font>: a #PangoFont
3051 // <glyph>: the glyph index of a single glyph
3052 // <x>: X coordinate of left edge of baseline of glyph
3053 // <y>: Y coordinate of left edge of baseline of glyph
3054 extern (C) void function (Renderer* renderer, Font* font, Glyph glyph, double x, double y) draw_glyph;
3055 // <part>: the part for which rendering has changed.
3056 extern (C) void function (Renderer* renderer, RenderPart part) part_changed;
3057 extern (C) void function (Renderer* renderer) begin;
3058 extern (C) void function (Renderer* renderer) end;
3059 extern (C) void function (Renderer* renderer, LayoutRun* run) prepare_run;
3061 // <text>: the UTF-8 text that @glyph_item refers to, or %NULL
3062 // <glyph_item>: a #PangoGlyphItem
3063 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
3064 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
3065 extern (C) void function (Renderer* renderer, char* text, GlyphItem* glyph_item, int x, int y) draw_glyph_item;
3066 extern (C) void function () _pango_reserved2;
3067 extern (C) void function () _pango_reserved3;
3068 extern (C) void function () _pango_reserved4;
3071 struct RendererPrivate {
3074 enum int SCALE = 1024;
3075 enum Script {
3076 INVALID_CODE = -1,
3077 COMMON = 0,
3078 INHERITED = 1,
3079 ARABIC = 2,
3080 ARMENIAN = 3,
3081 BENGALI = 4,
3082 BOPOMOFO = 5,
3083 CHEROKEE = 6,
3084 COPTIC = 7,
3085 CYRILLIC = 8,
3086 DESERET = 9,
3087 DEVANAGARI = 10,
3088 ETHIOPIC = 11,
3089 GEORGIAN = 12,
3090 GOTHIC = 13,
3091 GREEK = 14,
3092 GUJARATI = 15,
3093 GURMUKHI = 16,
3094 HAN = 17,
3095 HANGUL = 18,
3096 HEBREW = 19,
3097 HIRAGANA = 20,
3098 KANNADA = 21,
3099 KATAKANA = 22,
3100 KHMER = 23,
3101 LAO = 24,
3102 LATIN = 25,
3103 MALAYALAM = 26,
3104 MONGOLIAN = 27,
3105 MYANMAR = 28,
3106 OGHAM = 29,
3107 OLD_ITALIC = 30,
3108 ORIYA = 31,
3109 RUNIC = 32,
3110 SINHALA = 33,
3111 SYRIAC = 34,
3112 TAMIL = 35,
3113 TELUGU = 36,
3114 THAANA = 37,
3115 THAI = 38,
3116 TIBETAN = 39,
3117 CANADIAN_ABORIGINAL = 40,
3118 YI = 41,
3119 TAGALOG = 42,
3120 HANUNOO = 43,
3121 BUHID = 44,
3122 TAGBANWA = 45,
3123 BRAILLE = 46,
3124 CYPRIOT = 47,
3125 LIMBU = 48,
3126 OSMANYA = 49,
3127 SHAVIAN = 50,
3128 LINEAR_B = 51,
3129 TAI_LE = 52,
3130 UGARITIC = 53,
3131 NEW_TAI_LUE = 54,
3132 BUGINESE = 55,
3133 GLAGOLITIC = 56,
3134 TIFINAGH = 57,
3135 SYLOTI_NAGRI = 58,
3136 OLD_PERSIAN = 59,
3137 KHAROSHTHI = 60,
3138 UNKNOWN = 61,
3139 BALINESE = 62,
3140 CUNEIFORM = 63,
3141 PHOENICIAN = 64,
3142 PHAGS_PA = 65,
3143 NKO = 66,
3144 KAYAH_LI = 67,
3145 LEPCHA = 68,
3146 REJANG = 69,
3147 SUNDANESE = 70,
3148 SAURASHTRA = 71,
3149 CHAM = 72,
3150 OL_CHIKI = 73,
3151 VAI = 74,
3152 CARIAN = 75,
3153 LYCIAN = 76,
3154 LYDIAN = 77
3157 // A #PangoScriptIter is used to iterate through a string
3158 // and identify ranges in different scripts.
3159 struct ScriptIter {
3161 // VERSION: 1.4
3162 // Frees a #PangoScriptIter created with pango_script_iter_new().
3163 void free()() {
3164 pango_script_iter_free(&this);
3167 // VERSION: 1.4
3168 // Gets information about the range to which @iter currently points.
3169 // The range is the set of locations p where *start <= p < *end.
3170 // (That is, it doesn't include the character stored at *end)
3171 // <start>: location to store start position of the range, or %NULL
3172 // <end>: location to store end position of the range, or %NULL
3173 // <script>: location to store script for range, or %NULL
3174 void get_range()(char** start, char** end, Script* script) {
3175 pango_script_iter_get_range(&this, start, end, script);
3178 // VERSION: 1.4
3179 // Advances a #PangoScriptIter to the next range. If @iter
3180 // is already at the end, it is left unchanged and %FALSE
3181 // is returned.
3182 // RETURNS: %TRUE if @iter was successfully advanced.
3183 int next()() {
3184 return pango_script_iter_next(&this);
3188 enum Stretch {
3189 ULTRA_CONDENSED = 0,
3190 EXTRA_CONDENSED = 1,
3191 CONDENSED = 2,
3192 SEMI_CONDENSED = 3,
3193 NORMAL = 4,
3194 SEMI_EXPANDED = 5,
3195 EXPANDED = 6,
3196 EXTRA_EXPANDED = 7,
3197 ULTRA_EXPANDED = 8
3199 // An enumeration specifying the various slant styles possible for a font.
3200 enum Style {
3201 NORMAL = 0,
3202 OBLIQUE = 1,
3203 ITALIC = 2
3205 enum TabAlign {
3206 LEFT = 0
3208 struct TabArray {
3210 // Creates an array of @initial_size tab stops. Tab stops are specified in
3211 // pixel units if @positions_in_pixels is %TRUE, otherwise in Pango
3212 // units. All stops are initially at position 0.
3213 // be freed with pango_tab_array_free().
3214 // RETURNS: the newly allocated #PangoTabArray, which should
3215 // <initial_size>: Initial number of tab stops to allocate, can be 0
3216 // <positions_in_pixels>: whether positions are in pixel units
3217 static TabArray* /*new*/ new_()(int initial_size, int positions_in_pixels) {
3218 return pango_tab_array_new(initial_size, positions_in_pixels);
3221 // Unintrospectable constructor: new_with_positions() / pango_tab_array_new_with_positions()
3222 // This is a convenience function that creates a #PangoTabArray
3223 // and allows you to specify the alignment and position of each
3224 // tab stop. You <emphasis>must</emphasis> provide an alignment
3225 // and position for @size tab stops.
3226 // be freed with pango_tab_array_free().
3227 // RETURNS: the newly allocated #PangoTabArray, which should
3228 // <size>: number of tab stops in the array
3229 // <positions_in_pixels>: whether positions are in pixel units
3230 // <first_alignment>: alignment of first tab stop
3231 // <first_position>: position of first tab stop
3232 alias pango_tab_array_new_with_positions new_with_positions; // Variadic
3234 // Copies a #PangoTabArray
3235 // be freed with pango_tab_array_free().
3236 // RETURNS: the newly allocated #PangoTabArray, which should
3237 TabArray* /*new*/ copy()() {
3238 return pango_tab_array_copy(&this);
3240 // Frees a tab array and associated resources.
3241 void free()() {
3242 pango_tab_array_free(&this);
3245 // Returns %TRUE if the tab positions are in pixels, %FALSE if they are
3246 // in Pango units.
3247 // RETURNS: whether positions are in pixels.
3248 int get_positions_in_pixels()() {
3249 return pango_tab_array_get_positions_in_pixels(&this);
3252 // Gets the number of tab stops in @tab_array.
3253 // RETURNS: the number of tab stops in the array.
3254 int get_size()() {
3255 return pango_tab_array_get_size(&this);
3258 // Gets the alignment and position of a tab stop.
3259 // <tab_index>: tab stop index
3260 // <alignment>: location to store alignment, or %NULL
3261 // <location>: location to store tab position, or %NULL
3262 void get_tab()(int tab_index, TabAlign* alignment, int* location) {
3263 pango_tab_array_get_tab(&this, tab_index, alignment, location);
3266 // If non-%NULL, @alignments and @locations are filled with allocated
3267 // arrays of length pango_tab_array_get_size(). You must free the
3268 // returned array.
3269 // <alignments>: location to store an array of tab stop alignments, or %NULL
3270 // <locations>: location to store an array of tab positions, or %NULL
3271 void get_tabs()(TabAlign** alignments, int** locations) {
3272 pango_tab_array_get_tabs(&this, alignments, locations);
3275 // Resizes a tab array. You must subsequently initialize any tabs that
3276 // were added as a result of growing the array.
3277 // <new_size>: new size of the array
3278 void resize()(int new_size) {
3279 pango_tab_array_resize(&this, new_size);
3282 // Sets the alignment and location of a tab stop.
3283 // implementation.
3284 // <tab_index>: the index of a tab stop
3285 // <alignment>: tab alignment
3286 // <location>: tab location in Pango units
3287 void set_tab()(int tab_index, TabAlign alignment, int location) {
3288 pango_tab_array_set_tab(&this, tab_index, alignment, location);
3292 enum int UNKNOWN_GLYPH_HEIGHT = 14;
3293 enum int UNKNOWN_GLYPH_WIDTH = 10;
3294 enum Underline {
3295 NONE = 0,
3296 SINGLE = 1,
3297 DOUBLE = 2,
3298 LOW = 3,
3299 ERROR = 4
3301 enum Variant {
3302 NORMAL = 0,
3303 SMALL_CAPS = 1
3305 enum Weight {
3306 THIN = 100,
3307 ULTRALIGHT = 200,
3308 LIGHT = 300,
3309 BOOK = 380,
3310 NORMAL = 400,
3311 MEDIUM = 500,
3312 SEMIBOLD = 600,
3313 BOLD = 700,
3314 ULTRABOLD = 800,
3315 HEAVY = 900,
3316 ULTRAHEAVY = 1000
3318 enum WrapMode {
3319 WORD = 0,
3320 CHAR = 1,
3321 WORD_CHAR = 2
3323 struct _ScriptForLang {
3324 char[7] lang;
3325 Script[3] scripts;
3329 // Unintrospectable function: attr_background_new() / pango_attr_background_new()
3330 // Create a new background color attribute.
3331 // freed with pango_attribute_destroy().
3332 // RETURNS: the newly allocated #PangoAttribute, which should be
3333 // <red>: the red value (ranging from 0 to 65535)
3334 // <green>: the green value
3335 // <blue>: the blue value
3336 static Attribute* attr_background_new()(ushort red, ushort green, ushort blue) {
3337 return pango_attr_background_new(red, green, blue);
3341 // Unintrospectable function: attr_fallback_new() / pango_attr_fallback_new()
3342 // VERSION: 1.4
3343 // Create a new font fallback attribute.
3344 // If fallback is disabled, characters will only be used from the
3345 // closest matching font on the system. No fallback will be done to
3346 // other fonts on the system that might contain the characters in the
3347 // text.
3348 // freed with pango_attribute_destroy().
3349 // RETURNS: the newly allocated #PangoAttribute, which should be
3350 // <enable_fallback>: %TRUE if we should fall back on other fonts for characters the active font is missing.
3351 static Attribute* attr_fallback_new()(int enable_fallback) {
3352 return pango_attr_fallback_new(enable_fallback);
3356 // Unintrospectable function: attr_family_new() / pango_attr_family_new()
3357 // Create a new font family attribute.
3358 // freed with pango_attribute_destroy().
3359 // RETURNS: the newly allocated #PangoAttribute, which should be
3360 // <family>: the family or comma separated list of families
3361 static Attribute* attr_family_new()(char* family) {
3362 return pango_attr_family_new(family);
3366 // Unintrospectable function: attr_font_desc_new() / pango_attr_font_desc_new()
3367 // Create a new font description attribute. This attribute
3368 // allows setting family, style, weight, variant, stretch,
3369 // and size simultaneously.
3370 // freed with pango_attribute_destroy().
3371 // RETURNS: the newly allocated #PangoAttribute, which should be
3372 // <desc>: the font description
3373 static Attribute* attr_font_desc_new()(FontDescription* desc) {
3374 return pango_attr_font_desc_new(desc);
3378 // Unintrospectable function: attr_foreground_new() / pango_attr_foreground_new()
3379 // Create a new foreground color attribute.
3380 // freed with pango_attribute_destroy().
3381 // RETURNS: the newly allocated #PangoAttribute, which should be
3382 // <red>: the red value (ranging from 0 to 65535)
3383 // <green>: the green value
3384 // <blue>: the blue value
3385 static Attribute* attr_foreground_new()(ushort red, ushort green, ushort blue) {
3386 return pango_attr_foreground_new(red, green, blue);
3390 // Unintrospectable function: attr_gravity_hint_new() / pango_attr_gravity_hint_new()
3391 // VERSION: 1.16
3392 // Create a new gravity hint attribute.
3393 // freed with pango_attribute_destroy().
3394 // RETURNS: the newly allocated #PangoAttribute, which should be
3395 // <hint>: the gravity hint value.
3396 static Attribute* attr_gravity_hint_new()(GravityHint hint) {
3397 return pango_attr_gravity_hint_new(hint);
3401 // Unintrospectable function: attr_gravity_new() / pango_attr_gravity_new()
3402 // VERSION: 1.16
3403 // Create a new gravity attribute.
3404 // freed with pango_attribute_destroy().
3405 // RETURNS: the newly allocated #PangoAttribute, which should be
3406 // <gravity>: the gravity value; should not be %PANGO_GRAVITY_AUTO.
3407 static Attribute* attr_gravity_new()(Gravity gravity) {
3408 return pango_attr_gravity_new(gravity);
3412 // Unintrospectable function: attr_language_new() / pango_attr_language_new()
3413 // Create a new language tag attribute.
3414 // freed with pango_attribute_destroy().
3415 // RETURNS: the newly allocated #PangoAttribute, which should be
3416 // <language>: language tag
3417 static Attribute* attr_language_new()(Language* language) {
3418 return pango_attr_language_new(language);
3422 // Unintrospectable function: attr_letter_spacing_new() / pango_attr_letter_spacing_new()
3423 // VERSION: 1.6
3424 // Create a new letter-spacing attribute.
3425 // freed with pango_attribute_destroy().
3426 // RETURNS: the newly allocated #PangoAttribute, which should be
3427 // <letter_spacing>: amount of extra space to add between graphemes of the text, in Pango units.
3428 static Attribute* attr_letter_spacing_new()(int letter_spacing) {
3429 return pango_attr_letter_spacing_new(letter_spacing);
3433 // Unintrospectable function: attr_rise_new() / pango_attr_rise_new()
3434 // Create a new baseline displacement attribute.
3435 // freed with pango_attribute_destroy().
3436 // RETURNS: the newly allocated #PangoAttribute, which should be
3437 // <rise>: the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.
3438 static Attribute* attr_rise_new()(int rise) {
3439 return pango_attr_rise_new(rise);
3443 // Unintrospectable function: attr_scale_new() / pango_attr_scale_new()
3444 // Create a new font size scale attribute. The base font for the
3445 // affected text will have its size multiplied by @scale_factor.
3446 // freed with pango_attribute_destroy().
3447 // RETURNS: the newly allocated #PangoAttribute, which should be
3448 // <scale_factor>: factor to scale the font
3449 static Attribute* attr_scale_new()(double scale_factor) {
3450 return pango_attr_scale_new(scale_factor);
3454 // Unintrospectable function: attr_shape_new() / pango_attr_shape_new()
3455 // Create a new shape attribute. A shape is used to impose a
3456 // particular ink and logical rectangle on the result of shaping a
3457 // particular glyph. This might be used, for instance, for
3458 // embedding a picture or a widget inside a #PangoLayout.
3459 // freed with pango_attribute_destroy().
3460 // RETURNS: the newly allocated #PangoAttribute, which should be
3461 // <ink_rect>: ink rectangle to assign to each character
3462 // <logical_rect>: logical rectangle to assign to each character
3463 static Attribute* attr_shape_new()(Rectangle* ink_rect, Rectangle* logical_rect) {
3464 return pango_attr_shape_new(ink_rect, logical_rect);
3468 // Unintrospectable function: attr_shape_new_with_data() / pango_attr_shape_new_with_data()
3469 // VERSION: 1.8
3470 // Like pango_attr_shape_new(), but a user data pointer is also
3471 // provided; this pointer can be accessed when later
3472 // rendering the glyph.
3473 // freed with pango_attribute_destroy().
3474 // RETURNS: the newly allocated #PangoAttribute, which should be
3475 // <ink_rect>: ink rectangle to assign to each character
3476 // <logical_rect>: logical rectangle to assign to each character
3477 // <data>: user data pointer
3478 // <copy_func>: function to copy @data when the attribute is copied. If %NULL, @data is simply copied as a pointer.
3479 // <destroy_func>: function to free @data when the attribute is freed, or %NULL
3480 static Attribute* attr_shape_new_with_data()(Rectangle* ink_rect, Rectangle* logical_rect, void* data, AttrDataCopyFunc copy_func, GLib2.DestroyNotify destroy_func) {
3481 return pango_attr_shape_new_with_data(ink_rect, logical_rect, data, copy_func, destroy_func);
3485 // Unintrospectable function: attr_size_new() / pango_attr_size_new()
3486 // Create a new font-size attribute in fractional points.
3487 // freed with pango_attribute_destroy().
3488 // RETURNS: the newly allocated #PangoAttribute, which should be
3489 // <size>: the font size, in %PANGO_SCALE<!-- -->ths of a point.
3490 static Attribute* attr_size_new()(int size) {
3491 return pango_attr_size_new(size);
3495 // Unintrospectable function: attr_size_new_absolute() / pango_attr_size_new_absolute()
3496 // VERSION: 1.8
3497 // Create a new font-size attribute in device units.
3498 // freed with pango_attribute_destroy().
3499 // RETURNS: the newly allocated #PangoAttribute, which should be
3500 // <size>: the font size, in %PANGO_SCALE<!-- -->ths of a device unit.
3501 static Attribute* attr_size_new_absolute()(int size) {
3502 return pango_attr_size_new_absolute(size);
3506 // Unintrospectable function: attr_stretch_new() / pango_attr_stretch_new()
3507 // Create a new font stretch attribute
3508 // freed with pango_attribute_destroy().
3509 // RETURNS: the newly allocated #PangoAttribute, which should be
3510 // <stretch>: the stretch
3511 static Attribute* attr_stretch_new()(Stretch stretch) {
3512 return pango_attr_stretch_new(stretch);
3516 // Unintrospectable function: attr_strikethrough_color_new() / pango_attr_strikethrough_color_new()
3517 // VERSION: 1.8
3518 // Create a new strikethrough color attribute. This attribute
3519 // modifies the color of strikethrough lines. If not set, strikethrough
3520 // lines will use the foreground color.
3521 // freed with pango_attribute_destroy().
3522 // RETURNS: the newly allocated #PangoAttribute, which should be
3523 // <red>: the red value (ranging from 0 to 65535)
3524 // <green>: the green value
3525 // <blue>: the blue value
3526 static Attribute* attr_strikethrough_color_new()(ushort red, ushort green, ushort blue) {
3527 return pango_attr_strikethrough_color_new(red, green, blue);
3531 // Unintrospectable function: attr_strikethrough_new() / pango_attr_strikethrough_new()
3532 // Create a new strike-through attribute.
3533 // freed with pango_attribute_destroy().
3534 // RETURNS: the newly allocated #PangoAttribute, which should be
3535 // <strikethrough>: %TRUE if the text should be struck-through.
3536 static Attribute* attr_strikethrough_new()(int strikethrough) {
3537 return pango_attr_strikethrough_new(strikethrough);
3541 // Unintrospectable function: attr_style_new() / pango_attr_style_new()
3542 // Create a new font slant style attribute.
3543 // freed with pango_attribute_destroy().
3544 // RETURNS: the newly allocated #PangoAttribute, which should be
3545 // <style>: the slant style
3546 static Attribute* attr_style_new()(Style style) {
3547 return pango_attr_style_new(style);
3551 // VERSION: 1.22
3552 // Fetches the attribute type name passed in when registering the type using
3553 // pango_attr_type_register().
3554 // The returned value is an interned string (see g_intern_string() for what
3555 // that means) that should not be modified or freed.
3556 // a built-in Pango attribute type or invalid.
3557 // RETURNS: the type ID name (which may be %NULL), or %NULL if @type is
3558 // <type>: an attribute type ID to fetch the name for
3559 static char* attr_type_get_name()(AttrType type) {
3560 return pango_attr_type_get_name(type);
3564 // Allocate a new attribute type ID. The attribute type name can be accessed
3565 // later by using pango_attr_type_get_name().
3566 // RETURNS: the new type ID.
3567 // <name>: an identifier for the type
3568 static AttrType attr_type_register()(char* name) {
3569 return pango_attr_type_register(name);
3573 // Unintrospectable function: attr_underline_color_new() / pango_attr_underline_color_new()
3574 // VERSION: 1.8
3575 // Create a new underline color attribute. This attribute
3576 // modifies the color of underlines. If not set, underlines
3577 // will use the foreground color.
3578 // freed with pango_attribute_destroy().
3579 // RETURNS: the newly allocated #PangoAttribute, which should be
3580 // <red>: the red value (ranging from 0 to 65535)
3581 // <green>: the green value
3582 // <blue>: the blue value
3583 static Attribute* attr_underline_color_new()(ushort red, ushort green, ushort blue) {
3584 return pango_attr_underline_color_new(red, green, blue);
3588 // Unintrospectable function: attr_underline_new() / pango_attr_underline_new()
3589 // Create a new underline-style attribute.
3590 // freed with pango_attribute_destroy().
3591 // RETURNS: the newly allocated #PangoAttribute, which should be
3592 // <underline>: the underline style.
3593 static Attribute* attr_underline_new()(Underline underline) {
3594 return pango_attr_underline_new(underline);
3598 // Unintrospectable function: attr_variant_new() / pango_attr_variant_new()
3599 // Create a new font variant attribute (normal or small caps)
3600 // freed with pango_attribute_destroy().
3601 // RETURNS: the newly allocated #PangoAttribute, which should be
3602 // <variant>: the variant
3603 static Attribute* attr_variant_new()(Variant variant) {
3604 return pango_attr_variant_new(variant);
3608 // Unintrospectable function: attr_weight_new() / pango_attr_weight_new()
3609 // Create a new font weight attribute.
3610 // freed with pango_attribute_destroy().
3611 // RETURNS: the newly allocated #PangoAttribute, which should be
3612 // <weight>: the weight
3613 static Attribute* attr_weight_new()(Weight weight) {
3614 return pango_attr_weight_new(weight);
3618 // VERSION: 1.22
3619 // Determines the normative bidirectional character type of a
3620 // character, as specified in the Unicode Character Database.
3621 // A simplified version of this function is available as
3622 // pango_unichar_get_direction().
3623 // Unicode bidirectional algorithm.
3624 // RETURNS: the bidirectional character type, as used in the
3625 // <ch>: a Unicode character
3626 static BidiType bidi_type_for_unichar()(dchar ch) {
3627 return pango_bidi_type_for_unichar(ch);
3631 // Determines possible line, word, and character breaks
3632 // for a string of Unicode text with a single analysis. For most
3633 // purposes you may want to use pango_get_log_attrs().
3634 // <text>: the text to process
3635 // <length>: length of @text in bytes (may be -1 if @text is nul-terminated)
3636 // <analysis>: #PangoAnalysis structure from pango_itemize()
3637 // <attrs>: an array to store character information in
3638 // <attrs_len>: size of the array passed as @attrs
3639 static void break_()(char* text, int length, Analysis* analysis, LogAttr* attrs, int attrs_len) {
3640 pango_break(text, length, analysis, attrs, attrs_len);
3644 // Unintrospectable function: coverage_from_bytes() / pango_coverage_from_bytes()
3645 // Convert data generated from pango_converage_to_bytes() back
3646 // to a #PangoCoverage
3647 // the data was invalid.
3648 // RETURNS: a newly allocated #PangoCoverage, or %NULL if
3649 // <bytes>: binary data representing a #PangoCoverage
3650 // <n_bytes>: the size of @bytes in bytes
3651 static Coverage* coverage_from_bytes()(ubyte* bytes, int n_bytes) {
3652 return pango_coverage_from_bytes(bytes, n_bytes);
3656 // Unintrospectable function: coverage_new() / pango_coverage_new()
3657 // Create a new #PangoCoverage
3658 // initialized to %PANGO_COVERAGE_NONE
3659 // with a reference count of one, which
3660 // should be freed with pango_coverage_unref().
3661 // RETURNS: the newly allocated #PangoCoverage,
3662 static Coverage* coverage_new()() {
3663 return pango_coverage_new();
3667 // VERSION: 1.16
3668 // Converts extents from Pango units to device units, dividing by the
3669 // %PANGO_SCALE factor and performing rounding.
3670 // The @inclusive rectangle is converted by flooring the x/y coordinates and extending
3671 // width/height, such that the final rectangle completely includes the original
3672 // rectangle.
3673 // The @nearest rectangle is converted by rounding the coordinates
3674 // of the rectangle to the nearest device unit (pixel).
3675 // rectangle to completely contain the original rectangle, pass it in as @inclusive.
3676 // If you want two touching-but-not-overlapping rectangles stay
3677 // touching-but-not-overlapping after rounding to device units, pass them in
3678 // as @nearest.
3679 // <inclusive>: rectangle to round to pixels inclusively, or %NULL.
3680 // <nearest>: rectangle to round to nearest pixels, or %NULL.
3681 static void extents_to_pixels()(Rectangle* inclusive, Rectangle* nearest) {
3682 pango_extents_to_pixels(inclusive, nearest);
3686 // VERSION: 1.4
3687 // Searches a string the first character that has a strong
3688 // direction, according to the Unicode bidirectional algorithm.
3689 // If no such character is found, then %PANGO_DIRECTION_NEUTRAL is returned.
3690 // RETURNS: The direction corresponding to the first strong character.
3691 // <text>: the text to process
3692 // <length>: length of @text in bytes (may be -1 if @text is nul-terminated)
3693 static Direction find_base_dir()(char* text, int length) {
3694 return pango_find_base_dir(text, length);
3698 // Locates a paragraph boundary in @text. A boundary is caused by
3699 // delimiter characters, such as a newline, carriage return, carriage
3700 // return-newline pair, or Unicode paragraph separator character. The
3701 // index of the run of delimiters is returned in
3702 // (index after all delimiters) is stored in @next_paragraph_start.
3703 // If no delimiters are found, both @paragraph_delimiter_index and
3704 // off the end).
3705 // <text>: UTF-8 text
3706 // <length>: length of @text in bytes, or -1 if nul-terminated
3707 // <paragraph_delimiter_index>: return location for index of delimiter
3708 // <next_paragraph_start>: return location for start of next paragraph
3709 static void find_paragraph_boundary()(char* text, int length, int* paragraph_delimiter_index, int* next_paragraph_start) {
3710 pango_find_paragraph_boundary(text, length, paragraph_delimiter_index, next_paragraph_start);
3714 // Creates a new font description from a string representation in the
3715 // form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a
3716 // comma separated list of families optionally terminated by a comma,
3717 // STYLE_OPTIONS is a whitespace separated list of words where each WORD
3718 // describes one of style, variant, weight, stretch, or gravity, and SIZE
3719 // is a decimal number (size in points) or optionally followed by the
3720 // unit modifier "px" for absolute size. Any one of the options may
3721 // be absent. If FAMILY-LIST is absent, then the family_name field of
3722 // the resulting font description will be initialized to %NULL. If
3723 // STYLE-OPTIONS is missing, then all style options will be set to the
3724 // default values. If SIZE is missing, the size in the resulting font
3725 // description will be set to 0.
3726 // RETURNS: a new #PangoFontDescription.
3727 // <str>: string representation of a font description.
3728 static FontDescription* /*new*/ font_description_from_string()(char* str) {
3729 return pango_font_description_from_string(str);
3733 // Computes a #PangoLogAttr for each character in @text. The @log_attrs
3734 // array must have one #PangoLogAttr for each position in @text; if
3735 // last position at the end of the text. @text should be an entire
3736 // paragraph; logical attributes can't be computed without context
3737 // (for example you need to see spaces on either side of a word to know
3738 // the word is a word).
3739 // <text>: text to process
3740 // <length>: length in bytes of @text
3741 // <level>: embedding level, or -1 if unknown
3742 // <language>: language tag
3743 // <log_attrs>: array with one #PangoLogAttr per character in @text, plus one extra, to be filled in
3744 // <attrs_len>: length of @log_attrs array
3745 static void get_log_attrs()(char* text, int length, int level, Language* language, LogAttr* log_attrs, int attrs_len) {
3746 pango_get_log_attrs(text, length, level, language, log_attrs, attrs_len);
3750 // If @ch has the Unicode mirrored property and there is another Unicode
3751 // character that typically has a glyph that is the mirror image of @ch's
3752 // glyph, puts that character in the address pointed to by @mirrored_ch.
3753 // Use g_unichar_get_mirror_char() instead; the docs for that function
3754 // provide full details.
3755 // filled in, %FALSE otherwise
3756 // RETURNS: %TRUE if @ch has a mirrored character and @mirrored_ch is
3757 // <ch>: a Unicode character
3758 // <mirrored_ch>: location to store the mirrored character
3759 static int get_mirror_char()(dchar ch, dchar* mirrored_ch) {
3760 return pango_get_mirror_char(ch, mirrored_ch);
3764 // VERSION: 1.16
3765 // Finds the gravity that best matches the rotation component
3766 // in a #PangoMatrix.
3767 // %PANGO_GRAVITY_AUTO, or %PANGO_GRAVITY_SOUTH if @matrix is %NULL
3768 // RETURNS: the gravity of @matrix, which will never be
3769 // <matrix>: a #PangoMatrix
3770 static Gravity gravity_get_for_matrix()(Matrix* matrix) {
3771 return pango_gravity_get_for_matrix(matrix);
3775 // VERSION: 1.16
3776 // Based on the script, base gravity, and hint, returns actual gravity
3777 // to use in laying out a single #PangoItem.
3778 // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
3779 // preferred gravity of @script. To get the preferred gravity of a script,
3780 // pass %PANGO_GRAVITY_AUTO and %PANGO_GRAVITY_HINT_STRONG in.
3781 // with @script.
3782 // RETURNS: resolved gravity suitable to use for a run of text
3783 // <script>: #PangoScript to query
3784 // <base_gravity>: base gravity of the paragraph
3785 // <hint>: orientation hint
3786 static Gravity gravity_get_for_script()(Script script, Gravity base_gravity, GravityHint hint) {
3787 return pango_gravity_get_for_script(script, base_gravity, hint);
3791 // VERSION: 1.26
3792 // Based on the script, East Asian width, base gravity, and hint,
3793 // returns actual gravity to use in laying out a single character
3794 // or #PangoItem.
3795 // This function is similar to pango_gravity_get_for_script() except
3796 // that this function makes a distinction between narrow/half-width and
3797 // wide/full-width characters also. Wide/full-width characters always
3798 // stand <emph>upright</emph>, that is, they always take the base gravity,
3799 // whereas narrow/full-width characters are always rotated in vertical
3800 // context.
3801 // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
3802 // preferred gravity of @script.
3803 // with @script and @wide.
3804 // RETURNS: resolved gravity suitable to use for a run of text
3805 // <script>: #PangoScript to query
3806 // <wide>: %TRUE for wide characters as returned by g_unichar_iswide()
3807 // <base_gravity>: base gravity of the paragraph
3808 // <hint>: orientation hint
3809 static Gravity gravity_get_for_script_and_width()(Script script, int wide, Gravity base_gravity, GravityHint hint) {
3810 return pango_gravity_get_for_script_and_width(script, wide, base_gravity, hint);
3814 // VERSION: 1.16
3815 // Converts a #PangoGravity value to its natural rotation in radians.
3816 // Note that pango_matrix_rotate() takes angle in degrees, not radians.
3817 // So, to call pango_matrix_rotate() with the output of this function
3818 // you should multiply it by (180. / G_PI).
3819 // RETURNS: the rotation value corresponding to @gravity.
3820 // <gravity>: gravity to query
3821 static double gravity_to_rotation()(Gravity gravity) {
3822 return pango_gravity_to_rotation(gravity);
3826 // VERSION: 1.10
3827 // Checks @ch to see if it is a character that should not be
3828 // normally rendered on the screen. This includes all Unicode characters
3829 // with "ZERO WIDTH" in their name, as well as <firstterm>bidi</firstterm> formatting characters, and
3830 // a few other ones. This is totally different from g_unichar_iszerowidth()
3831 // and is at best misnamed.
3832 // RETURNS: %TRUE if @ch is a zero-width character, %FALSE otherwise
3833 // <ch>: a Unicode character
3834 static int is_zero_width()(dchar ch) {
3835 return pango_is_zero_width(ch);
3839 // Unintrospectable function: itemize() / pango_itemize()
3840 // after @start_index.
3841 // This must be >= 0.
3842 // Breaks a piece of text into segments with consistent
3843 // directional level and shaping engine. Each byte of @text will
3844 // be contained in exactly one of the items in the returned list;
3845 // the generated list of items will be in logical order (the start
3846 // offsets of the items are ascending).
3847 // range before or containing @start_index; @cached_iter will be advanced to
3848 // the range covering the position just after @start_index + @length.
3849 // (i.e. if itemizing in a loop, just keep passing in the same @cached_iter).
3850 // RETURNS: a #GList of #PangoItem structures.
3851 // <context>: a structure holding information that affects
3852 // <text>: the text to itemize.
3853 // <start_index>: first byte in @text to process
3854 // <length>: the number of bytes (not characters) to process
3855 // <attrs>: the set of attributes that apply to @text.
3856 // <cached_iter>: Cached attribute iterator, or %NULL
3857 static GLib2.List* itemize()(Context* context, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter) {
3858 return pango_itemize(context, text, start_index, length, attrs, cached_iter);
3862 // Unintrospectable function: itemize_with_base_dir() / pango_itemize_with_base_dir()
3863 // VERSION: 1.4
3864 // after @start_index.
3865 // This must be >= 0.
3866 // Like pango_itemize(), but the base direction to use when
3867 // computing bidirectional levels (see pango_context_set_base_dir ()),
3868 // is specified explicitly rather than gotten from the #PangoContext.
3869 // freed using pango_item_free() probably in combination with g_list_foreach(),
3870 // and the list itself using g_list_free().
3871 // RETURNS: a #GList of #PangoItem structures. The items should be
3872 // <context>: a structure holding information that affects
3873 // <base_dir>: base direction to use for bidirectional processing
3874 // <text>: the text to itemize.
3875 // <start_index>: first byte in @text to process
3876 // <length>: the number of bytes (not characters) to process
3877 // <attrs>: the set of attributes that apply to @text.
3878 // <cached_iter>: Cached attribute iterator, or %NULL
3879 static GLib2.List* itemize_with_base_dir()(Context* context, Direction base_dir, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter) {
3880 return pango_itemize_with_base_dir(context, base_dir, text, start_index, length, attrs, cached_iter);
3884 // Take a RFC-3066 format language tag as a string and convert it to a
3885 // #PangoLanguage pointer that can be efficiently copied (copy the
3886 // pointer) and compared with other language tags (compare the
3887 // pointer.)
3888 // This function first canonicalizes the string by converting it to
3889 // lowercase, mapping '_' to '-', and stripping all characters other
3890 // than letters and '-'.
3891 // Use pango_language_get_default() if you want to get the #PangoLanguage for
3892 // the current locale of the process.
3893 // if @language was %NULL. The returned pointer will be valid
3894 // forever after, and should not be freed.
3895 // RETURNS: an opaque pointer to a #PangoLanguage structure, or %NULL
3896 // <language>: a string representing a language tag, or %NULL
3897 static Language* /*new*/ language_from_string()(char* language) {
3898 return pango_language_from_string(language);
3902 // VERSION: 1.16
3903 // Returns the #PangoLanguage for the current locale of the process.
3904 // Note that this can change over the life of an application.
3905 // On Unix systems, this is the return value is derived from
3906 // <literal>setlocale(LC_CTYPE, NULL)</literal>, and the user can
3907 // affect this through the environment variables LC_ALL, LC_CTYPE or
3908 // LANG (checked in that order). The locale string typically is in
3909 // the form lang_COUNTRY, where lang is an ISO-639 language code, and
3910 // COUNTRY is an ISO-3166 country code. For instance, sv_FI for
3911 // Swedish as written in Finland or pt_BR for Portuguese as written in
3912 // Brazil.
3913 // On Windows, the C library does not use any such environment
3914 // variables, and setting them won't affect the behavior of functions
3915 // like ctime(). The user sets the locale through the Regional Options
3916 // in the Control Panel. The C library (in the setlocale() function)
3917 // does not use country and language codes, but country and language
3918 // names spelled out in English.
3919 // However, this function does check the above environment
3920 // variables, and does return a Unix-style locale string based on
3921 // either said environment variables or the thread's current locale.
3922 // Your application should call <literal>setlocale(LC_ALL, "");</literal>
3923 // for the user settings to take effect. Gtk+ does this in its initialization
3924 // functions automatically (by calling gtk_set_locale()).
3925 // See <literal>man setlocale</literal> for more details.
3926 // freed.
3927 // RETURNS: the default language as a #PangoLanguage, must not be
3928 static Language* /*new*/ language_get_default()() {
3929 return pango_language_get_default();
3933 // VERSION: 1.4
3934 // This will return the bidirectional embedding levels of the input paragraph
3935 // as defined by the Unicode Bidirectional Algorithm available at:
3936 // http://www.unicode.org/reports/tr9/
3937 // If the input base direction is a weak direction, the direction of the
3938 // characters in the text will determine the final resolved direction.
3939 // character (not byte), that should be freed using g_free.
3940 // RETURNS: a newly allocated array of embedding levels, one item per
3941 // <text>: the text to itemize.
3942 // <length>: the number of bytes (not characters) to process, or -1 if @text is nul-terminated and the length should be calculated.
3943 // <pbase_dir>: input base direction, and output resolved direction.
3944 static ubyte* log2vis_get_embedding_levels()(char* text, int length, Direction* pbase_dir) {
3945 return pango_log2vis_get_embedding_levels(text, length, pbase_dir);
3949 // VERSION: 1.16
3950 // Parses an enum type and stores the result in @value.
3951 // If @str does not match the nick name of any of the possible values for the
3952 // enum and is not an integer, %FALSE is returned, a warning is issued
3953 // if @warn is %TRUE, and a
3954 // string representing the list of possible values is stored in
3955 // "none/start/middle/end". If failed and @possible_values is not %NULL,
3956 // returned string should be freed using g_free().
3957 // RETURNS: %TRUE if @str was successfully parsed.
3958 // <type>: enum type to parse, eg. %PANGO_TYPE_ELLIPSIZE_MODE.
3959 // <str>: string to parse. May be %NULL.
3960 // <value>: integer to store the result in, or %NULL.
3961 // <warn>: if %TRUE, issue a g_warning() on bad input.
3962 // <possible_values>: place to store list of possible values on failure, or %NULL.
3963 static int parse_enum()(Type type, char* str, int* value, int warn, char** possible_values) {
3964 return pango_parse_enum(type, str, value, warn, possible_values);
3968 // Parses marked-up text (see
3969 // <link linkend="PangoMarkupFormat">markup format</link>) to create
3970 // a plain-text string and an attribute list.
3971 // If @accel_marker is nonzero, the given character will mark the
3972 // character following it as an accelerator. For example, @accel_marker
3973 // might be an ampersand or underscore. All characters marked
3974 // as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
3975 // and the first character so marked will be returned in @accel_char.
3976 // Two @accel_marker characters following each other produce a single
3977 // literal @accel_marker character.
3978 // If any error happens, none of the output arguments are touched except
3979 // for @error.
3980 // RETURNS: %FALSE if @error is set, otherwise %TRUE
3981 // <markup_text>: markup to parse (see <link linkend="PangoMarkupFormat">markup format</link>)
3982 // <length>: length of @markup_text, or -1 if nul-terminated
3983 // <accel_marker>: character that precedes an accelerator, or 0 for none
3984 // <attr_list>: address of return location for a #PangoAttrList, or %NULL
3985 // <text>: address of return location for text with tags stripped, or %NULL
3986 // <accel_char>: address of return location for accelerator char, or %NULL
3987 static int parse_markup()(char* markup_text, int length, dchar accel_marker, /*out*/ AttrList** attr_list, /*out*/ char** text, /*out*/ dchar* accel_char, GLib2.Error** error=null) {
3988 return pango_parse_markup(markup_text, length, accel_marker, attr_list, text, accel_char, error);
3992 // Parses a font stretch. The allowed values are
3993 // "ultra_condensed", "extra_condensed", "condensed",
3994 // "semi_condensed", "normal", "semi_expanded", "expanded",
3995 // "extra_expanded" and "ultra_expanded". Case variations are
3996 // ignored and the '_' characters may be omitted.
3997 // RETURNS: %TRUE if @str was successfully parsed.
3998 // <str>: a string to parse.
3999 // <stretch>: a #PangoStretch to store the result in.
4000 // <warn>: if %TRUE, issue a g_warning() on bad input.
4001 static int parse_stretch()(char* str, Stretch* stretch, int warn) {
4002 return pango_parse_stretch(str, stretch, warn);
4006 // Parses a font style. The allowed values are "normal",
4007 // "italic" and "oblique", case variations being
4008 // ignored.
4009 // RETURNS: %TRUE if @str was successfully parsed.
4010 // <str>: a string to parse.
4011 // <style>: a #PangoStyle to store the result in.
4012 // <warn>: if %TRUE, issue a g_warning() on bad input.
4013 static int parse_style()(char* str, Style* style, int warn) {
4014 return pango_parse_style(str, style, warn);
4018 // Parses a font variant. The allowed values are "normal"
4019 // and "smallcaps" or "small_caps", case variations being
4020 // ignored.
4021 // RETURNS: %TRUE if @str was successfully parsed.
4022 // <str>: a string to parse.
4023 // <variant>: a #PangoVariant to store the result in.
4024 // <warn>: if %TRUE, issue a g_warning() on bad input.
4025 static int parse_variant()(char* str, Variant* variant, int warn) {
4026 return pango_parse_variant(str, variant, warn);
4030 // Parses a font weight. The allowed values are "heavy",
4031 // "ultrabold", "bold", "normal", "light", "ultraleight"
4032 // and integers. Case variations are ignored.
4033 // RETURNS: %TRUE if @str was successfully parsed.
4034 // <str>: a string to parse.
4035 // <weight>: a #PangoWeight to store the result in.
4036 // <warn>: if %TRUE, issue a g_warning() on bad input.
4037 static int parse_weight()(char* str, Weight* weight, int warn) {
4038 return pango_parse_weight(str, weight, warn);
4042 // VERSION: 1.12
4043 // Quantizes the thickness and position of a line, typically an
4044 // underline or strikethrough, to whole device pixels, that is integer
4045 // multiples of %PANGO_SCALE. The purpose of this function is to avoid
4046 // such lines looking blurry.
4047 // Care is taken to make sure @thickness is at least one pixel when this
4048 // function returns, but returned @position may become zero as a result
4049 // of rounding.
4050 // <thickness>: pointer to the thickness of a line, in Pango units
4051 // <position>: corresponding position
4052 static void quantize_line_geometry()(int* thickness, int* position) {
4053 pango_quantize_line_geometry(thickness, position);
4057 // Reads an entire line from a file into a buffer. Lines may
4058 // be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter
4059 // is not written into the buffer. Text after a '#' character is treated as
4060 // a comment and skipped. '\' can be used to escape a # character.
4061 // '\' proceeding a line delimiter combines adjacent lines. A '\' proceeding
4062 // any other character is ignored and written into the output buffer
4063 // unmodified.
4064 // the number of lines read (this is useful for maintaining
4065 // a line number counter which doesn't combine lines with '\')
4066 // RETURNS: 0 if the stream was already at an %EOF character, otherwise
4067 // <stream>: a stdio stream
4068 // <str>: #GString buffer into which to write the result
4069 static int read_line()(FILE* stream, GLib2.String* str) {
4070 return pango_read_line(stream, str);
4074 // Unintrospectable function: reorder_items() / pango_reorder_items()
4075 // From a list of items in logical order and the associated
4076 // directional levels, produce a list in visual order.
4077 // The original list is unmodified.
4078 // (Please open a bug if you use this function.
4079 // It is not a particularly convenient interface, and the code
4080 // is duplicated elsewhere in Pango for that reason.)
4081 // RETURNS: a #GList of #PangoItem structures in visual order.
4082 // <logical_items>: a #GList of #PangoItem in logical order.
4083 static GLib2.List* reorder_items()(GLib2.List* logical_items) {
4084 return pango_reorder_items(logical_items);
4088 // Scans an integer.
4089 // Leading white space is skipped.
4090 // RETURNS: %FALSE if a parse error occurred.
4091 // <pos>: in/out string position
4092 // <out>: an int into which to write the result
4093 static int scan_int()(char** pos, int* out_) {
4094 return pango_scan_int(pos, out_);
4098 // Scans a string into a #GString buffer. The string may either
4099 // be a sequence of non-white-space characters, or a quoted
4100 // string with '"'. Instead a quoted string, '\"' represents
4101 // a literal quote. Leading white space outside of quotes is skipped.
4102 // RETURNS: %FALSE if a parse error occurred.
4103 // <pos>: in/out string position
4104 // <out>: a #GString into which to write the result
4105 static int scan_string()(char** pos, GLib2.String* out_) {
4106 return pango_scan_string(pos, out_);
4110 // Scans a word into a #GString buffer. A word consists
4111 // of [A-Za-z_] followed by zero or more [A-Za-z_0-9]
4112 // Leading white space is skipped.
4113 // RETURNS: %FALSE if a parse error occurred.
4114 // <pos>: in/out string position
4115 // <out>: a #GString into which to write the result
4116 static int scan_word()(char** pos, GLib2.String* out_) {
4117 return pango_scan_word(pos, out_);
4121 // VERSION: 1.4
4122 // Looks up the #PangoScript for a particular character (as defined by
4123 // Unicode Standard Annex #24). No check is made for @ch being a
4124 // valid Unicode character; if you pass in invalid character, the
4125 // result is undefined.
4126 // As of Pango 1.18, this function simply returns the return value of
4127 // g_unichar_get_script().
4128 // RETURNS: the #PangoScript for the character.
4129 // <ch>: a Unicode character
4130 static Script script_for_unichar()(dchar ch) {
4131 return pango_script_for_unichar(ch);
4135 // VERSION: 1.4
4136 // Given a script, finds a language tag that is reasonably
4137 // representative of that script. This will usually be the
4138 // most widely spoken or used language written in that script:
4139 // for instance, the sample language for %PANGO_SCRIPT_CYRILLIC
4140 // is <literal>ru</literal> (Russian), the sample language
4141 // for %PANGO_SCRIPT_ARABIC is <literal>ar</literal>.
4142 // For some
4143 // scripts, no sample language will be returned because there
4144 // is no language that is sufficiently representative. The best
4145 // example of this is %PANGO_SCRIPT_HAN, where various different
4146 // variants of written Chinese, Japanese, and Korean all use
4147 // significantly different sets of Han characters and forms
4148 // of shared characters. No sample language can be provided
4149 // for many historical scripts as well.
4150 // As of 1.18, this function checks the environment variables
4151 // PANGO_LANGUAGE and LANGUAGE (checked in that order) first.
4152 // If one of them is set, it is parsed as a list of language tags
4153 // separated by colons or other separators. This function
4154 // will return the first language in the parsed list that Pango
4155 // believes may use @script for writing. This last predicate
4156 // is tested using pango_language_includes_script(). This can
4157 // be used to control Pango's font selection for non-primary
4158 // languages. For example, a PANGO_LANGUAGE enviroment variable
4159 // set to "en:fa" makes Pango choose fonts suitable for Persian (fa)
4160 // instead of Arabic (ar) when a segment of Arabic text is found
4161 // in an otherwise non-Arabic text. The same trick can be used to
4162 // choose a default language for %PANGO_SCRIPT_HAN when setting
4163 // context language is not feasible.
4164 // of the script, or %NULL if no such language exists.
4165 // RETURNS: a #PangoLanguage that is representative
4166 // <script>: a #PangoScript
4167 static Language* /*new*/ script_get_sample_language()(Script script) {
4168 return pango_script_get_sample_language(script);
4172 // Unintrospectable function: script_iter_new() / pango_script_iter_new()
4173 // VERSION: 1.4
4174 // Create a new #PangoScriptIter, used to break a string of
4175 // Unicode into runs by text. No copy is made of @text, so
4176 // the caller needs to make sure it remains valid until
4177 // the iterator is freed with pango_script_iter_free().
4178 // to point at the first range in the text, which should be
4179 // freed with pango_script_iter_free(). If the string is
4180 // empty, it will point at an empty range.
4181 // RETURNS: the new script iterator, initialized
4182 // <text>: a UTF-8 string
4183 // <length>: length of @text, or -1 if @text is nul-terminated.
4184 static ScriptIter* script_iter_new()(char* text, int length) {
4185 return pango_script_iter_new(text, length);
4189 // Given a segment of text and the corresponding
4190 // #PangoAnalysis structure returned from pango_itemize(),
4191 // convert the characters into glyphs. You may also pass
4192 // in only a substring of the item from pango_itemize().
4193 // <text>: the text to process
4194 // <length>: the length (in bytes) of @text
4195 // <analysis>: #PangoAnalysis structure from pango_itemize()
4196 // <glyphs>: glyph string in which to store results
4197 static void shape()(char* text, int length, Analysis* analysis, GlyphString* glyphs) {
4198 pango_shape(text, length, analysis, glyphs);
4202 // Skips 0 or more characters of white space.
4203 // the position at a '\0' character.
4204 // RETURNS: %FALSE if skipping the white space leaves
4205 // <pos>: in/out string position
4206 static int skip_space()(char** pos) {
4207 return pango_skip_space(pos);
4211 // Unintrospectable function: split_file_list() / pango_split_file_list()
4212 // Splits a %G_SEARCHPATH_SEPARATOR-separated list of files, stripping
4213 // white space and substituting ~/ with $HOME/.
4214 // RETURNS: a list of strings to be freed with g_strfreev()
4215 // <str>: a %G_SEARCHPATH_SEPARATOR separated list of filenames
4216 static char** split_file_list()(char* str) {
4217 return pango_split_file_list(str);
4221 // Trims leading and trailing whitespace from a string.
4222 // RETURNS: A newly-allocated string that must be freed with g_free()
4223 // <str>: a string
4224 static char* /*new*/ trim_string()(char* str) {
4225 return pango_trim_string(str);
4229 // Determines the inherent direction of a character; either
4230 // %PANGO_DIRECTION_LTR, %PANGO_DIRECTION_RTL, or
4231 // %PANGO_DIRECTION_NEUTRAL.
4232 // This function is useful to categorize characters into left-to-right
4233 // letters, right-to-left letters, and everything else. If full
4234 // Unicode bidirectional type of a character is needed,
4235 // pango_bidi_type_for_gunichar() can be used instead.
4236 // RETURNS: the direction of the character.
4237 // <ch>: a Unicode character
4238 static Direction unichar_direction()(dchar ch) {
4239 return pango_unichar_direction(ch);
4243 // VERSION: 1.16
4244 // it by %PANGO_SCALE and rounds to nearest integer.
4245 // RETURNS: the value in Pango units.
4246 // <d>: double floating-point value
4247 static int units_from_double()(double d) {
4248 return pango_units_from_double(d);
4252 // VERSION: 1.16
4253 // it by %PANGO_SCALE.
4254 // RETURNS: the double value.
4255 // <i>: value in Pango units
4256 static double units_to_double()(int i) {
4257 return pango_units_to_double(i);
4261 // VERSION: 1.16
4262 // This is similar to the macro %PANGO_VERSION except that
4263 // it returns the encoded version of Pango available at run-time,
4264 // as opposed to the version available at compile-time.
4265 // A version number can be encoded into an integer using
4266 // PANGO_VERSION_ENCODE().
4267 // available at run time.
4268 // RETURNS: The encoded version of Pango library
4269 static int version_()() {
4270 return pango_version();
4274 // VERSION: 1.16
4275 // Checks that the Pango library in use is compatible with the
4276 // given version. Generally you would pass in the constants
4277 // %PANGO_VERSION_MAJOR, %PANGO_VERSION_MINOR, %PANGO_VERSION_MICRO
4278 // as the three arguments to this function; that produces
4279 // a check that the library in use at run-time is compatible with
4280 // the version of Pango the application or module was compiled against.
4281 // of the running library is newer than the version
4282 // the running library must be binary compatible with the
4283 // version @required_major.required_minor.@required_micro
4284 // (same major version.)
4285 // For compile-time version checking use PANGO_VERSION_CHECK().
4286 // given version, or a string describing the version mismatch.
4287 // The returned string is owned by Pango and should not be modified
4288 // or freed.
4289 // RETURNS: %NULL if the Pango library is compatible with the
4290 // <required_major>: the required major version.
4291 // <required_minor>: the required minor version.
4292 // <required_micro>: the required major version.
4293 static char* version_check()(int required_major, int required_minor, int required_micro) {
4294 return pango_version_check(required_major, required_minor, required_micro);
4298 // VERSION: 1.16
4299 // This is similar to the macro %PANGO_VERSION_STRING except that
4300 // it returns the version of Pango available at run-time, as opposed to
4301 // the version available at compile-time.
4302 // available at run time.
4303 // The returned string is owned by Pango and should not be modified
4304 // or freed.
4305 // RETURNS: A string containing the version of Pango library
4306 static char* version_string()() {
4307 return pango_version_string();
4311 // C prototypes:
4313 extern (C) {
4314 AttrIterator* pango_attr_iterator_copy(AttrIterator* this_);
4315 void pango_attr_iterator_destroy(AttrIterator* this_);
4316 Attribute* pango_attr_iterator_get(AttrIterator* this_, AttrType type);
4317 GLib2.SList* /*new*/ pango_attr_iterator_get_attrs(AttrIterator* this_);
4318 void pango_attr_iterator_get_font(AttrIterator* this_, FontDescription* desc, Language** language, GLib2.SList** extra_attrs);
4319 int pango_attr_iterator_next(AttrIterator* this_);
4320 void pango_attr_iterator_range(AttrIterator* this_, int* start, int* end);
4321 AttrList* /*new*/ pango_attr_list_new();
4322 void pango_attr_list_change(AttrList* this_, Attribute* attr);
4323 AttrList* /*new*/ pango_attr_list_copy(AttrList* this_);
4324 AttrList* /*new*/ pango_attr_list_filter(AttrList* this_, AttrFilterFunc func, void* data);
4325 AttrIterator* pango_attr_list_get_iterator(AttrList* this_);
4326 void pango_attr_list_insert(AttrList* this_, Attribute* attr);
4327 void pango_attr_list_insert_before(AttrList* this_, Attribute* attr);
4328 AttrList* /*new*/ pango_attr_list_ref(AttrList* this_);
4329 void pango_attr_list_splice(AttrList* this_, AttrList* other, int pos, int len);
4330 void pango_attr_list_unref(AttrList* this_);
4331 Attribute* pango_attribute_copy(Attribute* this_);
4332 void pango_attribute_destroy(Attribute* this_);
4333 int pango_attribute_equal(Attribute* this_, Attribute* attr2);
4334 void pango_attribute_init(Attribute* this_, AttrClass* klass);
4335 Color* /*new*/ pango_color_copy(Color* this_);
4336 void pango_color_free(Color* this_);
4337 int pango_color_parse(Color* this_, char* spec);
4338 char* /*new*/ pango_color_to_string(Color* this_);
4339 Context* /*new*/ pango_context_new();
4340 Direction pango_context_get_base_dir(Context* this_);
4341 Gravity pango_context_get_base_gravity(Context* this_);
4342 FontDescription* /*new*/ pango_context_get_font_description(Context* this_);
4343 FontMap* pango_context_get_font_map(Context* this_);
4344 Gravity pango_context_get_gravity(Context* this_);
4345 GravityHint pango_context_get_gravity_hint(Context* this_);
4346 Language* /*new*/ pango_context_get_language(Context* this_);
4347 Matrix* pango_context_get_matrix(Context* this_);
4348 FontMetrics* /*new*/ pango_context_get_metrics(Context* this_, FontDescription* desc, Language* language);
4349 void pango_context_list_families(Context* this_, FontFamily*** families, int* n_families);
4350 Font* pango_context_load_font(Context* this_, FontDescription* desc);
4351 Fontset* pango_context_load_fontset(Context* this_, FontDescription* desc, Language* language);
4352 void pango_context_set_base_dir(Context* this_, Direction direction);
4353 void pango_context_set_base_gravity(Context* this_, Gravity gravity);
4354 void pango_context_set_font_description(Context* this_, FontDescription* desc);
4355 void pango_context_set_font_map(Context* this_, FontMap* font_map);
4356 void pango_context_set_gravity_hint(Context* this_, GravityHint hint);
4357 void pango_context_set_language(Context* this_, Language* language);
4358 void pango_context_set_matrix(Context* this_, Matrix* matrix);
4359 Coverage* pango_coverage_copy(Coverage* this_);
4360 CoverageLevel pango_coverage_get(Coverage* this_, int index_);
4361 void pango_coverage_max(Coverage* this_, Coverage* other);
4362 Coverage* pango_coverage_ref(Coverage* this_);
4363 void pango_coverage_set(Coverage* this_, int index_, CoverageLevel level);
4364 void pango_coverage_to_bytes(Coverage* this_, ubyte** bytes, int* n_bytes);
4365 void pango_coverage_unref(Coverage* this_);
4366 void pango_font_descriptions_free(FontDescription** descs, int n_descs);
4367 FontDescription* /*new*/ pango_font_describe(Font* this_);
4368 FontDescription* /*new*/ pango_font_describe_with_absolute_size(Font* this_);
4369 EngineShape* pango_font_find_shaper(Font* this_, Language* language, uint ch);
4370 Coverage* pango_font_get_coverage(Font* this_, Language* language);
4371 FontMap* pango_font_get_font_map(Font* this_);
4372 void pango_font_get_glyph_extents(Font* this_, Glyph glyph, Rectangle* ink_rect, Rectangle* logical_rect);
4373 FontMetrics* /*new*/ pango_font_get_metrics(Font* this_, Language* language);
4374 FontDescription* /*new*/ pango_font_description_new();
4375 int pango_font_description_better_match(FontDescription* this_, FontDescription* old_match, FontDescription* new_match);
4376 FontDescription* /*new*/ pango_font_description_copy(FontDescription* this_);
4377 FontDescription* /*new*/ pango_font_description_copy_static(FontDescription* this_);
4378 int pango_font_description_equal(FontDescription* this_, FontDescription* desc2);
4379 void pango_font_description_free(FontDescription* this_);
4380 char* pango_font_description_get_family(FontDescription* this_);
4381 Gravity pango_font_description_get_gravity(FontDescription* this_);
4382 FontMask pango_font_description_get_set_fields(FontDescription* this_);
4383 int pango_font_description_get_size(FontDescription* this_);
4384 int pango_font_description_get_size_is_absolute(FontDescription* this_);
4385 Stretch pango_font_description_get_stretch(FontDescription* this_);
4386 Style pango_font_description_get_style(FontDescription* this_);
4387 Variant pango_font_description_get_variant(FontDescription* this_);
4388 Weight pango_font_description_get_weight(FontDescription* this_);
4389 uint pango_font_description_hash(FontDescription* this_);
4390 void pango_font_description_merge(FontDescription* this_, FontDescription* desc_to_merge, int replace_existing);
4391 void pango_font_description_merge_static(FontDescription* this_, FontDescription* desc_to_merge, int replace_existing);
4392 void pango_font_description_set_absolute_size(FontDescription* this_, double size);
4393 void pango_font_description_set_family(FontDescription* this_, char* family);
4394 void pango_font_description_set_family_static(FontDescription* this_, char* family);
4395 void pango_font_description_set_gravity(FontDescription* this_, Gravity gravity);
4396 void pango_font_description_set_size(FontDescription* this_, int size);
4397 void pango_font_description_set_stretch(FontDescription* this_, Stretch stretch);
4398 void pango_font_description_set_style(FontDescription* this_, Style style);
4399 void pango_font_description_set_variant(FontDescription* this_, Variant variant);
4400 void pango_font_description_set_weight(FontDescription* this_, Weight weight);
4401 char* /*new*/ pango_font_description_to_filename(FontDescription* this_);
4402 char* /*new*/ pango_font_description_to_string(FontDescription* this_);
4403 void pango_font_description_unset_fields(FontDescription* this_, FontMask to_unset);
4404 FontDescription* /*new*/ pango_font_face_describe(FontFace* this_);
4405 char* pango_font_face_get_face_name(FontFace* this_);
4406 int pango_font_face_is_synthesized(FontFace* this_);
4407 void pango_font_face_list_sizes(FontFace* this_, int** sizes, int* n_sizes);
4408 char* pango_font_family_get_name(FontFamily* this_);
4409 int pango_font_family_is_monospace(FontFamily* this_);
4410 void pango_font_family_list_faces(FontFamily* this_, FontFace*** faces, int* n_faces);
4411 Context* pango_font_map_create_context(FontMap* this_);
4412 void pango_font_map_list_families(FontMap* this_, FontFamily*** families, int* n_families);
4413 Font* pango_font_map_load_font(FontMap* this_, Context* context, FontDescription* desc);
4414 Fontset* pango_font_map_load_fontset(FontMap* this_, Context* context, FontDescription* desc, Language* language);
4415 int pango_font_metrics_get_approximate_char_width(FontMetrics* this_);
4416 int pango_font_metrics_get_approximate_digit_width(FontMetrics* this_);
4417 int pango_font_metrics_get_ascent(FontMetrics* this_);
4418 int pango_font_metrics_get_descent(FontMetrics* this_);
4419 int pango_font_metrics_get_strikethrough_position(FontMetrics* this_);
4420 int pango_font_metrics_get_strikethrough_thickness(FontMetrics* this_);
4421 int pango_font_metrics_get_underline_position(FontMetrics* this_);
4422 int pango_font_metrics_get_underline_thickness(FontMetrics* this_);
4423 FontMetrics* /*new*/ pango_font_metrics_ref(FontMetrics* this_);
4424 void pango_font_metrics_unref(FontMetrics* this_);
4425 void pango_fontset_foreach(Fontset* this_, FontsetForeachFunc func, void* data);
4426 Font* pango_fontset_get_font(Fontset* this_, uint wc);
4427 FontMetrics* /*new*/ pango_fontset_get_metrics(Fontset* this_);
4428 GLib2.SList* pango_glyph_item_apply_attrs(GlyphItem* this_, char* text, AttrList* list);
4429 GlyphItem* /*new*/ pango_glyph_item_copy(GlyphItem* this_);
4430 void pango_glyph_item_free(GlyphItem* this_);
4431 void pango_glyph_item_get_logical_widths(GlyphItem* this_, char* text, int* logical_widths);
4432 void pango_glyph_item_letter_space(GlyphItem* this_, char* text, LogAttr* log_attrs, int letter_spacing);
4433 GlyphItem* /*new*/ pango_glyph_item_split(GlyphItem* this_, char* text, int split_index);
4434 GlyphItemIter* /*new*/ pango_glyph_item_iter_copy(GlyphItemIter* this_);
4435 void pango_glyph_item_iter_free(GlyphItemIter* this_);
4436 int pango_glyph_item_iter_init_end(GlyphItemIter* this_, GlyphItem* glyph_item, char* text);
4437 int pango_glyph_item_iter_init_start(GlyphItemIter* this_, GlyphItem* glyph_item, char* text);
4438 int pango_glyph_item_iter_next_cluster(GlyphItemIter* this_);
4439 int pango_glyph_item_iter_prev_cluster(GlyphItemIter* this_);
4440 GlyphString* /*new*/ pango_glyph_string_new();
4441 GlyphString* /*new*/ pango_glyph_string_copy(GlyphString* this_);
4442 void pango_glyph_string_extents(GlyphString* this_, Font* font, Rectangle* ink_rect, Rectangle* logical_rect);
4443 void pango_glyph_string_extents_range(GlyphString* this_, int start, int end, Font* font, Rectangle* ink_rect, Rectangle* logical_rect);
4444 void pango_glyph_string_free(GlyphString* this_);
4445 void pango_glyph_string_get_logical_widths(GlyphString* this_, char* text, int length, int embedding_level, int* logical_widths);
4446 int pango_glyph_string_get_width(GlyphString* this_);
4447 void pango_glyph_string_index_to_x(GlyphString* this_, char* text, int length, Analysis* analysis, int index_, int trailing, int* x_pos);
4448 void pango_glyph_string_set_size(GlyphString* this_, int new_len);
4449 void pango_glyph_string_x_to_index(GlyphString* this_, char* text, int length, Analysis* analysis, int x_pos, int* index_, int* trailing);
4450 Item* /*new*/ pango_item_new();
4451 Item* /*new*/ pango_item_copy(Item* this_);
4452 void pango_item_free(Item* this_);
4453 Item* /*new*/ pango_item_split(Item* this_, int split_index, int split_offset);
4454 char* pango_language_get_sample_string(Language* this_);
4455 Script* pango_language_get_scripts(Language* this_, int* num_scripts);
4456 int pango_language_includes_script(Language* this_, Script script);
4457 int pango_language_matches(Language* this_, char* range_list);
4458 char* pango_language_to_string(Language* this_);
4459 Layout* /*new*/ pango_layout_new(Context* context);
4460 void pango_layout_context_changed(Layout* this_);
4461 Layout* pango_layout_copy(Layout* this_);
4462 Alignment pango_layout_get_alignment(Layout* this_);
4463 AttrList* /*new*/ pango_layout_get_attributes(Layout* this_);
4464 int pango_layout_get_auto_dir(Layout* this_);
4465 int pango_layout_get_baseline(Layout* this_);
4466 Context* pango_layout_get_context(Layout* this_);
4467 void pango_layout_get_cursor_pos(Layout* this_, int index_, /*out*/ Rectangle* strong_pos, /*out*/ Rectangle* weak_pos);
4468 EllipsizeMode pango_layout_get_ellipsize(Layout* this_);
4469 void pango_layout_get_extents(Layout* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4470 FontDescription* pango_layout_get_font_description(Layout* this_);
4471 int pango_layout_get_height(Layout* this_);
4472 int pango_layout_get_indent(Layout* this_);
4473 LayoutIter* /*new*/ pango_layout_get_iter(Layout* this_);
4474 int pango_layout_get_justify(Layout* this_);
4475 LayoutLine* /*new*/ pango_layout_get_line(Layout* this_, int line);
4476 int pango_layout_get_line_count(Layout* this_);
4477 LayoutLine* /*new*/ pango_layout_get_line_readonly(Layout* this_, int line);
4478 GLib2.SList* pango_layout_get_lines(Layout* this_);
4479 GLib2.SList* pango_layout_get_lines_readonly(Layout* this_);
4480 void pango_layout_get_log_attrs(Layout* this_, /*out*/ LogAttr** attrs, /*out*/ int* n_attrs);
4481 void pango_layout_get_pixel_extents(Layout* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4482 void pango_layout_get_pixel_size(Layout* this_, /*out*/ int* width, /*out*/ int* height);
4483 int pango_layout_get_single_paragraph_mode(Layout* this_);
4484 void pango_layout_get_size(Layout* this_, /*out*/ int* width, /*out*/ int* height);
4485 int pango_layout_get_spacing(Layout* this_);
4486 TabArray* /*new*/ pango_layout_get_tabs(Layout* this_);
4487 char* pango_layout_get_text(Layout* this_);
4488 int pango_layout_get_unknown_glyphs_count(Layout* this_);
4489 int pango_layout_get_width(Layout* this_);
4490 WrapMode pango_layout_get_wrap(Layout* this_);
4491 void pango_layout_index_to_line_x(Layout* this_, int index_, int trailing, /*out*/ int* line, int* x_pos);
4492 void pango_layout_index_to_pos(Layout* this_, int index_, /*out*/ Rectangle* pos);
4493 int pango_layout_is_ellipsized(Layout* this_);
4494 int pango_layout_is_wrapped(Layout* this_);
4495 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);
4496 void pango_layout_set_alignment(Layout* this_, Alignment alignment);
4497 void pango_layout_set_attributes(Layout* this_, AttrList* attrs);
4498 void pango_layout_set_auto_dir(Layout* this_, int auto_dir);
4499 void pango_layout_set_ellipsize(Layout* this_, EllipsizeMode ellipsize);
4500 void pango_layout_set_font_description(Layout* this_, FontDescription* desc);
4501 void pango_layout_set_height(Layout* this_, int height);
4502 void pango_layout_set_indent(Layout* this_, int indent);
4503 void pango_layout_set_justify(Layout* this_, int justify);
4504 void pango_layout_set_markup(Layout* this_, char* markup, int length);
4505 void pango_layout_set_markup_with_accel(Layout* this_, char* markup, int length, dchar accel_marker, dchar* accel_char);
4506 void pango_layout_set_single_paragraph_mode(Layout* this_, int setting);
4507 void pango_layout_set_spacing(Layout* this_, int spacing);
4508 void pango_layout_set_tabs(Layout* this_, TabArray* tabs);
4509 void pango_layout_set_text(Layout* this_, char* text, int length);
4510 void pango_layout_set_width(Layout* this_, int width);
4511 void pango_layout_set_wrap(Layout* this_, WrapMode wrap);
4512 int pango_layout_xy_to_index(Layout* this_, int x, int y, /*out*/ int* index_, /*out*/ int* trailing);
4513 int pango_layout_iter_at_last_line(LayoutIter* this_);
4514 LayoutIter* /*new*/ pango_layout_iter_copy(LayoutIter* this_);
4515 void pango_layout_iter_free(LayoutIter* this_);
4516 int pango_layout_iter_get_baseline(LayoutIter* this_);
4517 void pango_layout_iter_get_char_extents(LayoutIter* this_, Rectangle* logical_rect);
4518 void pango_layout_iter_get_cluster_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4519 int pango_layout_iter_get_index(LayoutIter* this_);
4520 Layout* pango_layout_iter_get_layout(LayoutIter* this_);
4521 void pango_layout_iter_get_layout_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4522 LayoutLine* /*new*/ pango_layout_iter_get_line(LayoutIter* this_);
4523 void pango_layout_iter_get_line_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4524 LayoutLine* /*new*/ pango_layout_iter_get_line_readonly(LayoutIter* this_);
4525 void pango_layout_iter_get_line_yrange(LayoutIter* this_, int* y0_, int* y1_);
4526 LayoutRun* pango_layout_iter_get_run(LayoutIter* this_);
4527 void pango_layout_iter_get_run_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4528 LayoutRun* pango_layout_iter_get_run_readonly(LayoutIter* this_);
4529 int pango_layout_iter_next_char(LayoutIter* this_);
4530 int pango_layout_iter_next_cluster(LayoutIter* this_);
4531 int pango_layout_iter_next_line(LayoutIter* this_);
4532 int pango_layout_iter_next_run(LayoutIter* this_);
4533 void pango_layout_line_get_extents(LayoutLine* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4534 void pango_layout_line_get_pixel_extents(LayoutLine* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4535 void pango_layout_line_get_x_ranges(LayoutLine* this_, int start_index, int end_index, /*out*/ int** ranges, /*out*/ int* n_ranges);
4536 void pango_layout_line_index_to_x(LayoutLine* this_, int index_, int trailing, /*out*/ int* x_pos);
4537 LayoutLine* /*new*/ pango_layout_line_ref(LayoutLine* this_);
4538 void pango_layout_line_unref(LayoutLine* this_);
4539 int pango_layout_line_x_to_index(LayoutLine* this_, int x_pos, /*out*/ int* index_, /*out*/ int* trailing);
4540 void pango_matrix_concat(Matrix* this_, Matrix* new_matrix);
4541 Matrix* /*new*/ pango_matrix_copy(Matrix* this_);
4542 void pango_matrix_free(Matrix* this_);
4543 double pango_matrix_get_font_scale_factor(Matrix* this_);
4544 void pango_matrix_rotate(Matrix* this_, double degrees);
4545 void pango_matrix_scale(Matrix* this_, double scale_x, double scale_y);
4546 void pango_matrix_transform_distance(Matrix* this_, double* dx, double* dy);
4547 void pango_matrix_transform_pixel_rectangle(Matrix* this_, Rectangle* rect);
4548 void pango_matrix_transform_point(Matrix* this_, double* x, double* y);
4549 void pango_matrix_transform_rectangle(Matrix* this_, Rectangle* rect);
4550 void pango_matrix_translate(Matrix* this_, double tx, double ty);
4551 void pango_renderer_activate(Renderer* this_);
4552 void pango_renderer_deactivate(Renderer* this_);
4553 void pango_renderer_draw_error_underline(Renderer* this_, int x, int y, int width, int height);
4554 void pango_renderer_draw_glyph(Renderer* this_, Font* font, Glyph glyph, double x, double y);
4555 void pango_renderer_draw_glyph_item(Renderer* this_, char* text, GlyphItem* glyph_item, int x, int y);
4556 void pango_renderer_draw_glyphs(Renderer* this_, Font* font, GlyphString* glyphs, int x, int y);
4557 void pango_renderer_draw_layout(Renderer* this_, Layout* layout, int x, int y);
4558 void pango_renderer_draw_layout_line(Renderer* this_, LayoutLine* line, int x, int y);
4559 void pango_renderer_draw_rectangle(Renderer* this_, RenderPart part, int x, int y, int width, int height);
4560 void pango_renderer_draw_trapezoid(Renderer* this_, RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22);
4561 Color* /*new*/ pango_renderer_get_color(Renderer* this_, RenderPart part);
4562 Layout* pango_renderer_get_layout(Renderer* this_);
4563 LayoutLine* /*new*/ pango_renderer_get_layout_line(Renderer* this_);
4564 Matrix* pango_renderer_get_matrix(Renderer* this_);
4565 void pango_renderer_part_changed(Renderer* this_, RenderPart part);
4566 void pango_renderer_set_color(Renderer* this_, RenderPart part, Color* color);
4567 void pango_renderer_set_matrix(Renderer* this_, Matrix* matrix);
4568 void pango_script_iter_free(ScriptIter* this_);
4569 void pango_script_iter_get_range(ScriptIter* this_, char** start, char** end, Script* script);
4570 int pango_script_iter_next(ScriptIter* this_);
4571 TabArray* /*new*/ pango_tab_array_new(int initial_size, int positions_in_pixels);
4572 TabArray* /*new*/ pango_tab_array_new_with_positions(int size, int positions_in_pixels, TabAlign first_alignment, int first_position, ...);
4573 TabArray* /*new*/ pango_tab_array_copy(TabArray* this_);
4574 void pango_tab_array_free(TabArray* this_);
4575 int pango_tab_array_get_positions_in_pixels(TabArray* this_);
4576 int pango_tab_array_get_size(TabArray* this_);
4577 void pango_tab_array_get_tab(TabArray* this_, int tab_index, TabAlign* alignment, int* location);
4578 void pango_tab_array_get_tabs(TabArray* this_, TabAlign** alignments, int** locations);
4579 void pango_tab_array_resize(TabArray* this_, int new_size);
4580 void pango_tab_array_set_tab(TabArray* this_, int tab_index, TabAlign alignment, int location);
4581 Attribute* pango_attr_background_new(ushort red, ushort green, ushort blue);
4582 Attribute* pango_attr_fallback_new(int enable_fallback);
4583 Attribute* pango_attr_family_new(char* family);
4584 Attribute* pango_attr_font_desc_new(FontDescription* desc);
4585 Attribute* pango_attr_foreground_new(ushort red, ushort green, ushort blue);
4586 Attribute* pango_attr_gravity_hint_new(GravityHint hint);
4587 Attribute* pango_attr_gravity_new(Gravity gravity);
4588 Attribute* pango_attr_language_new(Language* language);
4589 Attribute* pango_attr_letter_spacing_new(int letter_spacing);
4590 Attribute* pango_attr_rise_new(int rise);
4591 Attribute* pango_attr_scale_new(double scale_factor);
4592 Attribute* pango_attr_shape_new(Rectangle* ink_rect, Rectangle* logical_rect);
4593 Attribute* pango_attr_shape_new_with_data(Rectangle* ink_rect, Rectangle* logical_rect, void* data, AttrDataCopyFunc copy_func, GLib2.DestroyNotify destroy_func);
4594 Attribute* pango_attr_size_new(int size);
4595 Attribute* pango_attr_size_new_absolute(int size);
4596 Attribute* pango_attr_stretch_new(Stretch stretch);
4597 Attribute* pango_attr_strikethrough_color_new(ushort red, ushort green, ushort blue);
4598 Attribute* pango_attr_strikethrough_new(int strikethrough);
4599 Attribute* pango_attr_style_new(Style style);
4600 char* pango_attr_type_get_name(AttrType type);
4601 AttrType pango_attr_type_register(char* name);
4602 Attribute* pango_attr_underline_color_new(ushort red, ushort green, ushort blue);
4603 Attribute* pango_attr_underline_new(Underline underline);
4604 Attribute* pango_attr_variant_new(Variant variant);
4605 Attribute* pango_attr_weight_new(Weight weight);
4606 BidiType pango_bidi_type_for_unichar(dchar ch);
4607 void pango_break(char* text, int length, Analysis* analysis, LogAttr* attrs, int attrs_len);
4608 Coverage* pango_coverage_from_bytes(ubyte* bytes, int n_bytes);
4609 Coverage* pango_coverage_new();
4610 void pango_extents_to_pixels(Rectangle* inclusive, Rectangle* nearest);
4611 Direction pango_find_base_dir(char* text, int length);
4612 void pango_find_paragraph_boundary(char* text, int length, int* paragraph_delimiter_index, int* next_paragraph_start);
4613 FontDescription* /*new*/ pango_font_description_from_string(char* str);
4614 void pango_get_log_attrs(char* text, int length, int level, Language* language, LogAttr* log_attrs, int attrs_len);
4615 int pango_get_mirror_char(dchar ch, dchar* mirrored_ch);
4616 Gravity pango_gravity_get_for_matrix(Matrix* matrix);
4617 Gravity pango_gravity_get_for_script(Script script, Gravity base_gravity, GravityHint hint);
4618 Gravity pango_gravity_get_for_script_and_width(Script script, int wide, Gravity base_gravity, GravityHint hint);
4619 double pango_gravity_to_rotation(Gravity gravity);
4620 int pango_is_zero_width(dchar ch);
4621 GLib2.List* pango_itemize(Context* context, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter);
4622 GLib2.List* pango_itemize_with_base_dir(Context* context, Direction base_dir, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter);
4623 Language* /*new*/ pango_language_from_string(char* language);
4624 Language* /*new*/ pango_language_get_default();
4625 ubyte* pango_log2vis_get_embedding_levels(char* text, int length, Direction* pbase_dir);
4626 int pango_parse_enum(Type type, char* str, int* value, int warn, char** possible_values);
4627 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);
4628 int pango_parse_stretch(char* str, Stretch* stretch, int warn);
4629 int pango_parse_style(char* str, Style* style, int warn);
4630 int pango_parse_variant(char* str, Variant* variant, int warn);
4631 int pango_parse_weight(char* str, Weight* weight, int warn);
4632 void pango_quantize_line_geometry(int* thickness, int* position);
4633 int pango_read_line(FILE* stream, GLib2.String* str);
4634 GLib2.List* pango_reorder_items(GLib2.List* logical_items);
4635 int pango_scan_int(char** pos, int* out_);
4636 int pango_scan_string(char** pos, GLib2.String* out_);
4637 int pango_scan_word(char** pos, GLib2.String* out_);
4638 Script pango_script_for_unichar(dchar ch);
4639 Language* /*new*/ pango_script_get_sample_language(Script script);
4640 ScriptIter* pango_script_iter_new(char* text, int length);
4641 void pango_shape(char* text, int length, Analysis* analysis, GlyphString* glyphs);
4642 int pango_skip_space(char** pos);
4643 char** pango_split_file_list(char* str);
4644 char* /*new*/ pango_trim_string(char* str);
4645 Direction pango_unichar_direction(dchar ch);
4646 int pango_units_from_double(double d);
4647 double pango_units_to_double(int i);
4648 int pango_version();
4649 char* pango_version_check(int required_major, int required_minor, int required_micro);
4650 char* pango_version_string();