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