Support for PangoFT2, PangoCairo, fontconfig2, freetype22, GL, Clutter, ClutterX11...
[girtod.git] / gtk2 / pango.d
blob0b34739ffa2ab1032a767f0d7673ebdf0955ae01
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 alias uint Glyph;
24 alias int GlyphUnit;
25 alias GlyphItem LayoutRun;
26 enum int ANALYSIS_FLAG_CENTERED_BASELINE = 1;
27 enum int ATTR_INDEX_FROM_TEXT_BEGINNING = 0;
28 enum Alignment {
29 LEFT = 0,
30 CENTER = 1,
31 RIGHT = 2
33 struct Analysis {
34 EngineShape* shape_engine;
35 EngineLang* lang_engine;
36 Font* font;
37 ubyte level, gravity, flags, script;
38 Language* language;
39 GLib2.SList* extra_attrs;
42 struct AttrClass {
43 AttrType type;
44 // Unintrospectable functionp: copy() / ()
45 extern (C) Attribute* function (Attribute* attr) copy;
46 extern (C) void function (Attribute* attr) destroy;
47 extern (C) int function (Attribute* attr1, Attribute* attr2) equal;
50 struct AttrColor {
51 Attribute attr;
52 Color color;
55 // Unintrospectable callback: AttrDataCopyFunc() / ()
56 extern (C) alias void* function (const(void)* data) AttrDataCopyFunc;
58 extern (C) alias int function (Attribute* attribute, void* data) AttrFilterFunc;
60 struct AttrFloat {
61 Attribute attr;
62 double value;
65 struct AttrFontDesc {
66 Attribute attr;
67 FontDescription* desc;
70 struct AttrInt {
71 Attribute attr;
72 int value;
75 struct AttrIterator {
77 // Unintrospectable method: copy() / pango_attr_iterator_copy()
78 // Copy a #PangoAttrIterator
79 // be freed with pango_attr_iterator_destroy().
80 // RETURNS: the newly allocated #PangoAttrIterator, which should
81 AttrIterator* copy() {
82 return pango_attr_iterator_copy(&this);
84 // Destroy a #PangoAttrIterator and free all associated memory.
85 void destroy() {
86 pango_attr_iterator_destroy(&this);
89 // Unintrospectable method: get() / pango_attr_iterator_get()
90 // Find the current attribute of a particular type at the iterator
91 // location. When multiple attributes of the same type overlap,
92 // the attribute whose range starts closest to the current location
93 // is used.
94 // if no attribute of that type applies to the current
95 // location.
96 // RETURNS: the current attribute of the given type, or %NULL
97 // <type>: the type of attribute to find.
98 Attribute* get(AttrType type) {
99 return pango_attr_iterator_get(&this, type);
102 // Gets a list of all attributes at the current position of the
103 // iterator.
104 // all attributes for the current range.
105 // To free this value, call pango_attribute_destroy() on
106 // each value and g_slist_free() on the list.
107 // RETURNS: a list of
108 GLib2.SList* /*new*/ get_attrs() {
109 return pango_attr_iterator_get_attrs(&this);
112 // Get the font and other attributes at the current iterator position.
113 // <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>.
114 // <language>: if non-%NULL, location to store language tag for item, or %NULL if none is found.
115 // <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.
116 void get_font(FontDescription* desc, Language** language, GLib2.SList** extra_attrs) {
117 pango_attr_iterator_get_font(&this, desc, language, extra_attrs);
120 // Advance the iterator until the next change of style.
121 // RETURNS: %FALSE if the iterator is at the end of the list, otherwise %TRUE
122 int next() {
123 return pango_attr_iterator_next(&this);
126 // Get the range of the current segment. Note that the
127 // stored return values are signed, not unsigned like
128 // the values in #PangoAttribute. To deal with this API
129 // oversight, stored return values that wouldn't fit into
130 // a signed integer are clamped to %G_MAXINT.
131 // <start>: location to store the start of the range
132 // <end>: location to store the end of the range
133 void range(int* start, int* end) {
134 pango_attr_iterator_range(&this, start, end);
138 struct AttrLanguage {
139 Attribute attr;
140 Language* value;
143 struct AttrList {
145 // Create a new empty attribute list with a reference count of one.
146 // be freed with pango_attr_list_unref().
147 // RETURNS: the newly allocated #PangoAttrList, which should
148 static AttrList* /*new*/ new_() {
149 return pango_attr_list_new();
152 // Insert the given attribute into the #PangoAttrList. It will
153 // replace any attributes of the same type on that segment
154 // and be merged with any adjoining attributes that are identical.
155 // This function is slower than pango_attr_list_insert() for
156 // creating a attribute list in order (potentially much slower
157 // for large lists). However, pango_attr_list_insert() is not
158 // suitable for continually changing a set of attributes
159 // since it never removes or combines existing attributes.
160 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
161 void change(Attribute* attr) {
162 pango_attr_list_change(&this, attr);
165 // Copy @list and return an identical new list.
166 // reference count of one, which should
167 // be freed with pango_attr_list_unref().
168 // Returns %NULL if @list was %NULL.
169 // RETURNS: the newly allocated #PangoAttrList, with a
170 AttrList* /*new*/ copy() {
171 return pango_attr_list_copy(&this);
174 // Unintrospectable method: filter() / pango_attr_list_filter()
175 // Given a #PangoAttrList and callback function, removes any elements
176 // of @list for which @func returns %TRUE and inserts them into
177 // a new list.
178 // no attributes of the given types were found.
179 // RETURNS: the new #PangoAttrList or %NULL if
180 // <func>: callback function; returns %TRUE if an attribute should be filtered out.
181 // <data>: Data to be passed to @func
182 AttrList* /*new*/ filter(AttrFilterFunc func, void* data) {
183 return pango_attr_list_filter(&this, func, data);
186 // Unintrospectable method: get_iterator() / pango_attr_list_get_iterator()
187 // Create a iterator initialized to the beginning of the list.
188 // be freed with pango_attr_iterator_destroy().
189 // RETURNS: the newly allocated #PangoAttrIterator, which should
190 AttrIterator* get_iterator() {
191 return pango_attr_list_get_iterator(&this);
194 // Insert the given attribute into the #PangoAttrList. It will
195 // be inserted after all other attributes with a matching
196 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
197 void insert(Attribute* attr) {
198 pango_attr_list_insert(&this, attr);
201 // Insert the given attribute into the #PangoAttrList. It will
202 // be inserted before all other attributes with a matching
203 // <attr>: the attribute to insert. Ownership of this value is assumed by the list.
204 void insert_before(Attribute* attr) {
205 pango_attr_list_insert_before(&this, attr);
208 // Increase the reference count of the given attribute list by one.
209 // RETURNS: The attribute list passed in
210 AttrList* /*new*/ ref_() {
211 return pango_attr_list_ref(&this);
214 // This function opens up a hole in @list, fills it in with attributes from
215 // the left, and then merges @other on top of the hole.
216 // This operation is equivalent to stretching every attribute
217 // that applies at position @pos in @list by an amount @len,
218 // and then calling pango_attr_list_change() with a copy
219 // of each attribute in @other in sequence (offset in position by @pos).
220 // This operation proves useful for, for instance, inserting
221 // a pre-edit string in the middle of an edit buffer.
222 // <other>: another #PangoAttrList
223 // <pos>: the position in @list at which to insert @other
224 // <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)
225 void splice(AttrList* other, int pos, int len) {
226 pango_attr_list_splice(&this, other, pos, len);
229 // Decrease the reference count of the given attribute list by one.
230 // If the result is zero, free the attribute list and the attributes
231 // it contains.
232 void unref() {
233 pango_attr_list_unref(&this);
237 struct AttrShape {
238 Attribute attr;
239 Rectangle ink_rect, logical_rect;
240 void* data;
241 AttrDataCopyFunc copy_func;
242 GLib2.DestroyNotify destroy_func;
245 struct AttrSize {
246 Attribute attr;
247 int size;
248 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
249 uint, "absolute", 1,
250 uint, "__dummy32A", 31));
253 struct AttrString {
254 Attribute attr;
255 char* value;
258 enum AttrType {
259 INVALID = 0,
260 LANGUAGE = 1,
261 FAMILY = 2,
262 STYLE = 3,
263 WEIGHT = 4,
264 VARIANT = 5,
265 STRETCH = 6,
266 SIZE = 7,
267 FONT_DESC = 8,
268 FOREGROUND = 9,
269 BACKGROUND = 10,
270 UNDERLINE = 11,
271 STRIKETHROUGH = 12,
272 RISE = 13,
273 SHAPE = 14,
274 SCALE = 15,
275 FALLBACK = 16,
276 LETTER_SPACING = 17,
277 UNDERLINE_COLOR = 18,
278 STRIKETHROUGH_COLOR = 19,
279 ABSOLUTE_SIZE = 20,
280 GRAVITY = 21,
281 GRAVITY_HINT = 22
283 struct Attribute {
284 AttrClass* klass;
285 uint start_index, end_index;
288 // Unintrospectable method: copy() / pango_attribute_copy()
289 // Make a copy of an attribute.
290 // freed with pango_attribute_destroy().
291 // RETURNS: the newly allocated #PangoAttribute, which should be
292 Attribute* copy() {
293 return pango_attribute_copy(&this);
295 // Destroy a #PangoAttribute and free all associated memory.
296 void destroy() {
297 pango_attribute_destroy(&this);
300 // Compare two attributes for equality. This compares only the
301 // actual value of the two attributes and not the ranges that the
302 // attributes apply to.
303 // RETURNS: %TRUE if the two attributes have the same value.
304 // <attr2>: another #PangoAttribute
305 int equal(Attribute* attr2) {
306 return pango_attribute_equal(&this, attr2);
309 // Initializes @attr's klass to @klass,
310 // it's start_index to %PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING
311 // and end_index to %PANGO_ATTR_INDEX_TO_TEXT_END
312 // such that the attribute applies
313 // to the entire text by default.
314 // <klass>: a #PangoAttributeClass
315 void init(AttrClass* klass) {
316 pango_attribute_init(&this, klass);
321 // The #PangoBidiType type represents the bidirectional character
322 // type of a Unicode character as specified by the
323 // <ulink url="http://www.unicode.org/reports/tr9/">Unicode bidirectional algorithm</ulink>.
324 enum BidiType /* Version 1.22 */ {
325 L = 0,
326 LRE = 1,
327 LRO = 2,
328 R = 3,
329 AL = 4,
330 RLE = 5,
331 RLO = 6,
332 PDF = 7,
333 EN = 8,
334 ES = 9,
335 ET = 10,
336 AN = 11,
337 CS = 12,
338 NSM = 13,
339 BN = 14,
340 B = 15,
341 S = 16,
342 WS = 17,
343 ON = 18
345 struct Color {
346 ushort red, green, blue;
349 // Creates a copy of @src, which should be freed with
350 // pango_color_free(). Primarily used by language bindings,
351 // not that useful otherwise (since colors can just be copied
352 // by assignment in C).
353 // be freed with pango_color_free(), or %NULL
354 // if @src was %NULL.
355 // RETURNS: the newly allocated #PangoColor, which should
356 Color* /*new*/ copy() {
357 return pango_color_copy(&this);
359 // Frees a color allocated by pango_color_copy().
360 void free() {
361 pango_color_free(&this);
364 // Fill in the fields of a color from a string specification. The
365 // string can either one of a large set of standard names. (Taken
366 // from the X11 <filename>rgb.txt</filename> file), or it can be a hex value in the
367 // form '&num;rgb' '&num;rrggbb' '&num;rrrgggbbb' or '&num;rrrrggggbbbb' where
368 // 'r', 'g' and 'b' are hex digits of the red, green, and blue
369 // components of the color, respectively. (White in the four
370 // forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and '&num;ffffffffffff')
371 // otherwise false.
372 // RETURNS: %TRUE if parsing of the specifier succeeded,
373 // <spec>: a string specifying the new color
374 int parse(char* spec) {
375 return pango_color_parse(&this, spec);
378 // Returns a textual specification of @color in the hexadecimal form
379 // <literal>&num;rrrrggggbbbb</literal>, where <literal>r</literal>,
380 // <literal>g</literal> and <literal>b</literal> are hex digits representing
381 // the red, green, and blue components respectively.
382 // RETURNS: a newly-allocated text string that must be freed with g_free().
383 char* /*new*/ to_string() {
384 return pango_color_to_string(&this);
388 struct Context /* : GObject.Object */ {
389 alias method_parent this;
390 alias method_parent super_;
391 alias method_parent object;
392 GObject2.Object method_parent;
395 // Creates a new #PangoContext initialized to default values.
396 // This function is not particularly useful as it should always
397 // be followed by a pango_context_set_font_map() call, and the
398 // function pango_font_map_create_context() does these two steps
399 // together and hence users are recommended to use that.
400 // If you are using Pango as part of a higher-level system,
401 // that system may have it's own way of create a #PangoContext.
402 // For instance, the GTK+ toolkit has, among others,
403 // gdk_pango_context_get_for_screen(), and
404 // gtk_widget_get_pango_context(). Use those instead.
405 // be freed with g_object_unref().
406 // RETURNS: the newly allocated #PangoContext, which should
407 static Context* /*new*/ new_() {
408 return pango_context_new();
411 // Retrieves the base direction for the context. See
412 // pango_context_set_base_dir().
413 // RETURNS: the base direction for the context.
414 Direction get_base_dir() {
415 return pango_context_get_base_dir(&this);
418 // Retrieves the base gravity for the context. See
419 // pango_context_set_base_gravity().
420 // RETURNS: the base gravity for the context.
421 Gravity get_base_gravity() {
422 return pango_context_get_base_gravity(&this);
425 // Retrieve the default font description for the context.
426 // This value must not be modified or freed.
427 // RETURNS: a pointer to the context's default font description.
428 FontDescription* /*new*/ get_font_description() {
429 return pango_context_get_font_description(&this);
432 // Unintrospectable method: get_font_map() / pango_context_get_font_map()
433 // Gets the #PangoFontmap used to look up fonts for this context.
434 // is owned by Pango and should not be unreferenced.
435 // RETURNS: the font map for the #PangoContext. This value
436 FontMap* get_font_map() {
437 return pango_context_get_font_map(&this);
440 // Retrieves the gravity for the context. This is similar to
441 // pango_context_get_base_gravity(), except for when the base gravity
442 // is %PANGO_GRAVITY_AUTO for which pango_gravity_get_for_matrix() is used
443 // to return the gravity from the current context matrix.
444 // RETURNS: the resolved gravity for the context.
445 Gravity get_gravity() {
446 return pango_context_get_gravity(&this);
449 // Retrieves the gravity hint for the context. See
450 // pango_context_set_gravity_hint() for details.
451 // RETURNS: the gravity hint for the context.
452 GravityHint get_gravity_hint() {
453 return pango_context_get_gravity_hint(&this);
456 // Retrieves the global language tag for the context.
457 // RETURNS: the global language tag.
458 Language* /*new*/ get_language() {
459 return pango_context_get_language(&this);
462 // Gets the transformation matrix that will be applied when
463 // rendering with this context. See pango_context_set_matrix().
464 // (which is the same as the identity matrix). The returned
465 // matrix is owned by Pango and must not be modified or
466 // freed.
467 // RETURNS: the matrix, or %NULL if no matrix has been set
468 Matrix* get_matrix() {
469 return pango_context_get_matrix(&this);
472 // Get overall metric information for a particular font
473 // description. Since the metrics may be substantially different for
474 // different scripts, a language tag can be provided to indicate that
475 // the metrics should be retrieved that correspond to the script(s)
476 // used by that language.
477 // The #PangoFontDescription is interpreted in the same way as
478 // by pango_itemize(), and the family name may be a comma separated
479 // list of figures. If characters from multiple of these families
480 // would be used to render the string, then the returned fonts would
481 // be a composite of the metrics for the fonts loaded for the
482 // individual families.
483 // when finished using the object.
484 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
485 // <desc>: a #PangoFontDescription structure. %NULL means that the font description from the context will be used.
486 // <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.
487 FontMetrics* /*new*/ get_metrics(FontDescription* desc, Language* language) {
488 return pango_context_get_metrics(&this, desc, language);
491 // List all families for a context.
492 // <families>: location to store a pointer to an array of #PangoFontFamily *. This array should be freed with g_free().
493 // <n_families>: location to store the number of elements in @descs
494 void list_families(FontFamily*** families, int* n_families) {
495 pango_context_list_families(&this, families, n_families);
498 // Unintrospectable method: load_font() / pango_context_load_font()
499 // Loads the font in one of the fontmaps in the context
500 // that is the closest match for @desc.
501 // RETURNS: the font loaded, or %NULL if no font matched.
502 // <desc>: a #PangoFontDescription describing the font to load
503 Font* load_font(FontDescription* desc) {
504 return pango_context_load_font(&this, desc);
507 // Unintrospectable method: load_fontset() / pango_context_load_fontset()
508 // Load a set of fonts in the context that can be used to render
509 // a font matching @desc.
510 // RETURNS: the fontset, or %NULL if no font matched.
511 // <desc>: a #PangoFontDescription describing the fonts to load
512 // <language>: a #PangoLanguage the fonts will be used for
513 Fontset* load_fontset(FontDescription* desc, Language* language) {
514 return pango_context_load_fontset(&this, desc, language);
517 // Sets the base direction for the context.
518 // The base direction is used in applying the Unicode bidirectional
519 // algorithm; if the @direction is %PANGO_DIRECTION_LTR or
520 // %PANGO_DIRECTION_RTL, then the value will be used as the paragraph
521 // direction in the Unicode bidirectional algorithm. A value of
522 // %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only
523 // for paragraphs that do not contain any strong characters themselves.
524 // <direction>: the new base direction
525 void set_base_dir(Direction direction) {
526 pango_context_set_base_dir(&this, direction);
529 // Sets the base gravity for the context.
530 // The base gravity is used in laying vertical text out.
531 // <gravity>: the new base gravity
532 void set_base_gravity(Gravity gravity) {
533 pango_context_set_base_gravity(&this, gravity);
536 // Set the default font description for the context
537 // <desc>: the new pango font description
538 void set_font_description(FontDescription* desc) {
539 pango_context_set_font_description(&this, desc);
542 // Sets the font map to be searched when fonts are looked-up in this context.
543 // This is only for internal use by Pango backends, a #PangoContext obtained
544 // via one of the recommended methods should already have a suitable font map.
545 // <font_map>: the #PangoFontMap to set.
546 void set_font_map(FontMap* font_map) {
547 pango_context_set_font_map(&this, font_map);
550 // Sets the gravity hint for the context.
551 // The gravity hint is used in laying vertical text out, and is only relevant
552 // if gravity of the context as returned by pango_context_get_gravity()
553 // is set %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST.
554 // <hint>: the new gravity hint
555 void set_gravity_hint(GravityHint hint) {
556 pango_context_set_gravity_hint(&this, hint);
559 // Sets the global language tag for the context. The default language
560 // for the locale of the running process can be found using
561 // pango_language_get_default().
562 // <language>: the new language tag.
563 void set_language(Language* language) {
564 pango_context_set_language(&this, language);
567 // Sets the transformation matrix that will be applied when rendering
568 // with this context. Note that reported metrics are in the user space
569 // coordinates before the application of the matrix, not device-space
570 // coordinates after the application of the matrix. So, they don't scale
571 // with the matrix, though they may change slightly for different
572 // matrices, depending on how the text is fit to the pixel grid.
573 // <matrix>: a #PangoMatrix, or %NULL to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)
574 void set_matrix(Matrix* matrix) {
575 pango_context_set_matrix(&this, matrix);
579 struct ContextClass {
582 struct Coverage {
584 // Unintrospectable method: copy() / pango_coverage_copy()
585 // Copy an existing #PangoCoverage. (This function may now be unnecessary
586 // since we refcount the structure. File a bug if you use it.)
587 // with a reference count of one, which
588 // should be freed with pango_coverage_unref().
589 // RETURNS: the newly allocated #PangoCoverage,
590 Coverage* copy() {
591 return pango_coverage_copy(&this);
594 // Determine whether a particular index is covered by @coverage
595 // RETURNS: the coverage level of @coverage for character @index_.
596 // <index_>: the index to check
597 CoverageLevel get(int index_) {
598 return pango_coverage_get(&this, index_);
601 // Set the coverage for each index in @coverage to be the max (better)
602 // value of the current coverage for the index and the coverage for
603 // the corresponding index in @other.
604 // <other>: another #PangoCoverage
605 void max(Coverage* other) {
606 pango_coverage_max(&this, other);
609 // Unintrospectable method: ref() / pango_coverage_ref()
610 // Increase the reference count on the #PangoCoverage by one
611 // RETURNS: @coverage
612 Coverage* ref_() {
613 return pango_coverage_ref(&this);
616 // Modify a particular index within @coverage
617 // <index_>: the index to modify
618 // <level>: the new level for @index_
619 void set(int index_, CoverageLevel level) {
620 pango_coverage_set(&this, index_, level);
623 // Convert a #PangoCoverage structure into a flat binary format
624 // <bytes>: location to store result (must be freed with g_free())
625 // <n_bytes>: location to store size of result
626 void to_bytes(ubyte** bytes, int* n_bytes) {
627 pango_coverage_to_bytes(&this, bytes, n_bytes);
630 // Decrease the reference count on the #PangoCoverage by one.
631 // If the result is zero, free the coverage and all associated memory.
632 void unref() {
633 pango_coverage_unref(&this);
637 enum CoverageLevel {
638 NONE = 0,
639 FALLBACK = 1,
640 APPROXIMATE = 2,
641 EXACT = 3
644 // The #PangoDirection type represents a direction in the
645 // Unicode bidirectional algorithm; not every value in this
646 // enumeration makes sense for every usage of #PangoDirection;
647 // for example, the return value of pango_unichar_direction()
648 // and pango_find_base_dir() cannot be %PANGO_DIRECTION_WEAK_LTR
649 // or %PANGO_DIRECTION_WEAK_RTL, since every character is either
650 // neutral or has a strong direction; on the other hand
651 // %PANGO_DIRECTION_NEUTRAL doesn't make sense to pass
652 // to pango_itemize_with_base_dir().
653 // The %PANGO_DIRECTION_TTB_LTR, %PANGO_DIRECTION_TTB_RTL
654 // values come from an earlier interpretation of this
655 // enumeration as the writing direction of a block of
656 // text and are no longer used; See #PangoGravity for how
657 // vertical text is handled in Pango.
658 enum Direction {
659 LTR = 0,
660 RTL = 1,
661 TTB_LTR = 2,
662 TTB_RTL = 3,
663 WEAK_LTR = 4,
664 WEAK_RTL = 5,
665 NEUTRAL = 6
667 enum ENGINE_TYPE_LANG = "PangoEngineLang";
668 enum ENGINE_TYPE_SHAPE = "PangoEngineShape";
670 // The #PangoEllipsizeMode type describes what sort of (if any)
671 // ellipsization should be applied to a line of text. In
672 // the ellipsization process characters are removed from the
673 // text in order to make it fit to a given width and replaced
674 // with an ellipsis.
675 enum EllipsizeMode {
676 NONE = 0,
677 START = 1,
678 MIDDLE = 2,
679 END = 3
681 struct EngineLang {
684 struct EngineShape {
687 struct Font /* : GObject.Object */ {
688 alias method_parent this;
689 alias method_parent super_;
690 alias method_parent object;
691 GObject2.Object method_parent;
694 // Frees an array of font descriptions.
695 // <descs>: a pointer to an array of #PangoFontDescription, may be %NULL
696 // <n_descs>: number of font descriptions in @descs
697 static void descriptions_free(FontDescription** descs, int n_descs) {
698 pango_font_descriptions_free(descs, n_descs);
701 // Returns a description of the font, with font size set in points.
702 // Use pango_font_describe_with_absolute_size() if you want the font
703 // size in device units.
704 // RETURNS: a newly-allocated #PangoFontDescription object.
705 FontDescription* /*new*/ describe() {
706 return pango_font_describe(&this);
709 // Returns a description of the font, with absolute font size set
710 // (in device units). Use pango_font_describe() if you want the font
711 // size in points.
712 // RETURNS: a newly-allocated #PangoFontDescription object.
713 FontDescription* /*new*/ describe_with_absolute_size() {
714 return pango_font_describe_with_absolute_size(&this);
717 // Unintrospectable method: find_shaper() / pango_font_find_shaper()
718 // Finds the best matching shaper for a font for a particular
719 // language tag and character point.
720 // RETURNS: the best matching shaper.
721 // <language>: the language tag
722 // <ch>: a Unicode character.
723 EngineShape* find_shaper(Language* language, uint ch) {
724 return pango_font_find_shaper(&this, language, ch);
727 // Unintrospectable method: get_coverage() / pango_font_get_coverage()
728 // Computes the coverage map for a given font and language tag.
729 // RETURNS: a newly-allocated #PangoCoverage object.
730 // <language>: the language tag
731 Coverage* get_coverage(Language* language) {
732 return pango_font_get_coverage(&this, language);
735 // Unintrospectable method: get_font_map() / pango_font_get_font_map()
736 // Gets the font map for which the font was created.
737 // Note that the font maintains a <firstterm>weak</firstterm> reference
738 // to the font map, so if all references to font map are dropped, the font
739 // map will be finalized even if there are fonts created with the font
740 // map that are still alive. In that case this function will return %NULL.
741 // It is the responsibility of the user to ensure that the font map is kept
742 // alive. In most uses this is not an issue as a #PangoContext holds
743 // a reference to the font map.
744 // RETURNS: the #PangoFontMap for the font, or %NULL if @font is %NULL.
745 FontMap* get_font_map() {
746 return pango_font_get_font_map(&this);
749 // Gets the logical and ink extents of a glyph within a font. The
750 // coordinate system for each rectangle has its origin at the
751 // base line and horizontal origin of the character with increasing
752 // coordinates extending to the right and down. The macros PANGO_ASCENT(),
753 // PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert
754 // from the extents rectangle to more traditional font metrics. The units
755 // of the rectangles are in 1/PANGO_SCALE of a device unit.
756 // If @font is %NULL, this function gracefully sets some sane values in the
757 // output variables and returns.
758 // <glyph>: the glyph index
759 // <ink_rect>: rectangle used to store the extents of the glyph as drawn or %NULL to indicate that the result is not needed.
760 // <logical_rect>: rectangle used to store the logical extents of the glyph or %NULL to indicate that the result is not needed.
761 void get_glyph_extents(Glyph glyph, Rectangle* ink_rect, Rectangle* logical_rect) {
762 pango_font_get_glyph_extents(&this, glyph, ink_rect, logical_rect);
765 // Gets overall metric information for a font. Since the metrics may be
766 // substantially different for different scripts, a language tag can
767 // be provided to indicate that the metrics should be retrieved that
768 // correspond to the script(s) used by that language.
769 // If @font is %NULL, this function gracefully sets some sane values in the
770 // output variables and returns.
771 // when finished using the object.
772 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
773 // <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.
774 FontMetrics* /*new*/ get_metrics(Language* language) {
775 return pango_font_get_metrics(&this, language);
779 struct FontDescription {
781 // Creates a new font description structure with all fields unset.
782 // should be freed using pango_font_description_free().
783 // RETURNS: the newly allocated #PangoFontDescription, which
784 static FontDescription* /*new*/ new_() {
785 return pango_font_description_new();
788 // Determines if the style attributes of @new_match are a closer match
789 // for @desc than those of @old_match are, or if @old_match is %NULL,
790 // determines if @new_match is a match at all.
791 // Approximate matching is done for
792 // weight and style; other style attributes must match exactly.
793 // Style attributes are all attributes other than family and size-related
794 // attributes. Approximate matching for style considers PANGO_STYLE_OBLIQUE
795 // and PANGO_STYLE_ITALIC as matches, but not as good a match as when the
796 // styles are equal.
797 // Note that @old_match must match @desc.
798 // RETURNS: %TRUE if @new_match is a better match
799 // <old_match>: a #PangoFontDescription, or %NULL
800 // <new_match>: a #PangoFontDescription
801 int better_match(FontDescription* old_match, FontDescription* new_match) {
802 return pango_font_description_better_match(&this, old_match, new_match);
805 // Make a copy of a #PangoFontDescription.
806 // be freed with pango_font_description_free(), or %NULL
807 // if @desc was %NULL.
808 // RETURNS: the newly allocated #PangoFontDescription, which should
809 FontDescription* /*new*/ copy() {
810 return pango_font_description_copy(&this);
813 // Like pango_font_description_copy(), but only a shallow copy is made
814 // of the family name and other allocated fields. The result can only
815 // be used until @desc is modified or freed. This is meant to be used
816 // when the copy is only needed temporarily.
817 // be freed with pango_font_description_free(), or %NULL
818 // if @desc was %NULL.
819 // RETURNS: the newly allocated #PangoFontDescription, which should
820 FontDescription* /*new*/ copy_static() {
821 return pango_font_description_copy_static(&this);
824 // Compares two font descriptions for equality. Two font descriptions
825 // are considered equal if the fonts they describe are provably identical.
826 // This means that their masks do not have to match, as long as other fields
827 // are all the same. (Two font descriptions may result in identical fonts
828 // being loaded, but still compare %FALSE.)
829 // %FALSE otherwise.
830 // RETURNS: %TRUE if the two font descriptions are identical,
831 // <desc2>: another #PangoFontDescription
832 int equal(FontDescription* desc2) {
833 return pango_font_description_equal(&this, desc2);
835 // Frees a font description.
836 void free() {
837 pango_font_description_free(&this);
840 // Gets the family name field of a font description. See
841 // pango_font_description_set_family().
842 // %NULL if not previously set. This has the same life-time
843 // as the font description itself and should not be freed.
844 // RETURNS: the family name field for the font description, or
845 char* get_family() {
846 return pango_font_description_get_family(&this);
849 // Gets the gravity field of a font description. See
850 // pango_font_description_set_gravity().
851 // pango_font_description_get_set_fields() to find out if
852 // the field was explicitly set or not.
853 // RETURNS: the gravity field for the font description. Use
854 Gravity get_gravity() {
855 return pango_font_description_get_gravity(&this);
858 // Determines which fields in a font description have been set.
859 // fields in @desc that have been set.
860 // RETURNS: a bitmask with bits set corresponding to the
861 FontMask get_set_fields() {
862 return pango_font_description_get_set_fields(&this);
865 // Gets the size field of a font description.
866 // See pango_font_description_set_size().
867 // You must call pango_font_description_get_size_is_absolute()
868 // to find out which is the case. Returns 0 if the size field has not
869 // previously been set or it has been set to 0 explicitly.
870 // Use pango_font_description_get_set_fields() to
871 // find out if the field was explicitly set or not.
872 // RETURNS: the size field for the font description in points or device units.
873 int get_size() {
874 return pango_font_description_get_size(&this);
877 // Determines whether the size of the font is in points (not absolute) or device units (absolute).
878 // See pango_font_description_set_size() and pango_font_description_set_absolute_size().
879 // points or device units. Use pango_font_description_get_set_fields() to
880 // find out if the size field of the font description was explicitly set or not.
881 // RETURNS: whether the size for the font description is in
882 int get_size_is_absolute() {
883 return pango_font_description_get_size_is_absolute(&this);
886 // Gets the stretch field of a font description.
887 // See pango_font_description_set_stretch().
888 // pango_font_description_get_set_fields() to find out if
889 // the field was explicitly set or not.
890 // RETURNS: the stretch field for the font description. Use
891 Stretch get_stretch() {
892 return pango_font_description_get_stretch(&this);
895 // Gets the style field of a #PangoFontDescription. See
896 // pango_font_description_set_style().
897 // Use pango_font_description_get_set_fields() to find out if
898 // the field was explicitly set or not.
899 // RETURNS: the style field for the font description.
900 Style get_style() {
901 return pango_font_description_get_style(&this);
904 // Gets the variant field of a #PangoFontDescription. See
905 // pango_font_description_set_variant().
906 // pango_font_description_get_set_fields() to find out if
907 // the field was explicitly set or not.
908 // RETURNS: the variant field for the font description. Use
909 Variant get_variant() {
910 return pango_font_description_get_variant(&this);
913 // Gets the weight field of a font description. See
914 // pango_font_description_set_weight().
915 // pango_font_description_get_set_fields() to find out if
916 // the field was explicitly set or not.
917 // RETURNS: the weight field for the font description. Use
918 Weight get_weight() {
919 return pango_font_description_get_weight(&this);
922 // Computes a hash of a #PangoFontDescription structure suitable
923 // to be used, for example, as an argument to g_hash_table_new().
924 // The hash value is independent of @desc->mask.
925 // RETURNS: the hash value.
926 uint hash() {
927 return pango_font_description_hash(&this);
930 // Merges the fields that are set in @desc_to_merge into the fields in
931 // are not already set are affected. If %TRUE, then fields that are
932 // already set will be replaced as well.
933 // If @desc_to_merge is %NULL, this function performs nothing.
934 // <desc_to_merge>: the #PangoFontDescription to merge from, or %NULL
935 // <replace_existing>: if %TRUE, replace fields in @desc with the corresponding values from @desc_to_merge, even if they are already exist.
936 void merge(FontDescription* desc_to_merge, int replace_existing) {
937 pango_font_description_merge(&this, desc_to_merge, replace_existing);
940 // Like pango_font_description_merge(), but only a shallow copy is made
941 // of the family name and other allocated fields. @desc can only be
942 // used until @desc_to_merge is modified or freed. This is meant
943 // to be used when the merged font description is only needed temporarily.
944 // <desc_to_merge>: the #PangoFontDescription to merge from
945 // <replace_existing>: if %TRUE, replace fields in @desc with the corresponding values from @desc_to_merge, even if they are already exist.
946 void merge_static(FontDescription* desc_to_merge, int replace_existing) {
947 pango_font_description_merge_static(&this, desc_to_merge, replace_existing);
950 // Sets the size field of a font description, in device units. This is mutually
951 // exclusive with pango_font_description_set_size() which sets the font size
952 // in points.
953 // <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.
954 void set_absolute_size(double size) {
955 pango_font_description_set_absolute_size(&this, size);
958 // Sets the family name field of a font description. The family
959 // name represents a family of related font styles, and will
960 // resolve to a particular #PangoFontFamily. In some uses of
961 // #PangoFontDescription, it is also possible to use a comma
962 // separated list of family names for this field.
963 // <family>: a string representing the family name.
964 void set_family(char* family) {
965 pango_font_description_set_family(&this, family);
968 // Like pango_font_description_set_family(), except that no
969 // copy of @family is made. The caller must make sure that the
970 // string passed in stays around until @desc has been freed
971 // or the name is set again. This function can be used if
972 // if @desc is only needed temporarily.
973 // <family>: a string representing the family name.
974 void set_family_static(char* family) {
975 pango_font_description_set_family_static(&this, family);
978 // Sets the gravity field of a font description. The gravity field
979 // specifies how the glyphs should be rotated. If @gravity is
980 // %PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on
981 // the font description.
982 // This function is seldom useful to the user. Gravity should normally
983 // be set on a #PangoContext.
984 // <gravity>: the gravity for the font description.
985 void set_gravity(Gravity gravity) {
986 pango_font_description_set_gravity(&this, gravity);
989 // Sets the size field of a font description in fractional points. This is mutually
990 // exclusive with pango_font_description_set_absolute_size().
991 // <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.
992 void set_size(int size) {
993 pango_font_description_set_size(&this, size);
996 // Sets the stretch field of a font description. The stretch field
997 // specifies how narrow or wide the font should be.
998 // <stretch>: the stretch for the font description
999 void set_stretch(Stretch stretch) {
1000 pango_font_description_set_stretch(&this, stretch);
1003 // Sets the style field of a #PangoFontDescription. The
1004 // #PangoStyle enumeration describes whether the font is slanted and
1005 // the manner in which it is slanted; it can be either
1006 // #PANGO_STYLE_NORMAL, #PANGO_STYLE_ITALIC, or #PANGO_STYLE_OBLIQUE.
1007 // Most fonts will either have a italic style or an oblique
1008 // style, but not both, and font matching in Pango will
1009 // match italic specifications with oblique fonts and vice-versa
1010 // if an exact match is not found.
1011 // <style>: the style for the font description
1012 void set_style(Style style) {
1013 pango_font_description_set_style(&this, style);
1016 // Sets the variant field of a font description. The #PangoVariant
1017 // can either be %PANGO_VARIANT_NORMAL or %PANGO_VARIANT_SMALL_CAPS.
1018 // <variant>: the variant type for the font description.
1019 void set_variant(Variant variant) {
1020 pango_font_description_set_variant(&this, variant);
1023 // Sets the weight field of a font description. The weight field
1024 // specifies how bold or light the font should be. In addition
1025 // to the values of the #PangoWeight enumeration, other intermediate
1026 // numeric values are possible.
1027 // <weight>: the weight for the font description.
1028 void set_weight(Weight weight) {
1029 pango_font_description_set_weight(&this, weight);
1032 // Creates a filename representation of a font description. The
1033 // filename is identical to the result from calling
1034 // pango_font_description_to_string(), but with underscores instead of
1035 // characters that are untypical in filenames, and in lower case only.
1036 // RETURNS: a new string that must be freed with g_free().
1037 char* /*new*/ to_filename() {
1038 return pango_font_description_to_filename(&this);
1041 // Creates a string representation of a font description. See
1042 // pango_font_description_from_string() for a description of the
1043 // format of the string representation. The family list in the
1044 // string description will only have a terminating comma if the
1045 // last word of the list is a valid style option.
1046 // RETURNS: a new string that must be freed with g_free().
1047 char* /*new*/ to_string() {
1048 return pango_font_description_to_string(&this);
1051 // Unsets some of the fields in a #PangoFontDescription. The unset
1052 // fields will get back to their default values.
1053 // <to_unset>: bitmask of fields in the @desc to unset.
1054 void unset_fields(FontMask to_unset) {
1055 pango_font_description_unset_fields(&this, to_unset);
1059 struct FontFace /* : GObject.Object */ {
1060 alias method_parent this;
1061 alias method_parent super_;
1062 alias method_parent object;
1063 GObject2.Object method_parent;
1066 // Returns the family, style, variant, weight and stretch of
1067 // a #PangoFontFace. The size field of the resulting font description
1068 // will be unset.
1069 // holding the description of the face. Use pango_font_description_free()
1070 // to free the result.
1071 // RETURNS: a newly-created #PangoFontDescription structure
1072 FontDescription* /*new*/ describe() {
1073 return pango_font_face_describe(&this);
1076 // Gets a name representing the style of this face among the
1077 // different faces in the #PangoFontFamily for the face. This
1078 // name is unique among all faces in the family and is suitable
1079 // for displaying to users.
1080 // owned by the face object and must not be modified or freed.
1081 // RETURNS: the face name for the face. This string is
1082 char* get_face_name() {
1083 return pango_font_face_get_face_name(&this);
1086 // Returns whether a #PangoFontFace is synthesized by the underlying
1087 // font rendering engine from another face, perhaps by shearing, emboldening,
1088 // or lightening it.
1089 // RETURNS: whether @face is synthesized.
1090 int is_synthesized() {
1091 return pango_font_face_is_synthesized(&this);
1094 // List the available sizes for a font. This is only applicable to bitmap
1095 // fonts. For scalable fonts, stores %NULL at the location pointed to by
1096 // are in Pango units and are sorted in ascending order.
1097 // <sizes>: location to store a pointer to an array of int. This array should be freed with g_free().
1098 // <n_sizes>: location to store the number of elements in @sizes
1099 void list_sizes(int** sizes, int* n_sizes) {
1100 pango_font_face_list_sizes(&this, sizes, n_sizes);
1104 struct FontFamily /* : GObject.Object */ {
1105 alias method_parent this;
1106 alias method_parent super_;
1107 alias method_parent object;
1108 GObject2.Object method_parent;
1111 // Gets the name of the family. The name is unique among all
1112 // fonts for the font backend and can be used in a #PangoFontDescription
1113 // to specify that a face from this family is desired.
1114 // by the family object and must not be modified or freed.
1115 // RETURNS: the name of the family. This string is owned
1116 char* get_name() {
1117 return pango_font_family_get_name(&this);
1120 // A monospace font is a font designed for text display where the the
1121 // characters form a regular grid. For Western languages this would
1122 // mean that the advance width of all characters are the same, but
1123 // this categorization also includes Asian fonts which include
1124 // g_unichar_iswide() returns a result that indicates whether a
1125 // character is typically double-width in a monospace font.
1126 // The best way to find out the grid-cell size is to call
1127 // pango_font_metrics_get_approximate_digit_width(), since the results
1128 // of pango_font_metrics_get_approximate_char_width() may be affected
1129 // by double-width characters.
1130 // RETURNS: %TRUE if the family is monospace.
1131 int is_monospace() {
1132 return pango_font_family_is_monospace(&this);
1135 // Lists the different font faces that make up @family. The faces
1136 // in a family share a common design, but differ in slant, weight,
1137 // width and other aspects.
1138 // <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.
1139 // <n_faces>: location to store number of elements in @faces.
1140 void list_faces(FontFace*** faces, int* n_faces) {
1141 pango_font_family_list_faces(&this, faces, n_faces);
1145 struct FontMap /* : GObject.Object */ {
1146 alias method_parent this;
1147 alias method_parent super_;
1148 alias method_parent object;
1149 GObject2.Object method_parent;
1152 // Unintrospectable method: create_context() / pango_font_map_create_context()
1153 // Creates a #PangoContext connected to @fontmap. This is equivalent
1154 // to pango_context_new() followed by pango_context_set_font_map().
1155 // If you are using Pango as part of a higher-level system,
1156 // that system may have it's own way of create a #PangoContext.
1157 // For instance, the GTK+ toolkit has, among others,
1158 // gdk_pango_context_get_for_screen(), and
1159 // gtk_widget_get_pango_context(). Use those instead.
1160 // be freed with g_object_unref().
1161 // RETURNS: the newly allocated #PangoContext, which should
1162 Context* create_context() {
1163 return pango_font_map_create_context(&this);
1166 // List all families for a fontmap.
1167 // <families>: location to store a pointer to an array of #PangoFontFamily *. This array should be freed with g_free().
1168 // <n_families>: location to store the number of elements in @families
1169 void list_families(FontFamily*** families, int* n_families) {
1170 pango_font_map_list_families(&this, families, n_families);
1173 // Unintrospectable method: load_font() / pango_font_map_load_font()
1174 // Load the font in the fontmap that is the closest match for @desc.
1175 // RETURNS: the font loaded, or %NULL if no font matched.
1176 // <context>: the #PangoContext the font will be used with
1177 // <desc>: a #PangoFontDescription describing the font to load
1178 Font* load_font(Context* context, FontDescription* desc) {
1179 return pango_font_map_load_font(&this, context, desc);
1182 // Unintrospectable method: load_fontset() / pango_font_map_load_fontset()
1183 // Load a set of fonts in the fontmap that can be used to render
1184 // a font matching @desc.
1185 // RETURNS: the fontset, or %NULL if no font matched.
1186 // <context>: the #PangoContext the font will be used with
1187 // <desc>: a #PangoFontDescription describing the font to load
1188 // <language>: a #PangoLanguage the fonts will be used for
1189 Fontset* load_fontset(Context* context, FontDescription* desc, Language* language) {
1190 return pango_font_map_load_fontset(&this, context, desc, language);
1194 enum FontMask {
1195 FAMILY = 1,
1196 STYLE = 2,
1197 VARIANT = 4,
1198 WEIGHT = 8,
1199 STRETCH = 16,
1200 SIZE = 32,
1201 GRAVITY = 64
1203 struct FontMetrics {
1205 // Gets the approximate character width for a font metrics structure.
1206 // This is merely a representative value useful, for example, for
1207 // determining the initial size for a window. Actual characters in
1208 // text will be wider and narrower than this.
1209 // RETURNS: the character width, in Pango units.
1210 int get_approximate_char_width() {
1211 return pango_font_metrics_get_approximate_char_width(&this);
1214 // Gets the approximate digit width for a font metrics structure.
1215 // This is merely a representative value useful, for example, for
1216 // determining the initial size for a window. Actual digits in
1217 // text can be wider or narrower than this, though this value
1218 // is generally somewhat more accurate than the result of
1219 // pango_font_metrics_get_approximate_char_width() for digits.
1220 // RETURNS: the digit width, in Pango units.
1221 int get_approximate_digit_width() {
1222 return pango_font_metrics_get_approximate_digit_width(&this);
1225 // Gets the ascent from a font metrics structure. The ascent is
1226 // the distance from the baseline to the logical top of a line
1227 // of text. (The logical top may be above or below the top of the
1228 // actual drawn ink. It is necessary to lay out the text to figure
1229 // where the ink will be.)
1230 // RETURNS: the ascent, in Pango units.
1231 int get_ascent() {
1232 return pango_font_metrics_get_ascent(&this);
1235 // Gets the descent from a font metrics structure. The descent is
1236 // the distance from the baseline to the logical bottom of a line
1237 // of text. (The logical bottom may be above or below the bottom of the
1238 // actual drawn ink. It is necessary to lay out the text to figure
1239 // where the ink will be.)
1240 // RETURNS: the descent, in Pango units.
1241 int get_descent() {
1242 return pango_font_metrics_get_descent(&this);
1245 // Gets the suggested position to draw the strikethrough.
1246 // The value returned is the distance <emphasis>above</emphasis> the
1247 // baseline of the top of the strikethrough.
1248 // RETURNS: the suggested strikethrough position, in Pango units.
1249 int get_strikethrough_position() {
1250 return pango_font_metrics_get_strikethrough_position(&this);
1253 // Gets the suggested thickness to draw for the strikethrough.
1254 // RETURNS: the suggested strikethrough thickness, in Pango units.
1255 int get_strikethrough_thickness() {
1256 return pango_font_metrics_get_strikethrough_thickness(&this);
1259 // Gets the suggested position to draw the underline.
1260 // The value returned is the distance <emphasis>above</emphasis> the
1261 // baseline of the top of the underline. Since most fonts have
1262 // underline positions beneath the baseline, this value is typically
1263 // negative.
1264 // RETURNS: the suggested underline position, in Pango units.
1265 int get_underline_position() {
1266 return pango_font_metrics_get_underline_position(&this);
1269 // Gets the suggested thickness to draw for the underline.
1270 // RETURNS: the suggested underline thickness, in Pango units.
1271 int get_underline_thickness() {
1272 return pango_font_metrics_get_underline_thickness(&this);
1275 // Increase the reference count of a font metrics structure by one.
1276 // RETURNS: @metrics
1277 FontMetrics* /*new*/ ref_() {
1278 return pango_font_metrics_ref(&this);
1281 // Decrease the reference count of a font metrics structure by one. If
1282 // the result is zero, frees the structure and any associated
1283 // memory.
1284 void unref() {
1285 pango_font_metrics_unref(&this);
1289 struct Fontset /* : GObject.Object */ {
1290 alias method_parent this;
1291 alias method_parent super_;
1292 alias method_parent object;
1293 GObject2.Object method_parent;
1296 // Unintrospectable method: foreach() / pango_fontset_foreach()
1297 // Iterates through all the fonts in a fontset, calling @func for
1298 // each one. If @func returns %TRUE, that stops the iteration.
1299 // <func>: Callback function
1300 // <data>: data to pass to the callback function
1301 void foreach_(FontsetForeachFunc func, void* data) {
1302 pango_fontset_foreach(&this, func, data);
1305 // Unintrospectable method: get_font() / pango_fontset_get_font()
1306 // Returns the font in the fontset that contains the best glyph for the
1307 // Unicode character @wc.
1308 // with the font.
1309 // RETURNS: a #PangoFont. The caller must call g_object_unref when finished
1310 // <wc>: a Unicode character
1311 Font* get_font(uint wc) {
1312 return pango_fontset_get_font(&this, wc);
1315 // Get overall metric information for the fonts in the fontset.
1316 // when finished using the object.
1317 // RETURNS: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
1318 FontMetrics* /*new*/ get_metrics() {
1319 return pango_fontset_get_metrics(&this);
1324 // A callback function used by pango_fontset_foreach() when enumerating
1325 // the fonts in a fontset.
1326 // RETURNS: if %TRUE, stop iteration and return immediately.
1327 // <fontset>: a #PangoFontset
1328 // <font>: a font from @fontset
1329 // <data>: callback data
1330 extern (C) alias int function (Fontset* fontset, Font* font, void* data) FontsetForeachFunc;
1332 struct GlyphGeometry {
1333 GlyphUnit width, x_offset, y_offset;
1336 struct GlyphInfo {
1337 Glyph glyph;
1338 GlyphGeometry geometry;
1339 GlyphVisAttr attr;
1342 struct GlyphItem {
1343 Item* item;
1344 GlyphString* glyphs;
1347 // Unintrospectable method: apply_attrs() / pango_glyph_item_apply_attrs()
1348 // Splits a shaped item (PangoGlyphItem) into multiple items based
1349 // on an attribute list. The idea is that if you have attributes
1350 // that don't affect shaping, such as color or underline, to avoid
1351 // affecting shaping, you filter them out (pango_attr_list_filter()),
1352 // apply the shaping process and then reapply them to the result using
1353 // this function.
1354 // All attributes that start or end inside a cluster are applied
1355 // to that cluster; for instance, if half of a cluster is underlined
1356 // and the other-half strikethrough, then the cluster will end
1357 // up with both underline and strikethrough attributes. In these
1358 // cases, it may happen that item->extra_attrs for some of the
1359 // result items can have multiple attributes of the same type.
1360 // This function takes ownership of @glyph_item; it will be reused
1361 // as one of the elements in the list.
1362 // the list using g_slist_free().
1363 // RETURNS: a list of glyph items resulting from splitting
1364 // <text>: text that @list applies to
1365 // <list>: a #PangoAttrList
1366 GLib2.SList* apply_attrs(char* text, AttrList* list) {
1367 return pango_glyph_item_apply_attrs(&this, text, list);
1370 // Make a deep copy of an existing #PangoGlyphItem structure.
1371 // be freed with pango_glyph_item_free(), or %NULL
1372 // if @orig was %NULL.
1373 // RETURNS: the newly allocated #PangoGlyphItem, which should
1374 GlyphItem* /*new*/ copy() {
1375 return pango_glyph_item_copy(&this);
1377 // Frees a #PangoGlyphItem and resources to which it points.
1378 void free() {
1379 pango_glyph_item_free(&this);
1382 // Given a #PangoGlyphItem and the corresponding
1383 // text, determine the screen width corresponding to each character. When
1384 // multiple characters compose a single cluster, the width of the entire
1385 // cluster is divided equally among the characters.
1386 // See also pango_glyph_string_get_logical_widths().
1387 // <text>: text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text)
1388 // <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.
1389 void get_logical_widths(char* text, int* logical_widths) {
1390 pango_glyph_item_get_logical_widths(&this, text, logical_widths);
1393 // Adds spacing between the graphemes of @glyph_item to
1394 // give the effect of typographic letter spacing.
1395 // <text>: text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text)
1396 // <log_attrs>: logical attributes for the item (the first logical attribute refers to the position before the first character in the item)
1397 // <letter_spacing>: amount of letter spacing to add in Pango units. May be negative, though too large negative values will give ugly results.
1398 void letter_space(char* text, LogAttr* log_attrs, int letter_spacing) {
1399 pango_glyph_item_letter_space(&this, text, log_attrs, letter_spacing);
1402 // Modifies @orig to cover only the text after @split_index, and
1403 // returns a new item that covers the text before @split_index that
1404 // used to be in @orig. You can think of @split_index as the length of
1405 // the returned item. @split_index may not be 0, and it may not be
1406 // greater than or equal to the length of @orig (that is, there must
1407 // be at least one byte assigned to each item, you can't create a
1408 // zero-length item).
1409 // This function is similar in function to pango_item_split() (and uses
1410 // it internally.)
1411 // with pango_glyph_item_free().
1412 // RETURNS: the newly allocated item representing text before
1413 // <text>: text to which positions in @orig apply
1414 // <split_index>: byte index of position to split item, relative to the start of the item
1415 GlyphItem* /*new*/ split(char* text, int split_index) {
1416 return pango_glyph_item_split(&this, text, split_index);
1420 struct GlyphItemIter {
1421 GlyphItem* glyph_item;
1422 char* text;
1423 int start_glyph, start_index, start_char, end_glyph, end_index, end_char;
1426 // Make a shallow copy of an existing #PangoGlyphItemIter structure.
1427 // be freed with pango_glyph_item_iter_free(), or %NULL
1428 // if @orig was %NULL.
1429 // RETURNS: the newly allocated #PangoGlyphItemIter, which should
1430 GlyphItemIter* /*new*/ copy() {
1431 return pango_glyph_item_iter_copy(&this);
1433 // Frees a #PangoGlyphItemIter created by pango_glyph_item_iter_copy().
1434 void free() {
1435 pango_glyph_item_iter_free(&this);
1438 // Initializes a #PangoGlyphItemIter structure to point to the
1439 // last cluster in a glyph item.
1440 // See #PangoGlyphItemIter for details of cluster orders.
1441 // RETURNS: %FALSE if there are no clusters in the glyph item
1442 // <glyph_item>: the glyph item to iterate over
1443 // <text>: text corresponding to the glyph item
1444 int init_end(GlyphItem* glyph_item, char* text) {
1445 return pango_glyph_item_iter_init_end(&this, glyph_item, text);
1448 // Initializes a #PangoGlyphItemIter structure to point to the
1449 // first cluster in a glyph item.
1450 // See #PangoGlyphItemIter for details of cluster orders.
1451 // RETURNS: %FALSE if there are no clusters in the glyph item
1452 // <glyph_item>: the glyph item to iterate over
1453 // <text>: text corresponding to the glyph item
1454 int init_start(GlyphItem* glyph_item, char* text) {
1455 return pango_glyph_item_iter_init_start(&this, glyph_item, text);
1458 // Advances the iterator to the next cluster in the glyph item.
1459 // See #PangoGlyphItemIter for details of cluster orders.
1460 // last cluster.
1461 // RETURNS: %TRUE if the iterator was advanced, %FALSE if we were already on the
1462 int next_cluster() {
1463 return pango_glyph_item_iter_next_cluster(&this);
1466 // Moves the iterator to the preceding cluster in the glyph item.
1467 // See #PangoGlyphItemIter for details of cluster orders.
1468 // first cluster.
1469 // RETURNS: %TRUE if the iterator was moved, %FALSE if we were already on the
1470 int prev_cluster() {
1471 return pango_glyph_item_iter_prev_cluster(&this);
1475 struct GlyphString {
1476 int num_glyphs;
1477 GlyphInfo* glyphs;
1478 int* log_clusters;
1479 private int space;
1482 // Create a new #PangoGlyphString.
1483 // should be freed with pango_glyph_string_free().
1484 // RETURNS: the newly allocated #PangoGlyphString, which
1485 static GlyphString* /*new*/ new_() {
1486 return pango_glyph_string_new();
1489 // Copy a glyph string and associated storage.
1490 // should be freed with pango_glyph_string_free(),
1491 // or %NULL if @string was %NULL.
1492 // RETURNS: the newly allocated #PangoGlyphString, which
1493 GlyphString* /*new*/ copy() {
1494 return pango_glyph_string_copy(&this);
1497 // Compute the logical and ink extents of a glyph string. See the documentation
1498 // for pango_font_get_glyph_extents() for details about the interpretation
1499 // of the rectangles.
1500 // <font>: a #PangoFont
1501 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn or %NULL to indicate that the result is not needed.
1502 // <logical_rect>: rectangle used to store the logical extents of the glyph string or %NULL to indicate that the result is not needed.
1503 void extents(Font* font, Rectangle* ink_rect, Rectangle* logical_rect) {
1504 pango_glyph_string_extents(&this, font, ink_rect, logical_rect);
1507 // or %NULL to indicate that the result is not needed.
1508 // or %NULL to indicate that the result is not needed.
1509 // Computes the extents of a sub-portion of a glyph string. The extents are
1510 // relative to the start of the glyph string range (the origin of their
1511 // coordinate system is at the start of the range, not at the start of the entire
1512 // glyph string).
1513 // <start>: start index
1514 // <end>: end index (the range is the set of bytes with
1515 // <font>: a #PangoFont
1516 // <ink_rect>: rectangle used to store the extents of the glyph string range as drawn
1517 // <logical_rect>: rectangle used to store the logical extents of the glyph string range
1518 void extents_range(int start, int end, Font* font, Rectangle* ink_rect, Rectangle* logical_rect) {
1519 pango_glyph_string_extents_range(&this, start, end, font, ink_rect, logical_rect);
1521 // Free a glyph string and associated storage.
1522 void free() {
1523 pango_glyph_string_free(&this);
1526 // Given a #PangoGlyphString resulting from pango_shape() and the corresponding
1527 // text, determine the screen width corresponding to each character. When
1528 // multiple characters compose a single cluster, the width of the entire
1529 // cluster is divided equally among the characters.
1530 // See also pango_glyph_item_get_logical_widths().
1531 // <text>: the text corresponding to the glyphs
1532 // <length>: the length of @text, in bytes
1533 // <embedding_level>: the embedding level of the string
1534 // <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.
1535 void get_logical_widths(char* text, int length, int embedding_level, int* logical_widths) {
1536 pango_glyph_string_get_logical_widths(&this, text, length, embedding_level, logical_widths);
1539 // Computes the logical width of the glyph string as can also be computed
1540 // using pango_glyph_string_extents(). However, since this only computes the
1541 // width, it's much faster. This is in fact only a convenience function that
1542 // computes the sum of geometry.width for each glyph in the @glyphs.
1543 // RETURNS: the logical width of the glyph string.
1544 int get_width() {
1545 return pango_glyph_string_get_width(&this);
1548 // Converts from character position to x position. (X position
1549 // is measured from the left edge of the run). Character positions
1550 // are computed by dividing up each cluster into equal portions.
1551 // <text>: the text for the run
1552 // <length>: the number of bytes (not characters) in @text.
1553 // <analysis>: the analysis information return from pango_itemize()
1554 // <index_>: the byte index within @text
1555 // <trailing>: whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character.
1556 // <x_pos>: location to store result
1557 void index_to_x(char* text, int length, Analysis* analysis, int index_, int trailing, int* x_pos) {
1558 pango_glyph_string_index_to_x(&this, text, length, analysis, index_, trailing, x_pos);
1561 // Resize a glyph string to the given length.
1562 // <new_len>: the new length of the string.
1563 void set_size(int new_len) {
1564 pango_glyph_string_set_size(&this, new_len);
1567 // Convert from x offset to character position. Character positions
1568 // are computed by dividing up each cluster into equal portions.
1569 // In scripts where positioning within a cluster is not allowed
1570 // (such as Thai), the returned value may not be a valid cursor
1571 // position; the caller must combine the result with the logical
1572 // attributes for the text to compute the valid cursor position.
1573 // <text>: the text for the run
1574 // <length>: the number of bytes (not characters) in text.
1575 // <analysis>: the analysis information return from pango_itemize()
1576 // <x_pos>: the x offset (in Pango units)
1577 // <index_>: location to store calculated byte index within @text
1578 // <trailing>: location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.
1579 void x_to_index(char* text, int length, Analysis* analysis, int x_pos, int* index_, int* trailing) {
1580 pango_glyph_string_x_to_index(&this, text, length, analysis, x_pos, index_, trailing);
1584 struct GlyphVisAttr {
1585 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
1586 uint, "is_cluster_start", 1,
1587 uint, "__dummy32A", 31));
1591 // The #PangoGravity type represents the orientation of glyphs in a segment
1592 // of text. This is useful when rendering vertical text layouts. In
1593 // those situations, the layout is rotated using a non-identity PangoMatrix,
1594 // and then glyph orientation is controlled using #PangoGravity.
1595 // Not every value in this enumeration makes sense for every usage of
1596 // #PangoGravity; for example, %PANGO_GRAVITY_AUTO only can be passed to
1597 // pango_context_set_base_gravity() and can only be returned by
1598 // pango_context_get_base_gravity().
1599 enum Gravity /* Version 1.16 */ {
1600 SOUTH = 0,
1601 EAST = 1,
1602 NORTH = 2,
1603 WEST = 3,
1604 AUTO = 4
1607 // The #PangoGravityHint defines how horizontal scripts should behave in a
1608 // vertical context. That is, English excerpt in a vertical paragraph for
1609 // example.
1610 // See #PangoGravity.
1611 enum GravityHint /* Version 1.16 */ {
1612 NATURAL = 0,
1613 STRONG = 1,
1614 LINE = 2
1616 struct Item {
1617 int offset, length, num_chars;
1618 Analysis analysis;
1621 // Creates a new #PangoItem structure initialized to default values.
1622 // be freed with pango_item_free().
1623 // RETURNS: the newly allocated #PangoItem, which should
1624 static Item* /*new*/ new_() {
1625 return pango_item_new();
1628 // Copy an existing #PangoItem structure.
1629 // be freed with pango_item_free(), or %NULL if
1630 // RETURNS: the newly allocated #PangoItem, which should
1631 Item* /*new*/ copy() {
1632 return pango_item_copy(&this);
1634 // Free a #PangoItem and all associated memory.
1635 void free() {
1636 pango_item_free(&this);
1639 // Modifies @orig to cover only the text after @split_index, and
1640 // returns a new item that covers the text before @split_index that
1641 // used to be in @orig. You can think of @split_index as the length of
1642 // the returned item. @split_index may not be 0, and it may not be
1643 // greater than or equal to the length of @orig (that is, there must
1644 // be at least one byte assigned to each item, you can't create a
1645 // zero-length item). @split_offset is the length of the first item in
1646 // chars, and must be provided because the text used to generate the
1647 // item isn't available, so pango_item_split() can't count the char
1648 // length of the split items itself.
1649 // should be freed with pango_item_free().
1650 // RETURNS: new item representing text before @split_index, which
1651 // <split_index>: byte index of position to split item, relative to the start of the item
1652 // <split_offset>: number of chars between start of @orig and @split_index
1653 Item* /*new*/ split(int split_index, int split_offset) {
1654 return pango_item_split(&this, split_index, split_offset);
1658 struct Language {
1660 // Get a string that is representative of the characters needed to
1661 // render a particular language.
1662 // The sample text may be a pangram, but is not necessarily. It is chosen to
1663 // be demonstrative of normal text in the language, as well as exposing font
1664 // feature requirements unique to the language. It is suitable for use
1665 // as sample text in a font selection dialog.
1666 // If @language is %NULL, the default language as found by
1667 // pango_language_get_default() is used.
1668 // If Pango does not have a sample string for @language, the classic
1669 // "The quick brown fox..." is returned. This can be detected by
1670 // comparing the returned pointer value to that returned for (non-existent)
1671 // language code "xx". That is, compare to:
1672 // <informalexample><programlisting>
1673 // pango_language_get_sample_string (pango_language_from_string ("xx"))
1674 // </programlisting></informalexample>
1675 // and should not be freed.
1676 // RETURNS: the sample string. This value is owned by Pango
1677 char* get_sample_string() {
1678 return pango_language_get_sample_string(&this);
1681 // Determines the scripts used to to write @language.
1682 // If nothing is known about the language tag @language,
1683 // or if @language is %NULL, then %NULL is returned.
1684 // The list of scripts returned starts with the script that the
1685 // language uses most and continues to the one it uses least.
1686 // The value @num_script points at will be set to the number
1687 // of scripts in the returned array (or zero if %NULL is returned).
1688 // Most languages use only one script for writing, but there are
1689 // some that use two (Latin and Cyrillic for example), and a few
1690 // use three (Japanese for example). Applications should not make
1691 // any assumptions on the maximum number of scripts returned
1692 // though, except that it is positive if the return value is not
1693 // %NULL, and it is a small number.
1694 // The pango_language_includes_script() function uses this function
1695 // internally.
1696 // number of entries in the array stored in @num_scripts, or
1697 // %NULL if Pango does not have any information about this
1698 // particular language tag (also the case if @language is %NULL).
1699 // The returned array is owned by Pango and should not be modified
1700 // or freed.
1701 // RETURNS: An array of #PangoScript values, with the
1702 // <num_scripts>: location to return number of scripts, or %NULL
1703 Script* get_scripts(int* num_scripts) {
1704 return pango_language_get_scripts(&this, num_scripts);
1707 // Determines if @script is one of the scripts used to
1708 // write @language. The returned value is conservative;
1709 // if nothing is known about the language tag @language,
1710 // %TRUE will be returned, since, as far as Pango knows,
1711 // This routine is used in Pango's itemization process when
1712 // determining if a supplied language tag is relevant to
1713 // a particular section of text. It probably is not useful for
1714 // applications in most circumstances.
1715 // This function uses pango_language_get_scripts() internally.
1716 // to write @language or if nothing is known about @language
1717 // (including the case that @language is %NULL),
1718 // %FALSE otherwise.
1719 // RETURNS: %TRUE if @script is one of the scripts used
1720 // <script>: a #PangoScript
1721 int includes_script(Script script) {
1722 return pango_language_includes_script(&this, script);
1725 // Checks if a language tag matches one of the elements in a list of
1726 // language ranges. A language tag is considered to match a range
1727 // in the list if the range is '*', the range is exactly the tag,
1728 // or the range is a prefix of the tag, and the character after it
1729 // in the tag is '-'.
1730 // RETURNS: %TRUE if a match was found.
1731 // <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()
1732 int matches(char* range_list) {
1733 return pango_language_matches(&this, range_list);
1736 // Gets the RFC-3066 format string representing the given language tag.
1737 // Pango and should not be freed.
1738 // RETURNS: a string representing the language tag. This is owned by
1739 char* to_string() {
1740 return pango_language_to_string(&this);
1744 struct Layout /* : GObject.Object */ {
1745 alias method_parent this;
1746 alias method_parent super_;
1747 alias method_parent object;
1748 GObject2.Object method_parent;
1751 // Create a new #PangoLayout object with attributes initialized to
1752 // default values for a particular #PangoContext.
1753 // count of one, which should be freed with
1754 // g_object_unref().
1755 // RETURNS: the newly allocated #PangoLayout, with a reference
1756 // <context>: a #PangoContext
1757 static Layout* /*new*/ new_(Context* context) {
1758 return pango_layout_new(context);
1761 // Forces recomputation of any state in the #PangoLayout that
1762 // might depend on the layout's context. This function should
1763 // be called if you make changes to the context subsequent
1764 // to creating the layout.
1765 void context_changed() {
1766 pango_layout_context_changed(&this);
1769 // Unintrospectable method: copy() / pango_layout_copy()
1770 // Does a deep copy-by-value of the @src layout. The attribute list,
1771 // tab array, and text from the original layout are all copied by
1772 // value.
1773 // count of one, which should be freed with
1774 // g_object_unref().
1775 // RETURNS: the newly allocated #PangoLayout, with a reference
1776 Layout* copy() {
1777 return pango_layout_copy(&this);
1780 // positioned within the horizontal space available.
1781 // RETURNS: the alignment.
1782 Alignment get_alignment() {
1783 return pango_layout_get_alignment(&this);
1786 // Gets the attribute list for the layout, if any.
1787 // RETURNS: a #PangoAttrList.
1788 AttrList* /*new*/ get_attributes() {
1789 return pango_layout_get_attributes(&this);
1792 // Gets whether to calculate the bidirectional base direction
1793 // for the layout according to the contents of the layout.
1794 // See pango_layout_set_auto_dir().
1795 // is computed from the layout's contents, %FALSE otherwise.
1796 // RETURNS: %TRUE if the bidirectional base direction
1797 int get_auto_dir() {
1798 return pango_layout_get_auto_dir(&this);
1801 // Gets the Y position of baseline of the first line in @layout.
1802 // RETURNS: baseline of first line, from top of @layout.
1803 int get_baseline() {
1804 return pango_layout_get_baseline(&this);
1807 // Retrieves the #PangoContext used for this layout.
1808 // This does not have an additional refcount added, so if you want to
1809 // keep a copy of this around, you must reference it yourself.
1810 // RETURNS: the #PangoContext for the layout.
1811 Context* get_context() {
1812 return pango_layout_get_context(&this);
1815 // Given an index within a layout, determines the positions that of the
1816 // strong and weak cursors if the insertion point is at that
1817 // index. The position of each cursor is stored as a zero-width
1818 // rectangle. The strong cursor location is the location where
1819 // characters of the directionality equal to the base direction of the
1820 // layout are inserted. The weak cursor location is the location
1821 // where characters of the directionality opposite to the base
1822 // direction of the layout are inserted.
1823 // <index_>: the byte index of the cursor
1824 // <strong_pos>: location to store the strong cursor position (may be %NULL)
1825 // <weak_pos>: location to store the weak cursor position (may be %NULL)
1826 void get_cursor_pos(int index_, /*out*/ Rectangle* strong_pos, /*out*/ Rectangle* weak_pos) {
1827 pango_layout_get_cursor_pos(&this, index_, strong_pos, weak_pos);
1830 // Gets the type of ellipsization being performed for @layout.
1831 // See pango_layout_set_ellipsize()
1832 // Use pango_layout_is_ellipsized() to query whether any paragraphs
1833 // were actually ellipsized.
1834 // RETURNS: the current ellipsization mode for @layout.
1835 EllipsizeMode get_ellipsize() {
1836 return pango_layout_get_ellipsize(&this);
1839 // Computes the logical and ink extents of @layout. Logical extents
1840 // are usually what you want for positioning things. Note that both extents
1841 // may have non-zero x and y. You may want to use those to offset where you
1842 // render the layout. Not doing that is a very typical bug that shows up as
1843 // right-to-left layouts not being correctly positioned in a layout with
1844 // a set width.
1845 // The extents are given in layout coordinates and in Pango units; layout
1846 // coordinates begin at the top left corner of the layout.
1847 // <ink_rect>: rectangle used to store the extents of the layout as drawn or %NULL to indicate that the result is not needed.
1848 // <logical_rect>: rectangle used to store the logical extents of the layout or %NULL to indicate that the result is not needed.
1849 void get_extents(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
1850 pango_layout_get_extents(&this, ink_rect, logical_rect);
1853 // Gets the font description for the layout, if any.
1854 // or %NULL if the font description from the layout's
1855 // context is inherited. This value is owned by the layout
1856 // and must not be modified or freed.
1857 // RETURNS: a pointer to the layout's font description,
1858 FontDescription* get_font_description() {
1859 return pango_layout_get_font_description(&this);
1862 // Gets the height of layout used for ellipsization. See
1863 // pango_layout_set_height() for details.
1864 // number of lines if negative.
1865 // RETURNS: the height, in Pango units if positive, or
1866 int get_height() {
1867 return pango_layout_get_height(&this);
1870 // Gets the paragraph indent width in Pango units. A negative value
1871 // indicates a hanging indentation.
1872 // RETURNS: the indent in Pango units.
1873 int get_indent() {
1874 return pango_layout_get_indent(&this);
1877 // Returns an iterator to iterate over the visual extents of the layout.
1878 // pango_layout_iter_free().
1879 // RETURNS: the new #PangoLayoutIter that should be freed using
1880 LayoutIter* /*new*/ get_iter() {
1881 return pango_layout_get_iter(&this);
1884 // Gets whether each complete line should be stretched to fill the entire
1885 // width of the layout.
1886 // RETURNS: the justify.
1887 int get_justify() {
1888 return pango_layout_get_justify(&this);
1891 // Retrieves a particular line from a #PangoLayout.
1892 // Use the faster pango_layout_get_line_readonly() if you do not plan
1893 // to modify the contents of the line (glyphs, glyph widths, etc.).
1894 // index is out of range. This layout line can
1895 // be ref'ed and retained, but will become invalid
1896 // if changes are made to the #PangoLayout.
1897 // RETURNS: the requested #PangoLayoutLine, or %NULL if the
1898 // <line>: the index of a line, which must be between 0 and <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.
1899 LayoutLine* /*new*/ get_line(int line) {
1900 return pango_layout_get_line(&this, line);
1903 // Retrieves the count of lines for the @layout.
1904 // RETURNS: the line count.
1905 int get_line_count() {
1906 return pango_layout_get_line_count(&this);
1909 // Retrieves a particular line from a #PangoLayout.
1910 // This is a faster alternative to pango_layout_get_line(),
1911 // but the user is not expected
1912 // to modify the contents of the line (glyphs, glyph widths, etc.).
1913 // index is out of range. This layout line can
1914 // be ref'ed and retained, but will become invalid
1915 // if changes are made to the #PangoLayout.
1916 // No changes should be made to the line.
1917 // RETURNS: the requested #PangoLayoutLine, or %NULL if the
1918 // <line>: the index of a line, which must be between 0 and <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.
1919 LayoutLine* /*new*/ get_line_readonly(int line) {
1920 return pango_layout_get_line_readonly(&this, line);
1923 // Returns the lines of the @layout as a list.
1924 // Use the faster pango_layout_get_lines_readonly() if you do not plan
1925 // to modify the contents of the lines (glyphs, glyph widths, etc.).
1926 // the lines in the layout. This points to internal data of the #PangoLayout
1927 // and must be used with care. It will become invalid on any change to the layout's
1928 // text or properties.
1929 // RETURNS: a #GSList containing
1930 GLib2.SList* get_lines() {
1931 return pango_layout_get_lines(&this);
1934 // Returns the lines of the @layout as a list.
1935 // This is a faster alternative to pango_layout_get_lines(),
1936 // but the user is not expected
1937 // to modify the contents of the lines (glyphs, glyph widths, etc.).
1938 // the lines in the layout. This points to internal data of the #PangoLayout and
1939 // must be used with care. It will become invalid on any change to the layout's
1940 // text or properties. No changes should be made to the lines.
1941 // RETURNS: a #GSList containing
1942 GLib2.SList* get_lines_readonly() {
1943 return pango_layout_get_lines_readonly(&this);
1946 // Retrieves an array of logical attributes for each character in
1947 // the @layout.
1948 // <attrs>: location to store a pointer to an array of logical attributes This value must be freed with g_free().
1949 // <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.)
1950 void get_log_attrs(/*out*/ LogAttr** attrs, /*out*/ int* n_attrs) {
1951 pango_layout_get_log_attrs(&this, attrs, n_attrs);
1954 // Computes the logical and ink extents of @layout in device units.
1955 // This function just calls pango_layout_get_extents() followed by
1956 // two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect
1957 // such that the rounded rectangles fully contain the unrounded one (that is,
1958 // passes them as first argument to pango_extents_to_pixels()).
1959 // <ink_rect>: rectangle used to store the extents of the layout as drawn or %NULL to indicate that the result is not needed.
1960 // <logical_rect>: rectangle used to store the logical extents of the layout or %NULL to indicate that the result is not needed.
1961 void get_pixel_extents(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
1962 pango_layout_get_pixel_extents(&this, ink_rect, logical_rect);
1965 // Determines the logical width and height of a #PangoLayout
1966 // in device units. (pango_layout_get_size() returns the width
1967 // and height scaled by %PANGO_SCALE.) This
1968 // is simply a convenience function around
1969 // pango_layout_get_pixel_extents().
1970 // <width>: location to store the logical width, or %NULL
1971 // <height>: location to store the logical height, or %NULL
1972 void get_pixel_size(/*out*/ int* width, /*out*/ int* height) {
1973 pango_layout_get_pixel_size(&this, width, height);
1976 // Obtains the value set by pango_layout_set_single_paragraph_mode().
1977 // paragraph separator characters, %FALSE otherwise.
1978 // RETURNS: %TRUE if the layout does not break paragraphs at
1979 int get_single_paragraph_mode() {
1980 return pango_layout_get_single_paragraph_mode(&this);
1983 // Determines the logical width and height of a #PangoLayout
1984 // in Pango units (device units scaled by %PANGO_SCALE). This
1985 // is simply a convenience function around pango_layout_get_extents().
1986 // <width>: location to store the logical width, or %NULL
1987 // <height>: location to store the logical height, or %NULL
1988 void get_size(/*out*/ int* width, /*out*/ int* height) {
1989 pango_layout_get_size(&this, width, height);
1992 // Gets the amount of spacing between the lines of the layout.
1993 // RETURNS: the spacing in Pango units.
1994 int get_spacing() {
1995 return pango_layout_get_spacing(&this);
1998 // Gets the current #PangoTabArray used by this layout. If no
1999 // #PangoTabArray has been set, then the default tabs are in use
2000 // and %NULL is returned. Default tabs are every 8 spaces.
2001 // The return value should be freed with pango_tab_array_free().
2002 // RETURNS: a copy of the tabs for this layout, or %NULL.
2003 TabArray* /*new*/ get_tabs() {
2004 return pango_layout_get_tabs(&this);
2007 // Gets the text in the layout. The returned text should not
2008 // be freed or modified.
2009 // RETURNS: the text in the @layout.
2010 char* get_text() {
2011 return pango_layout_get_text(&this);
2014 // Counts the number unknown glyphs in @layout. That is, zero if
2015 // glyphs for all characters in the layout text were found, or more
2016 // than zero otherwise.
2017 // This function can be used to determine if there are any fonts
2018 // available to render all characters in a certain string, or when
2019 // used in combination with %PANGO_ATTR_FALLBACK, to check if a
2020 // certain font supports all the characters in the string.
2021 // RETURNS: The number of unknown glyphs in @layout.
2022 int get_unknown_glyphs_count() {
2023 return pango_layout_get_unknown_glyphs_count(&this);
2026 // Gets the width to which the lines of the #PangoLayout should wrap.
2027 // RETURNS: the width in Pango units, or -1 if no width set.
2028 int get_width() {
2029 return pango_layout_get_width(&this);
2032 // Gets the wrap mode for the layout.
2033 // Use pango_layout_is_wrapped() to query whether any paragraphs
2034 // were actually wrapped.
2035 // RETURNS: active wrap mode.
2036 WrapMode get_wrap() {
2037 return pango_layout_get_wrap(&this);
2040 // Converts from byte @index_ within the @layout to line and X position.
2041 // (X position is measured from the left edge of the line)
2042 // <index_>: the byte index of a grapheme within the layout.
2043 // <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.
2044 // <line>: location to store resulting line index. (which will between 0 and pango_layout_get_line_count(layout) - 1)
2045 void index_to_line_x(int index_, int trailing, /*out*/ int* line, int* x_pos) {
2046 pango_layout_index_to_line_x(&this, index_, trailing, line, x_pos);
2049 // Converts from an index within a #PangoLayout to the onscreen position
2050 // corresponding to the grapheme at that index, which is represented
2051 // as rectangle. Note that <literal>pos->x</literal> is always the leading
2052 // edge of the grapheme and <literal>pos->x + pos->width</literal> the trailing
2053 // edge of the grapheme. If the directionality of the grapheme is right-to-left,
2054 // then <literal>pos->width</literal> will be negative.
2055 // <index_>: byte index within @layout
2056 // <pos>: rectangle in which to store the position of the grapheme
2057 void index_to_pos(int index_, /*out*/ Rectangle* pos) {
2058 pango_layout_index_to_pos(&this, index_, pos);
2061 // Queries whether the layout had to ellipsize any paragraphs.
2062 // This returns %TRUE if the ellipsization mode for @layout
2063 // is not %PANGO_ELLIPSIZE_NONE, a positive width is set on @layout,
2064 // and there are paragraphs exceeding that width that have to be
2065 // ellipsized.
2066 // otherwise.
2067 // RETURNS: %TRUE if any paragraphs had to be ellipsized, %FALSE
2068 int is_ellipsized() {
2069 return pango_layout_is_ellipsized(&this);
2072 // Queries whether the layout had to wrap any paragraphs.
2073 // This returns %TRUE if a positive width is set on @layout,
2074 // ellipsization mode of @layout is set to %PANGO_ELLIPSIZE_NONE,
2075 // and there are paragraphs exceeding the layout width that have
2076 // to be wrapped.
2077 // otherwise.
2078 // RETURNS: %TRUE if any paragraphs had to be wrapped, %FALSE
2079 int is_wrapped() {
2080 return pango_layout_is_wrapped(&this);
2083 // Computes a new cursor position from an old position and
2084 // a count of positions to move visually. If @direction is positive,
2085 // then the new strong cursor position will be one position
2086 // to the right of the old cursor position. If @direction is negative,
2087 // then the new strong cursor position will be one position
2088 // to the left of the old cursor position.
2089 // In the presence of bidirectional text, the correspondence
2090 // between logical and visual order will depend on the direction
2091 // of the current run, and there may be jumps when the cursor
2092 // is moved off of the end of a run.
2093 // Motion here is in cursor positions, not in characters, so a
2094 // single call to pango_layout_move_cursor_visually() may move the
2095 // cursor over multiple characters when multiple characters combine
2096 // to form a single grapheme.
2097 // <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.
2098 // <old_index>: the byte index of the grapheme for the old index
2099 // <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.
2100 // <direction>: direction to move cursor. A negative value indicates motion to the left.
2101 // <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.
2102 // <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.
2103 void move_cursor_visually(int strong, int old_index, int old_trailing, int direction, /*out*/ int* new_index, int* new_trailing) {
2104 pango_layout_move_cursor_visually(&this, strong, old_index, old_trailing, direction, new_index, new_trailing);
2107 // positioned within the horizontal space available.
2108 // <alignment>: the alignment
2109 void set_alignment(Alignment alignment) {
2110 pango_layout_set_alignment(&this, alignment);
2113 // Sets the text attributes for a layout object.
2114 // References @attrs, so the caller can unref its reference.
2115 // <attrs>: a #PangoAttrList, can be %NULL
2116 void set_attributes(AttrList* attrs) {
2117 pango_layout_set_attributes(&this, attrs);
2120 // Sets whether to calculate the bidirectional base direction
2121 // for the layout according to the contents of the layout;
2122 // when this flag is on (the default), then paragraphs in
2123 // (Arabic and Hebrew principally), will have right-to-left
2124 // layout, paragraphs with letters from other scripts will
2125 // have left-to-right layout. Paragraphs with only neutral
2126 // characters get their direction from the surrounding paragraphs.
2127 // When %FALSE, the choice between left-to-right and
2128 // right-to-left layout is done according to the base direction
2129 // of the layout's #PangoContext. (See pango_context_set_base_dir()).
2130 // When the auto-computed direction of a paragraph differs from the
2131 // base direction of the context, the interpretation of
2132 // %PANGO_ALIGN_LEFT and %PANGO_ALIGN_RIGHT are swapped.
2133 // <auto_dir>: if %TRUE, compute the bidirectional base direction from the layout's contents.
2134 void set_auto_dir(int auto_dir) {
2135 pango_layout_set_auto_dir(&this, auto_dir);
2138 // Sets the type of ellipsization being performed for @layout.
2139 // Depending on the ellipsization mode @ellipsize text is
2140 // removed from the start, middle, or end of text so they
2141 // fit within the width and height of layout set with
2142 // pango_layout_set_width() and pango_layout_set_height().
2143 // If the layout contains characters such as newlines that
2144 // force it to be layed out in multiple paragraphs, then whether
2145 // each paragraph is ellipsized separately or the entire layout
2146 // is ellipsized as a whole depends on the set height of the layout.
2147 // See pango_layout_set_height() for details.
2148 // <ellipsize>: the new ellipsization mode for @layout
2149 void set_ellipsize(EllipsizeMode ellipsize) {
2150 pango_layout_set_ellipsize(&this, ellipsize);
2153 // Sets the default font description for the layout. If no font
2154 // description is set on the layout, the font description from
2155 // the layout's context is used.
2156 // <desc>: the new #PangoFontDescription, or %NULL to unset the current font description
2157 void set_font_description(FontDescription* desc) {
2158 pango_layout_set_font_description(&this, desc);
2161 // Sets the height to which the #PangoLayout should be ellipsized at. There
2162 // are two different behaviors, based on whether @height is positive or
2163 // negative.
2164 // If @height is positive, it will be the maximum height of the layout. Only
2165 // lines would be shown that would fit, and if there is any text omitted,
2166 // an ellipsis added. At least one line is included in each paragraph regardless
2167 // of how small the height value is. A value of zero will render exactly one
2168 // line for the entire layout.
2169 // If @height is negative, it will be the (negative of) maximum number of lines per
2170 // paragraph. That is, the total number of lines shown may well be more than
2171 // this value if the layout contains multiple paragraphs of text.
2172 // The default value of -1 means that first line of each paragraph is ellipsized.
2173 // This behvaior may be changed in the future to act per layout instead of per
2174 // paragraph. File a bug against pango at <ulink
2175 // url="http://bugzilla.gnome.org/">http://bugzilla.gnome.org/</ulink> if your
2176 // code relies on this behavior.
2177 // Height setting only has effect if a positive width is set on
2178 // The behavior is undefined if a height other than -1 is set and
2179 // ellipsization mode is set to %PANGO_ELLIPSIZE_NONE, and may change in the
2180 // future.
2181 // <height>: the desired height of the layout in Pango units if positive, or desired number of lines if negative.
2182 void set_height(int height) {
2183 pango_layout_set_height(&this, height);
2186 // Sets the width in Pango units to indent each paragraph. A negative value
2187 // of @indent will produce a hanging indentation. That is, the first line will
2188 // have the full width, and subsequent lines will be indented by the
2189 // absolute value of @indent.
2190 // The indent setting is ignored if layout alignment is set to
2191 // %PANGO_ALIGN_CENTER.
2192 // <indent>: the amount by which to indent.
2193 void set_indent(int indent) {
2194 pango_layout_set_indent(&this, indent);
2197 // Sets whether each complete line should be stretched to
2198 // fill the entire width of the layout. This stretching is typically
2199 // done by adding whitespace, but for some scripts (such as Arabic),
2200 // the justification may be done in more complex ways, like extending
2201 // the characters.
2202 // Note that this setting is not implemented and so is ignored in Pango
2203 // older than 1.18.
2204 // <justify>: whether the lines in the layout should be justified.
2205 void set_justify(int justify) {
2206 pango_layout_set_justify(&this, justify);
2209 // Same as pango_layout_set_markup_with_accel(), but
2210 // the markup text isn't scanned for accelerators.
2211 // <markup>: marked-up text
2212 // <length>: length of marked-up text in bytes, or -1 if @markup is nul-terminated
2213 void set_markup(char* markup, int length) {
2214 pango_layout_set_markup(&this, markup, length);
2217 // Sets the layout text and attribute list from marked-up text (see
2218 // <link linkend="PangoMarkupFormat">markup format</link>). Replaces
2219 // the current text and attribute list.
2220 // If @accel_marker is nonzero, the given character will mark the
2221 // character following it as an accelerator. For example, @accel_marker
2222 // might be an ampersand or underscore. All characters marked
2223 // as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
2224 // and the first character so marked will be returned in @accel_char.
2225 // Two @accel_marker characters following each other produce a single
2226 // literal @accel_marker character.
2227 // <markup>: marked-up text (see <link linkend="PangoMarkupFormat">markup format</link>)
2228 // <length>: length of marked-up text in bytes, or -1 if @markup is nul-terminated
2229 // <accel_marker>: marker for accelerators in the text
2230 // <accel_char>: return location for first located accelerator, or %NULL
2231 void set_markup_with_accel(char* markup, int length, dchar accel_marker, dchar* accel_char) {
2232 pango_layout_set_markup_with_accel(&this, markup, length, accel_marker, accel_char);
2235 // If @setting is %TRUE, do not treat newlines and similar characters
2236 // as paragraph separators; instead, keep all text in a single paragraph,
2237 // and display a glyph for paragraph separator characters. Used when
2238 // you want to allow editing of newlines on a single text line.
2239 // <setting>: new setting
2240 void set_single_paragraph_mode(int setting) {
2241 pango_layout_set_single_paragraph_mode(&this, setting);
2244 // Sets the amount of spacing in Pango unit between the lines of the
2245 // layout.
2246 // <spacing>: the amount of spacing
2247 void set_spacing(int spacing) {
2248 pango_layout_set_spacing(&this, spacing);
2251 // Sets the tabs to use for @layout, overriding the default tabs
2252 // (by default, tabs are every 8 spaces). If @tabs is %NULL, the default
2253 // tabs are reinstated. @tabs is copied into the layout; you must
2254 // free your copy of @tabs yourself.
2255 // <tabs>: a #PangoTabArray, or %NULL
2256 void set_tabs(TabArray* tabs) {
2257 pango_layout_set_tabs(&this, tabs);
2260 // Sets the text of the layout.
2261 // Note that if you have used
2262 // pango_layout_set_markup() or pango_layout_set_markup_with_accel() on
2263 // the attributes set on the layout from the markup as this function does not
2264 // clear attributes.
2265 // <text>: a valid UTF-8 string
2266 // <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.
2267 void set_text(char* text, int length) {
2268 pango_layout_set_text(&this, text, length);
2271 // Sets the width to which the lines of the #PangoLayout should wrap or
2272 // <width>: the desired width in Pango units, or -1 to indicate that no wrapping or ellipsization should be performed.
2273 void set_width(int width) {
2274 pango_layout_set_width(&this, width);
2277 // Sets the wrap mode; the wrap mode only has effect if a width
2278 // is set on the layout with pango_layout_set_width().
2279 // To turn off wrapping, set the width to -1.
2280 // <wrap>: the wrap mode
2281 void set_wrap(WrapMode wrap) {
2282 pango_layout_set_wrap(&this, wrap);
2285 // Converts from X and Y position within a layout to the byte
2286 // index to the character at that logical position. If the
2287 // Y position is not inside the layout, the closest position is chosen
2288 // (the position will be clamped inside the layout). If the
2289 // X position is not within the layout, then the start or the
2290 // end of the line is chosen as described for pango_layout_x_to_index().
2291 // If either the X or Y positions were not inside the layout, then the
2292 // function returns %FALSE; on an exact hit, it returns %TRUE.
2293 // RETURNS: %TRUE if the coordinates were inside text, %FALSE otherwise.
2294 // <x>: the X offset (in Pango units) from the left edge of the layout.
2295 // <y>: the Y offset (in Pango units) from the top edge of the layout
2296 // <index_>: location to store calculated byte index
2297 // <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.
2298 int xy_to_index(int x, int y, /*out*/ int* index_, /*out*/ int* trailing) {
2299 return pango_layout_xy_to_index(&this, x, y, index_, trailing);
2303 struct LayoutClass {
2306 struct LayoutIter {
2308 // Determines whether @iter is on the last line of the layout.
2309 // RETURNS: %TRUE if @iter is on the last line.
2310 int at_last_line() {
2311 return pango_layout_iter_at_last_line(&this);
2314 // Copies a #PangLayoutIter.
2315 // be freed with pango_layout_iter_free(), or %NULL if
2316 // RETURNS: the newly allocated #PangoLayoutIter, which should
2317 LayoutIter* /*new*/ copy() {
2318 return pango_layout_iter_copy(&this);
2320 // Frees an iterator that's no longer in use.
2321 void free() {
2322 pango_layout_iter_free(&this);
2325 // Gets the Y position of the current line's baseline, in layout
2326 // coordinates (origin at top left of the entire layout).
2327 // RETURNS: baseline of current line.
2328 int get_baseline() {
2329 return pango_layout_iter_get_baseline(&this);
2332 // Gets the extents of the current character, in layout coordinates
2333 // (origin is the top left of the entire layout). Only logical extents
2334 // can sensibly be obtained for characters; ink extents make sense only
2335 // down to the level of clusters.
2336 // <logical_rect>: rectangle to fill with logical extents
2337 void get_char_extents(Rectangle* logical_rect) {
2338 pango_layout_iter_get_char_extents(&this, logical_rect);
2341 // Gets the extents of the current cluster, in layout coordinates
2342 // (origin is the top left of the entire layout).
2343 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2344 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2345 void get_cluster_extents(Rectangle* ink_rect, Rectangle* logical_rect) {
2346 pango_layout_iter_get_cluster_extents(&this, ink_rect, logical_rect);
2349 // Gets the current byte index. Note that iterating forward by char
2350 // moves in visual order, not logical order, so indexes may not be
2351 // sequential. Also, the index may be equal to the length of the text
2352 // in the layout, if on the %NULL run (see pango_layout_iter_get_run()).
2353 // RETURNS: current byte index.
2354 int get_index() {
2355 return pango_layout_iter_get_index(&this);
2358 // Unintrospectable method: get_layout() / pango_layout_iter_get_layout()
2359 // Gets the layout associated with a #PangoLayoutIter.
2360 // RETURNS: the layout associated with @iter.
2361 Layout* get_layout() {
2362 return pango_layout_iter_get_layout(&this);
2365 // Obtains the extents of the #PangoLayout being iterated
2366 // over. @ink_rect or @logical_rect can be %NULL if you
2367 // aren't interested in them.
2368 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2369 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2370 void get_layout_extents(Rectangle* ink_rect, Rectangle* logical_rect) {
2371 pango_layout_iter_get_layout_extents(&this, ink_rect, logical_rect);
2374 // Gets the current line.
2375 // Use the faster pango_layout_iter_get_line_readonly() if you do not plan
2376 // to modify the contents of the line (glyphs, glyph widths, etc.).
2377 // RETURNS: the current line.
2378 LayoutLine* /*new*/ get_line() {
2379 return pango_layout_iter_get_line(&this);
2382 // Obtains the extents of the current line. @ink_rect or @logical_rect
2383 // can be %NULL if you aren't interested in them. Extents are in layout
2384 // coordinates (origin is the top-left corner of the entire
2385 // #PangoLayout). Thus the extents returned by this function will be
2386 // the same width/height but not at the same x/y as the extents
2387 // returned from pango_layout_line_get_extents().
2388 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2389 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2390 void get_line_extents(Rectangle* ink_rect, Rectangle* logical_rect) {
2391 pango_layout_iter_get_line_extents(&this, ink_rect, logical_rect);
2394 // Gets the current line for read-only access.
2395 // This is a faster alternative to pango_layout_iter_get_line(),
2396 // but the user is not expected
2397 // to modify the contents of the line (glyphs, glyph widths, etc.).
2398 // RETURNS: the current line, that should not be modified.
2399 LayoutLine* /*new*/ get_line_readonly() {
2400 return pango_layout_iter_get_line_readonly(&this);
2403 // Divides the vertical space in the #PangoLayout being iterated over
2404 // between the lines in the layout, and returns the space belonging to
2405 // the current line. A line's range includes the line's logical
2406 // extents, plus half of the spacing above and below the line, if
2407 // pango_layout_set_spacing() has been called to set layout spacing.
2408 // The Y positions are in layout coordinates (origin at top left of the
2409 // entire layout).
2410 // <y0_>: start of line
2411 // <y1_>: end of line
2412 void get_line_yrange(int* y0_, int* y1_) {
2413 pango_layout_iter_get_line_yrange(&this, y0_, y1_);
2416 // Unintrospectable method: get_run() / pango_layout_iter_get_run()
2417 // Gets the current run. When iterating by run, at the end of each
2418 // line, there's a position with a %NULL run, so this function can return
2419 // %NULL. The %NULL run at the end of each line ensures that all lines have
2420 // at least one run, even lines consisting of only a newline.
2421 // Use the faster pango_layout_iter_get_run_readonly() if you do not plan
2422 // to modify the contents of the run (glyphs, glyph widths, etc.).
2423 // RETURNS: the current run.
2424 LayoutRun* get_run() {
2425 return pango_layout_iter_get_run(&this);
2428 // Gets the extents of the current run in layout coordinates
2429 // (origin is the top left of the entire layout).
2430 // <ink_rect>: rectangle to fill with ink extents, or %NULL
2431 // <logical_rect>: rectangle to fill with logical extents, or %NULL
2432 void get_run_extents(Rectangle* ink_rect, Rectangle* logical_rect) {
2433 pango_layout_iter_get_run_extents(&this, ink_rect, logical_rect);
2436 // Unintrospectable method: get_run_readonly() / pango_layout_iter_get_run_readonly()
2437 // Gets the current run. When iterating by run, at the end of each
2438 // line, there's a position with a %NULL run, so this function can return
2439 // %NULL. The %NULL run at the end of each line ensures that all lines have
2440 // at least one run, even lines consisting of only a newline.
2441 // This is a faster alternative to pango_layout_iter_get_run(),
2442 // but the user is not expected
2443 // to modify the contents of the run (glyphs, glyph widths, etc.).
2444 // RETURNS: the current run, that should not be modified.
2445 LayoutRun* get_run_readonly() {
2446 return pango_layout_iter_get_run_readonly(&this);
2449 // Moves @iter forward to the next character in visual order. If @iter was already at
2450 // the end of the layout, returns %FALSE.
2451 // RETURNS: whether motion was possible.
2452 int next_char() {
2453 return pango_layout_iter_next_char(&this);
2456 // Moves @iter forward to the next cluster in visual order. If @iter
2457 // was already at the end of the layout, returns %FALSE.
2458 // RETURNS: whether motion was possible.
2459 int next_cluster() {
2460 return pango_layout_iter_next_cluster(&this);
2463 // Moves @iter forward to the start of the next line. If @iter is
2464 // already on the last line, returns %FALSE.
2465 // RETURNS: whether motion was possible.
2466 int next_line() {
2467 return pango_layout_iter_next_line(&this);
2470 // Moves @iter forward to the next run in visual order. If @iter was
2471 // already at the end of the layout, returns %FALSE.
2472 // RETURNS: whether motion was possible.
2473 int next_run() {
2474 return pango_layout_iter_next_run(&this);
2478 struct LayoutLine {
2479 Layout* layout;
2480 int start_index, length;
2481 GLib2.SList* runs;
2482 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2483 uint, "is_paragraph_start", 1,
2484 uint, "resolved_dir", 3,
2485 uint, "__dummy32A", 28));
2488 // Computes the logical and ink extents of a layout line. See
2489 // pango_font_get_glyph_extents() for details about the interpretation
2490 // of the rectangles.
2491 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn, or %NULL
2492 // <logical_rect>: rectangle used to store the logical extents of the glyph string, or %NULL
2493 void get_extents(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
2494 pango_layout_line_get_extents(&this, ink_rect, logical_rect);
2497 // Computes the logical and ink extents of @layout_line in device units.
2498 // This function just calls pango_layout_line_get_extents() followed by
2499 // two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect
2500 // such that the rounded rectangles fully contain the unrounded one (that is,
2501 // passes them as first argument to pango_extents_to_pixels()).
2502 // <ink_rect>: rectangle used to store the extents of the glyph string as drawn, or %NULL
2503 // <logical_rect>: rectangle used to store the logical extents of the glyph string, or %NULL
2504 void get_pixel_extents(/*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect) {
2505 pango_layout_line_get_pixel_extents(&this, ink_rect, logical_rect);
2508 // Gets a list of visual ranges corresponding to a given logical range.
2509 // This list is not necessarily minimal - there may be consecutive
2510 // ranges which are adjacent. The ranges will be sorted from left to
2511 // right. The ranges are with respect to the left edge of the entire
2512 // layout, not with respect to the line.
2513 // <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.
2514 // <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.
2515 // <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.
2516 // <n_ranges>: The number of ranges stored in @ranges.
2517 void get_x_ranges(int start_index, int end_index, /*out*/ int** ranges, /*out*/ int* n_ranges) {
2518 pango_layout_line_get_x_ranges(&this, start_index, end_index, ranges, n_ranges);
2521 // Converts an index within a line to a X position.
2522 // <index_>: byte offset of a grapheme within the layout
2523 // <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.
2524 // <x_pos>: location to store the x_offset (in Pango unit)
2525 void index_to_x(int index_, int trailing, /*out*/ int* x_pos) {
2526 pango_layout_line_index_to_x(&this, index_, trailing, x_pos);
2529 // Increase the reference count of a #PangoLayoutLine by one.
2530 // RETURNS: the line passed in.
2531 LayoutLine* /*new*/ ref_() {
2532 return pango_layout_line_ref(&this);
2535 // Decrease the reference count of a #PangoLayoutLine by one.
2536 // If the result is zero, the line and all associated memory
2537 // will be freed.
2538 void unref() {
2539 pango_layout_line_unref(&this);
2542 // Converts from x offset to the byte index of the corresponding
2543 // character within the text of the layout. If @x_pos is outside the line,
2544 // in the line. This determination is based on the resolved direction
2545 // of the paragraph; for example, if the resolved direction is
2546 // right-to-left, then an X position to the right of the line (after it)
2547 // results in 0 being stored in @index_ and @trailing. An X position to the
2548 // left of the line results in @index_ pointing to the (logical) last
2549 // grapheme in the line and @trailing being set to the number of characters
2550 // in that grapheme. The reverse is true for a left-to-right line.
2551 // RETURNS: %FALSE if @x_pos was outside the line, %TRUE if inside
2552 // <x_pos>: the X offset (in Pango units) from the left edge of the line.
2553 // <index_>: location to store calculated byte index for the grapheme in which the user clicked.
2554 // <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.
2555 int x_to_index(int x_pos, /*out*/ int* index_, /*out*/ int* trailing) {
2556 return pango_layout_line_x_to_index(&this, x_pos, index_, trailing);
2560 struct LogAttr {
2561 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2562 uint, "is_line_break", 1,
2563 uint, "is_mandatory_break", 1,
2564 uint, "is_char_break", 1,
2565 uint, "is_white", 1,
2566 uint, "is_cursor_position", 1,
2567 uint, "is_word_start", 1,
2568 uint, "is_word_end", 1,
2569 uint, "is_sentence_boundary", 1,
2570 uint, "is_sentence_start", 1,
2571 uint, "is_sentence_end", 1,
2572 uint, "backspace_deletes_character", 1,
2573 uint, "is_expandable_space", 1,
2574 uint, "is_word_boundary", 1,
2575 uint, "__dummy32A", 19));
2579 // A structure specifying a transformation between user-space
2580 // coordinates and device coordinates. The transformation
2581 // is given by
2582 // <programlisting>
2583 // x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0;
2584 // y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;
2585 // </programlisting>
2586 struct Matrix /* Version 1.6 */ {
2587 double xx, xy, yx, yy, x0, y0;
2590 // Changes the transformation represented by @matrix to be the
2591 // transformation given by first applying transformation
2592 // given by @new_matrix then applying the original transformation.
2593 // <new_matrix>: a #PangoMatrix
2594 void concat(Matrix* new_matrix) {
2595 pango_matrix_concat(&this, new_matrix);
2598 // Copies a #PangoMatrix.
2599 // be freed with pango_matrix_free(), or %NULL if
2600 // RETURNS: the newly allocated #PangoMatrix, which should
2601 Matrix* /*new*/ copy() {
2602 return pango_matrix_copy(&this);
2604 // Free a #PangoMatrix created with pango_matrix_copy().
2605 void free() {
2606 pango_matrix_free(&this);
2609 // Returns the scale factor of a matrix on the height of the font.
2610 // That is, the scale factor in the direction perpendicular to the
2611 // vector that the X coordinate is mapped to.
2612 // or 1.0 if @matrix is %NULL.
2613 // RETURNS: the scale factor of @matrix on the height of the font,
2614 double get_font_scale_factor() {
2615 return pango_matrix_get_font_scale_factor(&this);
2618 // Changes the transformation represented by @matrix to be the
2619 // transformation given by first rotating by @degrees degrees
2620 // counter-clockwise then applying the original transformation.
2621 // <degrees>: degrees to rotate counter-clockwise
2622 void rotate(double degrees) {
2623 pango_matrix_rotate(&this, degrees);
2626 // Changes the transformation represented by @matrix to be the
2627 // transformation given by first scaling by @sx in the X direction
2628 // and @sy in the Y direction then applying the original
2629 // transformation.
2630 // <scale_x>: amount to scale by in X direction
2631 // <scale_y>: amount to scale by in Y direction
2632 void scale(double scale_x, double scale_y) {
2633 pango_matrix_scale(&this, scale_x, scale_y);
2636 // Transforms the distance vector (@dx,@dy) by @matrix. This is
2637 // similar to pango_matrix_transform_point() except that the translation
2638 // components of the transformation are ignored. The calculation of
2639 // the returned vector is as follows:
2640 // <programlisting>
2641 // dx2 = dx1 * xx + dy1 * xy;
2642 // dy2 = dx1 * yx + dy1 * yy;
2643 // </programlisting>
2644 // Affine transformations are position invariant, so the same vector
2645 // always transforms to the same vector. If (@x1,@y1) transforms
2646 // to (@x2,@y2) then (@x1+@dx1,@y1+@dy1) will transform to
2647 // (@x1+@dx2,@y1+@dy2) for all values of @x1 and @x2.
2648 // <dx>: in/out X component of a distance vector
2649 // <dy>: yn/out Y component of a distance vector
2650 void transform_distance(double* dx, double* dy) {
2651 pango_matrix_transform_distance(&this, dx, dy);
2654 // First transforms the @rect using @matrix, then calculates the bounding box
2655 // of the transformed rectangle. The rectangle should be in device units
2656 // (pixels).
2657 // This function is useful for example when you want to draw a rotated
2658 // should be and how much you should shift the layout when rendering.
2659 // For better accuracy, you should use pango_matrix_transform_rectangle() on
2660 // original rectangle in Pango units and convert to pixels afterward
2661 // using pango_extents_to_pixels()'s first argument.
2662 // <rect>: in/out bounding box in device units, or %NULL
2663 void transform_pixel_rectangle(Rectangle* rect) {
2664 pango_matrix_transform_pixel_rectangle(&this, rect);
2667 // Transforms the point (@x, @y) by @matrix.
2668 // <x>: in/out X position
2669 // <y>: in/out Y position
2670 void transform_point(double* x, double* y) {
2671 pango_matrix_transform_point(&this, x, y);
2674 // First transforms @rect using @matrix, then calculates the bounding box
2675 // of the transformed rectangle. The rectangle should be in Pango units.
2676 // This function is useful for example when you want to draw a rotated
2677 // should be and how much you should shift the layout when rendering.
2678 // If you have a rectangle in device units (pixels), use
2679 // pango_matrix_transform_pixel_rectangle().
2680 // If you have the rectangle in Pango units and want to convert to
2681 // transformed pixel bounding box, it is more accurate to transform it first
2682 // (using this function) and pass the result to pango_extents_to_pixels(),
2683 // first argument, for an inclusive rounded rectangle.
2684 // However, there are valid reasons that you may want to convert
2685 // to pixels first and then transform, for example when the transformed
2686 // coordinates may overflow in Pango units (large matrix translation for
2687 // example).
2688 // <rect>: in/out bounding box in Pango units, or %NULL
2689 void transform_rectangle(Rectangle* rect) {
2690 pango_matrix_transform_rectangle(&this, rect);
2693 // Changes the transformation represented by @matrix to be the
2694 // transformation given by first translating by (@tx, @ty)
2695 // then applying the original transformation.
2696 // <tx>: amount to translate in the X direction
2697 // <ty>: amount to translate in the Y direction
2698 void translate(double tx, double ty) {
2699 pango_matrix_translate(&this, tx, ty);
2703 enum RENDER_TYPE_NONE = "PangoRenderNone";
2704 struct Rectangle {
2705 int x, y, width, height;
2709 // #PangoRenderPart defines different items to render for such
2710 // purposes as setting colors.
2711 enum RenderPart /* Version 1.8 */ {
2712 FOREGROUND = 0,
2713 BACKGROUND = 1,
2714 UNDERLINE = 2,
2715 STRIKETHROUGH = 3
2718 // #PangoRenderer is a base class for objects that are used to
2719 // render Pango objects such as #PangoGlyphString and
2720 // #PangoLayout.
2721 struct Renderer /* : GObject.Object */ /* Version 1.8 */ {
2722 alias parent_instance this;
2723 alias parent_instance super_;
2724 alias parent_instance object;
2725 GObject2.Object parent_instance;
2726 private Underline underline;
2727 private int strikethrough;
2728 private int active_count;
2729 Matrix* matrix;
2730 private RendererPrivate* priv;
2733 // Does initial setup before rendering operations on @renderer.
2734 // pango_renderer_deactivate() should be called when done drawing.
2735 // Calls such as pango_renderer_draw_layout() automatically
2736 // activate the layout before drawing on it. Calls to
2737 // pango_renderer_activate() and pango_renderer_deactivate() can
2738 // be nested and the renderer will only be initialized and
2739 // deinitialized once.
2740 void activate() {
2741 pango_renderer_activate(&this);
2744 // Cleans up after rendering operations on @renderer. See
2745 // docs for pango_renderer_activate().
2746 void deactivate() {
2747 pango_renderer_deactivate(&this);
2750 // Draw a squiggly line that approximately covers the given rectangle
2751 // in the style of an underline used to indicate a spelling error.
2752 // (The width of the underline is rounded to an integer number
2753 // of up/down segments and the resulting rectangle is centered
2754 // in the original rectangle)
2755 // This should be called while @renderer is already active. Use
2756 // pango_renderer_activate() to activate a renderer.
2757 // <x>: X coordinate of underline, in Pango units in user coordinate system
2758 // <y>: Y coordinate of underline, in Pango units in user coordinate system
2759 // <width>: width of underline, in Pango units in user coordinate system
2760 // <height>: height of underline, in Pango units in user coordinate system
2761 void draw_error_underline(int x, int y, int width, int height) {
2762 pango_renderer_draw_error_underline(&this, x, y, width, height);
2765 // Draws a single glyph with coordinates in device space.
2766 // <font>: a #PangoFont
2767 // <glyph>: the glyph index of a single glyph
2768 // <x>: X coordinate of left edge of baseline of glyph
2769 // <y>: Y coordinate of left edge of baseline of glyph
2770 void draw_glyph(Font* font, Glyph glyph, double x, double y) {
2771 pango_renderer_draw_glyph(&this, font, glyph, x, y);
2774 // Draws the glyphs in @glyph_item with the specified #PangoRenderer,
2775 // embedding the text associated with the glyphs in the output if the
2776 // output format supports it (PDF for example).
2777 // Note that @text is the start of the text for layout, which is then
2778 // indexed by <literal>@glyph_item->item->offset</literal>.
2779 // If @text is %NULL, this simply calls pango_renderer_draw_glyphs().
2780 // The default implementation of this method simply falls back to
2781 // pango_renderer_draw_glyphs().
2782 // <text>: the UTF-8 text that @glyph_item refers to, or %NULL
2783 // <glyph_item>: a #PangoGlyphItem
2784 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2785 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2786 void draw_glyph_item(char* text, GlyphItem* glyph_item, int x, int y) {
2787 pango_renderer_draw_glyph_item(&this, text, glyph_item, x, y);
2790 // Draws the glyphs in @glyphs with the specified #PangoRenderer.
2791 // <font>: a #PangoFont
2792 // <glyphs>: a #PangoGlyphString
2793 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2794 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2795 void draw_glyphs(Font* font, GlyphString* glyphs, int x, int y) {
2796 pango_renderer_draw_glyphs(&this, font, glyphs, x, y);
2799 // Draws @layout with the specified #PangoRenderer.
2800 // <layout>: a #PangoLayout
2801 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2802 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2803 void draw_layout(Layout* layout, int x, int y) {
2804 pango_renderer_draw_layout(&this, layout, x, y);
2807 // Draws @line with the specified #PangoRenderer.
2808 // <line>: a #PangoLayoutLine
2809 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2810 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2811 void draw_layout_line(LayoutLine* line, int x, int y) {
2812 pango_renderer_draw_layout_line(&this, line, x, y);
2815 // Draws an axis-aligned rectangle in user space coordinates with the
2816 // specified #PangoRenderer.
2817 // This should be called while @renderer is already active. Use
2818 // pango_renderer_activate() to activate a renderer.
2819 // <part>: type of object this rectangle is part of
2820 // <x>: X position at which to draw rectangle, in user space coordinates in Pango units
2821 // <y>: Y position at which to draw rectangle, in user space coordinates in Pango units
2822 // <width>: width of rectangle in Pango units in user space coordinates
2823 // <height>: height of rectangle in Pango units in user space coordinates
2824 void draw_rectangle(RenderPart part, int x, int y, int width, int height) {
2825 pango_renderer_draw_rectangle(&this, part, x, y, width, height);
2828 // Draws a trapezoid with the parallel sides aligned with the X axis
2829 // using the given #PangoRenderer; coordinates are in device space.
2830 // <part>: type of object this trapezoid is part of
2831 // <y1_>: Y coordinate of top of trapezoid
2832 // <x11>: X coordinate of left end of top of trapezoid
2833 // <x21>: X coordinate of right end of top of trapezoid
2834 // <y2>: Y coordinate of bottom of trapezoid
2835 // <x12>: X coordinate of left end of bottom of trapezoid
2836 // <x22>: X coordinate of right end of bottom of trapezoid
2837 void draw_trapezoid(RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22) {
2838 pango_renderer_draw_trapezoid(&this, part, y1_, x11, x21, y2, x12, x22);
2841 // Gets the current rendering color for the specified part.
2842 // if it hasn't been set and should be inherited from the
2843 // environment.
2844 // RETURNS: the color for the specified part, or %NULL
2845 // <part>: the part to get the color for
2846 Color* /*new*/ get_color(RenderPart part) {
2847 return pango_renderer_get_color(&this, part);
2850 // Unintrospectable method: get_layout() / pango_renderer_get_layout()
2851 // Gets the layout currently being rendered using @renderer.
2852 // Calling this function only makes sense from inside a subclass's
2853 // methods, like in its draw_shape<!---->() for example.
2854 // The returned layout should not be modified while still being
2855 // rendered.
2856 // rendered using @renderer at this time.
2857 // RETURNS: the layout, or %NULL if no layout is being
2858 Layout* get_layout() {
2859 return pango_renderer_get_layout(&this);
2862 // Gets the layout line currently being rendered using @renderer.
2863 // Calling this function only makes sense from inside a subclass's
2864 // methods, like in its draw_shape<!---->() for example.
2865 // The returned layout line should not be modified while still being
2866 // rendered.
2867 // rendered using @renderer at this time.
2868 // RETURNS: the layout line, or %NULL if no layout line is being
2869 LayoutLine* /*new*/ get_layout_line() {
2870 return pango_renderer_get_layout_line(&this);
2873 // Gets the transformation matrix that will be applied when
2874 // rendering. See pango_renderer_set_matrix().
2875 // (which is the same as the identity matrix). The returned
2876 // matrix is owned by Pango and must not be modified or
2877 // freed.
2878 // RETURNS: the matrix, or %NULL if no matrix has been set
2879 Matrix* get_matrix() {
2880 return pango_renderer_get_matrix(&this);
2883 // Informs Pango that the way that the rendering is done
2884 // for @part has changed in a way that would prevent multiple
2885 // pieces being joined together into one drawing call. For
2886 // instance, if a subclass of #PangoRenderer was to add a stipple
2887 // option for drawing underlines, it needs to call
2888 // <informalexample><programlisting>
2889 // pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);
2890 // </programlisting></informalexample>
2891 // When the stipple changes or underlines with different stipples
2892 // might be joined together. Pango automatically calls this for
2893 // changes to colors. (See pango_renderer_set_color())
2894 // <part>: the part for which rendering has changed.
2895 void part_changed(RenderPart part) {
2896 pango_renderer_part_changed(&this, part);
2899 // Sets the color for part of the rendering.
2900 // <part>: the part to change the color of
2901 // <color>: the new color or %NULL to unset the current color
2902 void set_color(RenderPart part, Color* color) {
2903 pango_renderer_set_color(&this, part, color);
2906 // Sets the transformation matrix that will be applied when rendering.
2907 // <matrix>: a #PangoMatrix, or %NULL to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)
2908 void set_matrix(Matrix* matrix) {
2909 pango_renderer_set_matrix(&this, matrix);
2913 // Class structure for #PangoRenderer.
2914 struct RendererClass /* Version 1.8 */ {
2915 private GObject2.ObjectClass parent_class;
2917 // <font>: a #PangoFont
2918 // <glyphs>: a #PangoGlyphString
2919 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2920 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2921 extern (C) void function (Renderer* renderer, Font* font, GlyphString* glyphs, int x, int y) draw_glyphs;
2923 // <part>: type of object this rectangle is part of
2924 // <x>: X position at which to draw rectangle, in user space coordinates in Pango units
2925 // <y>: Y position at which to draw rectangle, in user space coordinates in Pango units
2926 // <width>: width of rectangle in Pango units in user space coordinates
2927 // <height>: height of rectangle in Pango units in user space coordinates
2928 extern (C) void function (Renderer* renderer, RenderPart part, int x, int y, int width, int height) draw_rectangle;
2930 // <x>: X coordinate of underline, in Pango units in user coordinate system
2931 // <y>: Y coordinate of underline, in Pango units in user coordinate system
2932 // <width>: width of underline, in Pango units in user coordinate system
2933 // <height>: height of underline, in Pango units in user coordinate system
2934 extern (C) void function (Renderer* renderer, int x, int y, int width, int height) draw_error_underline;
2935 extern (C) void function (Renderer* renderer, AttrShape* attr, int x, int y) draw_shape;
2937 // <part>: type of object this trapezoid is part of
2938 // <y1_>: Y coordinate of top of trapezoid
2939 // <x11>: X coordinate of left end of top of trapezoid
2940 // <x21>: X coordinate of right end of top of trapezoid
2941 // <y2>: Y coordinate of bottom of trapezoid
2942 // <x12>: X coordinate of left end of bottom of trapezoid
2943 // <x22>: X coordinate of right end of bottom of trapezoid
2944 extern (C) void function (Renderer* renderer, RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22) draw_trapezoid;
2946 // <font>: a #PangoFont
2947 // <glyph>: the glyph index of a single glyph
2948 // <x>: X coordinate of left edge of baseline of glyph
2949 // <y>: Y coordinate of left edge of baseline of glyph
2950 extern (C) void function (Renderer* renderer, Font* font, Glyph glyph, double x, double y) draw_glyph;
2951 // <part>: the part for which rendering has changed.
2952 extern (C) void function (Renderer* renderer, RenderPart part) part_changed;
2953 extern (C) void function (Renderer* renderer) begin;
2954 extern (C) void function (Renderer* renderer) end;
2955 extern (C) void function (Renderer* renderer, LayoutRun* run) prepare_run;
2957 // <text>: the UTF-8 text that @glyph_item refers to, or %NULL
2958 // <glyph_item>: a #PangoGlyphItem
2959 // <x>: X position of left edge of baseline, in user space coordinates in Pango units.
2960 // <y>: Y position of left edge of baseline, in user space coordinates in Pango units.
2961 extern (C) void function (Renderer* renderer, char* text, GlyphItem* glyph_item, int x, int y) draw_glyph_item;
2962 extern (C) void function () _pango_reserved2;
2963 extern (C) void function () _pango_reserved3;
2964 extern (C) void function () _pango_reserved4;
2967 struct RendererPrivate {
2970 enum int SCALE = 1024;
2971 enum Script {
2972 INVALID_CODE = -1,
2973 COMMON = 0,
2974 INHERITED = 1,
2975 ARABIC = 2,
2976 ARMENIAN = 3,
2977 BENGALI = 4,
2978 BOPOMOFO = 5,
2979 CHEROKEE = 6,
2980 COPTIC = 7,
2981 CYRILLIC = 8,
2982 DESERET = 9,
2983 DEVANAGARI = 10,
2984 ETHIOPIC = 11,
2985 GEORGIAN = 12,
2986 GOTHIC = 13,
2987 GREEK = 14,
2988 GUJARATI = 15,
2989 GURMUKHI = 16,
2990 HAN = 17,
2991 HANGUL = 18,
2992 HEBREW = 19,
2993 HIRAGANA = 20,
2994 KANNADA = 21,
2995 KATAKANA = 22,
2996 KHMER = 23,
2997 LAO = 24,
2998 LATIN = 25,
2999 MALAYALAM = 26,
3000 MONGOLIAN = 27,
3001 MYANMAR = 28,
3002 OGHAM = 29,
3003 OLD_ITALIC = 30,
3004 ORIYA = 31,
3005 RUNIC = 32,
3006 SINHALA = 33,
3007 SYRIAC = 34,
3008 TAMIL = 35,
3009 TELUGU = 36,
3010 THAANA = 37,
3011 THAI = 38,
3012 TIBETAN = 39,
3013 CANADIAN_ABORIGINAL = 40,
3014 YI = 41,
3015 TAGALOG = 42,
3016 HANUNOO = 43,
3017 BUHID = 44,
3018 TAGBANWA = 45,
3019 BRAILLE = 46,
3020 CYPRIOT = 47,
3021 LIMBU = 48,
3022 OSMANYA = 49,
3023 SHAVIAN = 50,
3024 LINEAR_B = 51,
3025 TAI_LE = 52,
3026 UGARITIC = 53,
3027 NEW_TAI_LUE = 54,
3028 BUGINESE = 55,
3029 GLAGOLITIC = 56,
3030 TIFINAGH = 57,
3031 SYLOTI_NAGRI = 58,
3032 OLD_PERSIAN = 59,
3033 KHAROSHTHI = 60,
3034 UNKNOWN = 61,
3035 BALINESE = 62,
3036 CUNEIFORM = 63,
3037 PHOENICIAN = 64,
3038 PHAGS_PA = 65,
3039 NKO = 66,
3040 KAYAH_LI = 67,
3041 LEPCHA = 68,
3042 REJANG = 69,
3043 SUNDANESE = 70,
3044 SAURASHTRA = 71,
3045 CHAM = 72,
3046 OL_CHIKI = 73,
3047 VAI = 74,
3048 CARIAN = 75,
3049 LYCIAN = 76,
3050 LYDIAN = 77
3053 // A #PangoScriptIter is used to iterate through a string
3054 // and identify ranges in different scripts.
3055 struct ScriptIter {
3056 // Frees a #PangoScriptIter created with pango_script_iter_new().
3057 void free() {
3058 pango_script_iter_free(&this);
3061 // Gets information about the range to which @iter currently points.
3062 // The range is the set of locations p where *start <= p < *end.
3063 // (That is, it doesn't include the character stored at *end)
3064 // <start>: location to store start position of the range, or %NULL
3065 // <end>: location to store end position of the range, or %NULL
3066 // <script>: location to store script for range, or %NULL
3067 void get_range(char** start, char** end, Script* script) {
3068 pango_script_iter_get_range(&this, start, end, script);
3071 // Advances a #PangoScriptIter to the next range. If @iter
3072 // is already at the end, it is left unchanged and %FALSE
3073 // is returned.
3074 // RETURNS: %TRUE if @iter was successfully advanced.
3075 int next() {
3076 return pango_script_iter_next(&this);
3080 enum Stretch {
3081 ULTRA_CONDENSED = 0,
3082 EXTRA_CONDENSED = 1,
3083 CONDENSED = 2,
3084 SEMI_CONDENSED = 3,
3085 NORMAL = 4,
3086 SEMI_EXPANDED = 5,
3087 EXPANDED = 6,
3088 EXTRA_EXPANDED = 7,
3089 ULTRA_EXPANDED = 8
3091 // An enumeration specifying the various slant styles possible for a font.
3092 enum Style {
3093 NORMAL = 0,
3094 OBLIQUE = 1,
3095 ITALIC = 2
3097 enum TabAlign {
3098 LEFT = 0
3100 struct TabArray {
3102 // Creates an array of @initial_size tab stops. Tab stops are specified in
3103 // pixel units if @positions_in_pixels is %TRUE, otherwise in Pango
3104 // units. All stops are initially at position 0.
3105 // be freed with pango_tab_array_free().
3106 // RETURNS: the newly allocated #PangoTabArray, which should
3107 // <initial_size>: Initial number of tab stops to allocate, can be 0
3108 // <positions_in_pixels>: whether positions are in pixel units
3109 static TabArray* /*new*/ new_(int initial_size, int positions_in_pixels) {
3110 return pango_tab_array_new(initial_size, positions_in_pixels);
3113 // Unintrospectable constructor: new_with_positions() / pango_tab_array_new_with_positions()
3114 // This is a convenience function that creates a #PangoTabArray
3115 // and allows you to specify the alignment and position of each
3116 // tab stop. You <emphasis>must</emphasis> provide an alignment
3117 // and position for @size tab stops.
3118 // be freed with pango_tab_array_free().
3119 // RETURNS: the newly allocated #PangoTabArray, which should
3120 // <size>: number of tab stops in the array
3121 // <positions_in_pixels>: whether positions are in pixel units
3122 // <first_alignment>: alignment of first tab stop
3123 // <first_position>: position of first tab stop
3124 alias pango_tab_array_new_with_positions new_with_positions; // Variadic
3126 // Copies a #PangoTabArray
3127 // be freed with pango_tab_array_free().
3128 // RETURNS: the newly allocated #PangoTabArray, which should
3129 TabArray* /*new*/ copy() {
3130 return pango_tab_array_copy(&this);
3132 // Frees a tab array and associated resources.
3133 void free() {
3134 pango_tab_array_free(&this);
3137 // Returns %TRUE if the tab positions are in pixels, %FALSE if they are
3138 // in Pango units.
3139 // RETURNS: whether positions are in pixels.
3140 int get_positions_in_pixels() {
3141 return pango_tab_array_get_positions_in_pixels(&this);
3144 // Gets the number of tab stops in @tab_array.
3145 // RETURNS: the number of tab stops in the array.
3146 int get_size() {
3147 return pango_tab_array_get_size(&this);
3150 // Gets the alignment and position of a tab stop.
3151 // <tab_index>: tab stop index
3152 // <alignment>: location to store alignment, or %NULL
3153 // <location>: location to store tab position, or %NULL
3154 void get_tab(int tab_index, TabAlign* alignment, int* location) {
3155 pango_tab_array_get_tab(&this, tab_index, alignment, location);
3158 // If non-%NULL, @alignments and @locations are filled with allocated
3159 // arrays of length pango_tab_array_get_size(). You must free the
3160 // returned array.
3161 // <alignments>: location to store an array of tab stop alignments, or %NULL
3162 // <locations>: location to store an array of tab positions, or %NULL
3163 void get_tabs(TabAlign** alignments, int** locations) {
3164 pango_tab_array_get_tabs(&this, alignments, locations);
3167 // Resizes a tab array. You must subsequently initialize any tabs that
3168 // were added as a result of growing the array.
3169 // <new_size>: new size of the array
3170 void resize(int new_size) {
3171 pango_tab_array_resize(&this, new_size);
3174 // Sets the alignment and location of a tab stop.
3175 // implementation.
3176 // <tab_index>: the index of a tab stop
3177 // <alignment>: tab alignment
3178 // <location>: tab location in Pango units
3179 void set_tab(int tab_index, TabAlign alignment, int location) {
3180 pango_tab_array_set_tab(&this, tab_index, alignment, location);
3184 enum int UNKNOWN_GLYPH_HEIGHT = 14;
3185 enum int UNKNOWN_GLYPH_WIDTH = 10;
3186 enum Underline {
3187 NONE = 0,
3188 SINGLE = 1,
3189 DOUBLE = 2,
3190 LOW = 3,
3191 ERROR = 4
3193 enum Variant {
3194 NORMAL = 0,
3195 SMALL_CAPS = 1
3197 enum Weight {
3198 THIN = 100,
3199 ULTRALIGHT = 200,
3200 LIGHT = 300,
3201 BOOK = 380,
3202 NORMAL = 400,
3203 MEDIUM = 500,
3204 SEMIBOLD = 600,
3205 BOLD = 700,
3206 ULTRABOLD = 800,
3207 HEAVY = 900,
3208 ULTRAHEAVY = 1000
3210 enum WrapMode {
3211 WORD = 0,
3212 CHAR = 1,
3213 WORD_CHAR = 2
3215 struct _ScriptForLang {
3216 char[7] lang;
3217 Script[3] scripts;
3221 // Unintrospectable function: attr_background_new() / pango_attr_background_new()
3222 // Create a new background color attribute.
3223 // freed with pango_attribute_destroy().
3224 // RETURNS: the newly allocated #PangoAttribute, which should be
3225 // <red>: the red value (ranging from 0 to 65535)
3226 // <green>: the green value
3227 // <blue>: the blue value
3228 static Attribute* attr_background_new(ushort red, ushort green, ushort blue) {
3229 return pango_attr_background_new(red, green, blue);
3233 // Unintrospectable function: attr_fallback_new() / pango_attr_fallback_new()
3234 // Create a new font fallback attribute.
3235 // If fallback is disabled, characters will only be used from the
3236 // closest matching font on the system. No fallback will be done to
3237 // other fonts on the system that might contain the characters in the
3238 // text.
3239 // freed with pango_attribute_destroy().
3240 // RETURNS: the newly allocated #PangoAttribute, which should be
3241 // <enable_fallback>: %TRUE if we should fall back on other fonts for characters the active font is missing.
3242 static Attribute* attr_fallback_new(int enable_fallback) {
3243 return pango_attr_fallback_new(enable_fallback);
3247 // Unintrospectable function: attr_family_new() / pango_attr_family_new()
3248 // Create a new font family attribute.
3249 // freed with pango_attribute_destroy().
3250 // RETURNS: the newly allocated #PangoAttribute, which should be
3251 // <family>: the family or comma separated list of families
3252 static Attribute* attr_family_new(char* family) {
3253 return pango_attr_family_new(family);
3257 // Unintrospectable function: attr_font_desc_new() / pango_attr_font_desc_new()
3258 // Create a new font description attribute. This attribute
3259 // allows setting family, style, weight, variant, stretch,
3260 // and size simultaneously.
3261 // freed with pango_attribute_destroy().
3262 // RETURNS: the newly allocated #PangoAttribute, which should be
3263 // <desc>: the font description
3264 static Attribute* attr_font_desc_new(FontDescription* desc) {
3265 return pango_attr_font_desc_new(desc);
3269 // Unintrospectable function: attr_foreground_new() / pango_attr_foreground_new()
3270 // Create a new foreground color attribute.
3271 // freed with pango_attribute_destroy().
3272 // RETURNS: the newly allocated #PangoAttribute, which should be
3273 // <red>: the red value (ranging from 0 to 65535)
3274 // <green>: the green value
3275 // <blue>: the blue value
3276 static Attribute* attr_foreground_new(ushort red, ushort green, ushort blue) {
3277 return pango_attr_foreground_new(red, green, blue);
3281 // Unintrospectable function: attr_gravity_hint_new() / pango_attr_gravity_hint_new()
3282 // Create a new gravity hint attribute.
3283 // freed with pango_attribute_destroy().
3284 // RETURNS: the newly allocated #PangoAttribute, which should be
3285 // <hint>: the gravity hint value.
3286 static Attribute* attr_gravity_hint_new(GravityHint hint) {
3287 return pango_attr_gravity_hint_new(hint);
3291 // Unintrospectable function: attr_gravity_new() / pango_attr_gravity_new()
3292 // Create a new gravity attribute.
3293 // freed with pango_attribute_destroy().
3294 // RETURNS: the newly allocated #PangoAttribute, which should be
3295 // <gravity>: the gravity value; should not be %PANGO_GRAVITY_AUTO.
3296 static Attribute* attr_gravity_new(Gravity gravity) {
3297 return pango_attr_gravity_new(gravity);
3301 // Unintrospectable function: attr_language_new() / pango_attr_language_new()
3302 // Create a new language tag attribute.
3303 // freed with pango_attribute_destroy().
3304 // RETURNS: the newly allocated #PangoAttribute, which should be
3305 // <language>: language tag
3306 static Attribute* attr_language_new(Language* language) {
3307 return pango_attr_language_new(language);
3311 // Unintrospectable function: attr_letter_spacing_new() / pango_attr_letter_spacing_new()
3312 // Create a new letter-spacing attribute.
3313 // freed with pango_attribute_destroy().
3314 // RETURNS: the newly allocated #PangoAttribute, which should be
3315 // <letter_spacing>: amount of extra space to add between graphemes of the text, in Pango units.
3316 static Attribute* attr_letter_spacing_new(int letter_spacing) {
3317 return pango_attr_letter_spacing_new(letter_spacing);
3321 // Unintrospectable function: attr_rise_new() / pango_attr_rise_new()
3322 // Create a new baseline displacement attribute.
3323 // freed with pango_attribute_destroy().
3324 // RETURNS: the newly allocated #PangoAttribute, which should be
3325 // <rise>: the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.
3326 static Attribute* attr_rise_new(int rise) {
3327 return pango_attr_rise_new(rise);
3331 // Unintrospectable function: attr_scale_new() / pango_attr_scale_new()
3332 // Create a new font size scale attribute. The base font for the
3333 // affected text will have its size multiplied by @scale_factor.
3334 // freed with pango_attribute_destroy().
3335 // RETURNS: the newly allocated #PangoAttribute, which should be
3336 // <scale_factor>: factor to scale the font
3337 static Attribute* attr_scale_new(double scale_factor) {
3338 return pango_attr_scale_new(scale_factor);
3342 // Unintrospectable function: attr_shape_new() / pango_attr_shape_new()
3343 // Create a new shape attribute. A shape is used to impose a
3344 // particular ink and logical rectangle on the result of shaping a
3345 // particular glyph. This might be used, for instance, for
3346 // embedding a picture or a widget inside a #PangoLayout.
3347 // freed with pango_attribute_destroy().
3348 // RETURNS: the newly allocated #PangoAttribute, which should be
3349 // <ink_rect>: ink rectangle to assign to each character
3350 // <logical_rect>: logical rectangle to assign to each character
3351 static Attribute* attr_shape_new(Rectangle* ink_rect, Rectangle* logical_rect) {
3352 return pango_attr_shape_new(ink_rect, logical_rect);
3356 // Unintrospectable function: attr_shape_new_with_data() / pango_attr_shape_new_with_data()
3357 // Like pango_attr_shape_new(), but a user data pointer is also
3358 // provided; this pointer can be accessed when later
3359 // rendering the glyph.
3360 // freed with pango_attribute_destroy().
3361 // RETURNS: the newly allocated #PangoAttribute, which should be
3362 // <ink_rect>: ink rectangle to assign to each character
3363 // <logical_rect>: logical rectangle to assign to each character
3364 // <data>: user data pointer
3365 // <copy_func>: function to copy @data when the attribute is copied. If %NULL, @data is simply copied as a pointer.
3366 // <destroy_func>: function to free @data when the attribute is freed, or %NULL
3367 static Attribute* attr_shape_new_with_data(Rectangle* ink_rect, Rectangle* logical_rect, void* data, AttrDataCopyFunc copy_func, GLib2.DestroyNotify destroy_func) {
3368 return pango_attr_shape_new_with_data(ink_rect, logical_rect, data, copy_func, destroy_func);
3372 // Unintrospectable function: attr_size_new() / pango_attr_size_new()
3373 // Create a new font-size attribute in fractional points.
3374 // freed with pango_attribute_destroy().
3375 // RETURNS: the newly allocated #PangoAttribute, which should be
3376 // <size>: the font size, in %PANGO_SCALE<!-- -->ths of a point.
3377 static Attribute* attr_size_new(int size) {
3378 return pango_attr_size_new(size);
3382 // Unintrospectable function: attr_size_new_absolute() / pango_attr_size_new_absolute()
3383 // Create a new font-size attribute in device units.
3384 // freed with pango_attribute_destroy().
3385 // RETURNS: the newly allocated #PangoAttribute, which should be
3386 // <size>: the font size, in %PANGO_SCALE<!-- -->ths of a device unit.
3387 static Attribute* attr_size_new_absolute(int size) {
3388 return pango_attr_size_new_absolute(size);
3392 // Unintrospectable function: attr_stretch_new() / pango_attr_stretch_new()
3393 // Create a new font stretch attribute
3394 // freed with pango_attribute_destroy().
3395 // RETURNS: the newly allocated #PangoAttribute, which should be
3396 // <stretch>: the stretch
3397 static Attribute* attr_stretch_new(Stretch stretch) {
3398 return pango_attr_stretch_new(stretch);
3402 // Unintrospectable function: attr_strikethrough_color_new() / pango_attr_strikethrough_color_new()
3403 // Create a new strikethrough color attribute. This attribute
3404 // modifies the color of strikethrough lines. If not set, strikethrough
3405 // lines will use the foreground color.
3406 // freed with pango_attribute_destroy().
3407 // RETURNS: the newly allocated #PangoAttribute, which should be
3408 // <red>: the red value (ranging from 0 to 65535)
3409 // <green>: the green value
3410 // <blue>: the blue value
3411 static Attribute* attr_strikethrough_color_new(ushort red, ushort green, ushort blue) {
3412 return pango_attr_strikethrough_color_new(red, green, blue);
3416 // Unintrospectable function: attr_strikethrough_new() / pango_attr_strikethrough_new()
3417 // Create a new strike-through attribute.
3418 // freed with pango_attribute_destroy().
3419 // RETURNS: the newly allocated #PangoAttribute, which should be
3420 // <strikethrough>: %TRUE if the text should be struck-through.
3421 static Attribute* attr_strikethrough_new(int strikethrough) {
3422 return pango_attr_strikethrough_new(strikethrough);
3426 // Unintrospectable function: attr_style_new() / pango_attr_style_new()
3427 // Create a new font slant style attribute.
3428 // freed with pango_attribute_destroy().
3429 // RETURNS: the newly allocated #PangoAttribute, which should be
3430 // <style>: the slant style
3431 static Attribute* attr_style_new(Style style) {
3432 return pango_attr_style_new(style);
3436 // Fetches the attribute type name passed in when registering the type using
3437 // pango_attr_type_register().
3438 // The returned value is an interned string (see g_intern_string() for what
3439 // that means) that should not be modified or freed.
3440 // a built-in Pango attribute type or invalid.
3441 // RETURNS: the type ID name (which may be %NULL), or %NULL if @type is
3442 // <type>: an attribute type ID to fetch the name for
3443 static char* attr_type_get_name(AttrType type) {
3444 return pango_attr_type_get_name(type);
3448 // Allocate a new attribute type ID. The attribute type name can be accessed
3449 // later by using pango_attr_type_get_name().
3450 // RETURNS: the new type ID.
3451 // <name>: an identifier for the type
3452 static AttrType attr_type_register(char* name) {
3453 return pango_attr_type_register(name);
3457 // Unintrospectable function: attr_underline_color_new() / pango_attr_underline_color_new()
3458 // Create a new underline color attribute. This attribute
3459 // modifies the color of underlines. If not set, underlines
3460 // will use the foreground color.
3461 // freed with pango_attribute_destroy().
3462 // RETURNS: the newly allocated #PangoAttribute, which should be
3463 // <red>: the red value (ranging from 0 to 65535)
3464 // <green>: the green value
3465 // <blue>: the blue value
3466 static Attribute* attr_underline_color_new(ushort red, ushort green, ushort blue) {
3467 return pango_attr_underline_color_new(red, green, blue);
3471 // Unintrospectable function: attr_underline_new() / pango_attr_underline_new()
3472 // Create a new underline-style attribute.
3473 // freed with pango_attribute_destroy().
3474 // RETURNS: the newly allocated #PangoAttribute, which should be
3475 // <underline>: the underline style.
3476 static Attribute* attr_underline_new(Underline underline) {
3477 return pango_attr_underline_new(underline);
3481 // Unintrospectable function: attr_variant_new() / pango_attr_variant_new()
3482 // Create a new font variant attribute (normal or small caps)
3483 // freed with pango_attribute_destroy().
3484 // RETURNS: the newly allocated #PangoAttribute, which should be
3485 // <variant>: the variant
3486 static Attribute* attr_variant_new(Variant variant) {
3487 return pango_attr_variant_new(variant);
3491 // Unintrospectable function: attr_weight_new() / pango_attr_weight_new()
3492 // Create a new font weight attribute.
3493 // freed with pango_attribute_destroy().
3494 // RETURNS: the newly allocated #PangoAttribute, which should be
3495 // <weight>: the weight
3496 static Attribute* attr_weight_new(Weight weight) {
3497 return pango_attr_weight_new(weight);
3501 // Determines the normative bidirectional character type of a
3502 // character, as specified in the Unicode Character Database.
3503 // A simplified version of this function is available as
3504 // pango_unichar_get_direction().
3505 // Unicode bidirectional algorithm.
3506 // RETURNS: the bidirectional character type, as used in the
3507 // <ch>: a Unicode character
3508 static BidiType bidi_type_for_unichar(dchar ch) {
3509 return pango_bidi_type_for_unichar(ch);
3513 // Determines possible line, word, and character breaks
3514 // for a string of Unicode text with a single analysis. For most
3515 // purposes you may want to use pango_get_log_attrs().
3516 // <text>: the text to process
3517 // <length>: length of @text in bytes (may be -1 if @text is nul-terminated)
3518 // <analysis>: #PangoAnalysis structure from pango_itemize()
3519 // <attrs>: an array to store character information in
3520 // <attrs_len>: size of the array passed as @attrs
3521 static void break_(char* text, int length, Analysis* analysis, LogAttr* attrs, int attrs_len) {
3522 pango_break(text, length, analysis, attrs, attrs_len);
3526 // Unintrospectable function: coverage_from_bytes() / pango_coverage_from_bytes()
3527 // Convert data generated from pango_converage_to_bytes() back
3528 // to a #PangoCoverage
3529 // the data was invalid.
3530 // RETURNS: a newly allocated #PangoCoverage, or %NULL if
3531 // <bytes>: binary data representing a #PangoCoverage
3532 // <n_bytes>: the size of @bytes in bytes
3533 static Coverage* coverage_from_bytes(ubyte* bytes, int n_bytes) {
3534 return pango_coverage_from_bytes(bytes, n_bytes);
3538 // Unintrospectable function: coverage_new() / pango_coverage_new()
3539 // Create a new #PangoCoverage
3540 // initialized to %PANGO_COVERAGE_NONE
3541 // with a reference count of one, which
3542 // should be freed with pango_coverage_unref().
3543 // RETURNS: the newly allocated #PangoCoverage,
3544 static Coverage* coverage_new() {
3545 return pango_coverage_new();
3549 // Converts extents from Pango units to device units, dividing by the
3550 // %PANGO_SCALE factor and performing rounding.
3551 // The @inclusive rectangle is converted by flooring the x/y coordinates and extending
3552 // width/height, such that the final rectangle completely includes the original
3553 // rectangle.
3554 // The @nearest rectangle is converted by rounding the coordinates
3555 // of the rectangle to the nearest device unit (pixel).
3556 // rectangle to completely contain the original rectangle, pass it in as @inclusive.
3557 // If you want two touching-but-not-overlapping rectangles stay
3558 // touching-but-not-overlapping after rounding to device units, pass them in
3559 // as @nearest.
3560 // <inclusive>: rectangle to round to pixels inclusively, or %NULL.
3561 // <nearest>: rectangle to round to nearest pixels, or %NULL.
3562 static void extents_to_pixels(Rectangle* inclusive, Rectangle* nearest) {
3563 pango_extents_to_pixels(inclusive, nearest);
3567 // Searches a string the first character that has a strong
3568 // direction, according to the Unicode bidirectional algorithm.
3569 // If no such character is found, then %PANGO_DIRECTION_NEUTRAL is returned.
3570 // RETURNS: The direction corresponding to the first strong character.
3571 // <text>: the text to process
3572 // <length>: length of @text in bytes (may be -1 if @text is nul-terminated)
3573 static Direction find_base_dir(char* text, int length) {
3574 return pango_find_base_dir(text, length);
3578 // Locates a paragraph boundary in @text. A boundary is caused by
3579 // delimiter characters, such as a newline, carriage return, carriage
3580 // return-newline pair, or Unicode paragraph separator character. The
3581 // index of the run of delimiters is returned in
3582 // (index after all delimiters) is stored in @next_paragraph_start.
3583 // If no delimiters are found, both @paragraph_delimiter_index and
3584 // off the end).
3585 // <text>: UTF-8 text
3586 // <length>: length of @text in bytes, or -1 if nul-terminated
3587 // <paragraph_delimiter_index>: return location for index of delimiter
3588 // <next_paragraph_start>: return location for start of next paragraph
3589 static void find_paragraph_boundary(char* text, int length, int* paragraph_delimiter_index, int* next_paragraph_start) {
3590 pango_find_paragraph_boundary(text, length, paragraph_delimiter_index, next_paragraph_start);
3594 // Creates a new font description from a string representation in the
3595 // form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a
3596 // comma separated list of families optionally terminated by a comma,
3597 // STYLE_OPTIONS is a whitespace separated list of words where each WORD
3598 // describes one of style, variant, weight, stretch, or gravity, and SIZE
3599 // is a decimal number (size in points) or optionally followed by the
3600 // unit modifier "px" for absolute size. Any one of the options may
3601 // be absent. If FAMILY-LIST is absent, then the family_name field of
3602 // the resulting font description will be initialized to %NULL. If
3603 // STYLE-OPTIONS is missing, then all style options will be set to the
3604 // default values. If SIZE is missing, the size in the resulting font
3605 // description will be set to 0.
3606 // RETURNS: a new #PangoFontDescription.
3607 // <str>: string representation of a font description.
3608 static FontDescription* /*new*/ font_description_from_string(char* str) {
3609 return pango_font_description_from_string(str);
3613 // Computes a #PangoLogAttr for each character in @text. The @log_attrs
3614 // array must have one #PangoLogAttr for each position in @text; if
3615 // last position at the end of the text. @text should be an entire
3616 // paragraph; logical attributes can't be computed without context
3617 // (for example you need to see spaces on either side of a word to know
3618 // the word is a word).
3619 // <text>: text to process
3620 // <length>: length in bytes of @text
3621 // <level>: embedding level, or -1 if unknown
3622 // <language>: language tag
3623 // <log_attrs>: array with one #PangoLogAttr per character in @text, plus one extra, to be filled in
3624 // <attrs_len>: length of @log_attrs array
3625 static void get_log_attrs(char* text, int length, int level, Language* language, LogAttr* log_attrs, int attrs_len) {
3626 pango_get_log_attrs(text, length, level, language, log_attrs, attrs_len);
3630 // If @ch has the Unicode mirrored property and there is another Unicode
3631 // character that typically has a glyph that is the mirror image of @ch's
3632 // glyph, puts that character in the address pointed to by @mirrored_ch.
3633 // Use g_unichar_get_mirror_char() instead; the docs for that function
3634 // provide full details.
3635 // filled in, %FALSE otherwise
3636 // RETURNS: %TRUE if @ch has a mirrored character and @mirrored_ch is
3637 // <ch>: a Unicode character
3638 // <mirrored_ch>: location to store the mirrored character
3639 static int get_mirror_char(dchar ch, dchar* mirrored_ch) {
3640 return pango_get_mirror_char(ch, mirrored_ch);
3644 // Finds the gravity that best matches the rotation component
3645 // in a #PangoMatrix.
3646 // %PANGO_GRAVITY_AUTO, or %PANGO_GRAVITY_SOUTH if @matrix is %NULL
3647 // RETURNS: the gravity of @matrix, which will never be
3648 // <matrix>: a #PangoMatrix
3649 static Gravity gravity_get_for_matrix(Matrix* matrix) {
3650 return pango_gravity_get_for_matrix(matrix);
3654 // Based on the script, base gravity, and hint, returns actual gravity
3655 // to use in laying out a single #PangoItem.
3656 // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
3657 // preferred gravity of @script. To get the preferred gravity of a script,
3658 // pass %PANGO_GRAVITY_AUTO and %PANGO_GRAVITY_HINT_STRONG in.
3659 // with @script.
3660 // RETURNS: resolved gravity suitable to use for a run of text
3661 // <script>: #PangoScript to query
3662 // <base_gravity>: base gravity of the paragraph
3663 // <hint>: orientation hint
3664 static Gravity gravity_get_for_script(Script script, Gravity base_gravity, GravityHint hint) {
3665 return pango_gravity_get_for_script(script, base_gravity, hint);
3669 // Based on the script, East Asian width, base gravity, and hint,
3670 // returns actual gravity to use in laying out a single character
3671 // or #PangoItem.
3672 // This function is similar to pango_gravity_get_for_script() except
3673 // that this function makes a distinction between narrow/half-width and
3674 // wide/full-width characters also. Wide/full-width characters always
3675 // stand <emph>upright</emph>, that is, they always take the base gravity,
3676 // whereas narrow/full-width characters are always rotated in vertical
3677 // context.
3678 // If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
3679 // preferred gravity of @script.
3680 // with @script and @wide.
3681 // RETURNS: resolved gravity suitable to use for a run of text
3682 // <script>: #PangoScript to query
3683 // <wide>: %TRUE for wide characters as returned by g_unichar_iswide()
3684 // <base_gravity>: base gravity of the paragraph
3685 // <hint>: orientation hint
3686 static Gravity gravity_get_for_script_and_width(Script script, int wide, Gravity base_gravity, GravityHint hint) {
3687 return pango_gravity_get_for_script_and_width(script, wide, base_gravity, hint);
3691 // Converts a #PangoGravity value to its natural rotation in radians.
3692 // Note that pango_matrix_rotate() takes angle in degrees, not radians.
3693 // So, to call pango_matrix_rotate() with the output of this function
3694 // you should multiply it by (180. / G_PI).
3695 // RETURNS: the rotation value corresponding to @gravity.
3696 // <gravity>: gravity to query
3697 static double gravity_to_rotation(Gravity gravity) {
3698 return pango_gravity_to_rotation(gravity);
3702 // Checks @ch to see if it is a character that should not be
3703 // normally rendered on the screen. This includes all Unicode characters
3704 // with "ZERO WIDTH" in their name, as well as <firstterm>bidi</firstterm> formatting characters, and
3705 // a few other ones. This is totally different from g_unichar_iszerowidth()
3706 // and is at best misnamed.
3707 // RETURNS: %TRUE if @ch is a zero-width character, %FALSE otherwise
3708 // <ch>: a Unicode character
3709 static int is_zero_width(dchar ch) {
3710 return pango_is_zero_width(ch);
3714 // Unintrospectable function: itemize() / pango_itemize()
3715 // after @start_index.
3716 // This must be >= 0.
3717 // Breaks a piece of text into segments with consistent
3718 // directional level and shaping engine. Each byte of @text will
3719 // be contained in exactly one of the items in the returned list;
3720 // the generated list of items will be in logical order (the start
3721 // offsets of the items are ascending).
3722 // range before or containing @start_index; @cached_iter will be advanced to
3723 // the range covering the position just after @start_index + @length.
3724 // (i.e. if itemizing in a loop, just keep passing in the same @cached_iter).
3725 // RETURNS: a #GList of #PangoItem structures.
3726 // <context>: a structure holding information that affects
3727 // <text>: the text to itemize.
3728 // <start_index>: first byte in @text to process
3729 // <length>: the number of bytes (not characters) to process
3730 // <attrs>: the set of attributes that apply to @text.
3731 // <cached_iter>: Cached attribute iterator, or %NULL
3732 static GLib2.List* itemize(Context* context, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter) {
3733 return pango_itemize(context, text, start_index, length, attrs, cached_iter);
3737 // Unintrospectable function: itemize_with_base_dir() / pango_itemize_with_base_dir()
3738 // after @start_index.
3739 // This must be >= 0.
3740 // Like pango_itemize(), but the base direction to use when
3741 // computing bidirectional levels (see pango_context_set_base_dir ()),
3742 // is specified explicitly rather than gotten from the #PangoContext.
3743 // freed using pango_item_free() probably in combination with g_list_foreach(),
3744 // and the list itself using g_list_free().
3745 // RETURNS: a #GList of #PangoItem structures. The items should be
3746 // <context>: a structure holding information that affects
3747 // <base_dir>: base direction to use for bidirectional processing
3748 // <text>: the text to itemize.
3749 // <start_index>: first byte in @text to process
3750 // <length>: the number of bytes (not characters) to process
3751 // <attrs>: the set of attributes that apply to @text.
3752 // <cached_iter>: Cached attribute iterator, or %NULL
3753 static GLib2.List* itemize_with_base_dir(Context* context, Direction base_dir, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter) {
3754 return pango_itemize_with_base_dir(context, base_dir, text, start_index, length, attrs, cached_iter);
3758 // Take a RFC-3066 format language tag as a string and convert it to a
3759 // #PangoLanguage pointer that can be efficiently copied (copy the
3760 // pointer) and compared with other language tags (compare the
3761 // pointer.)
3762 // This function first canonicalizes the string by converting it to
3763 // lowercase, mapping '_' to '-', and stripping all characters other
3764 // than letters and '-'.
3765 // Use pango_language_get_default() if you want to get the #PangoLanguage for
3766 // the current locale of the process.
3767 // if @language was %NULL. The returned pointer will be valid
3768 // forever after, and should not be freed.
3769 // RETURNS: an opaque pointer to a #PangoLanguage structure, or %NULL
3770 // <language>: a string representing a language tag, or %NULL
3771 static Language* /*new*/ language_from_string(char* language) {
3772 return pango_language_from_string(language);
3776 // Returns the #PangoLanguage for the current locale of the process.
3777 // Note that this can change over the life of an application.
3778 // On Unix systems, this is the return value is derived from
3779 // <literal>setlocale(LC_CTYPE, NULL)</literal>, and the user can
3780 // affect this through the environment variables LC_ALL, LC_CTYPE or
3781 // LANG (checked in that order). The locale string typically is in
3782 // the form lang_COUNTRY, where lang is an ISO-639 language code, and
3783 // COUNTRY is an ISO-3166 country code. For instance, sv_FI for
3784 // Swedish as written in Finland or pt_BR for Portuguese as written in
3785 // Brazil.
3786 // On Windows, the C library does not use any such environment
3787 // variables, and setting them won't affect the behavior of functions
3788 // like ctime(). The user sets the locale through the Regional Options
3789 // in the Control Panel. The C library (in the setlocale() function)
3790 // does not use country and language codes, but country and language
3791 // names spelled out in English.
3792 // However, this function does check the above environment
3793 // variables, and does return a Unix-style locale string based on
3794 // either said environment variables or the thread's current locale.
3795 // Your application should call <literal>setlocale(LC_ALL, "");</literal>
3796 // for the user settings to take effect. Gtk+ does this in its initialization
3797 // functions automatically (by calling gtk_set_locale()).
3798 // See <literal>man setlocale</literal> for more details.
3799 // freed.
3800 // RETURNS: the default language as a #PangoLanguage, must not be
3801 static Language* /*new*/ language_get_default() {
3802 return pango_language_get_default();
3806 // This will return the bidirectional embedding levels of the input paragraph
3807 // as defined by the Unicode Bidirectional Algorithm available at:
3808 // http://www.unicode.org/reports/tr9/
3809 // If the input base direction is a weak direction, the direction of the
3810 // characters in the text will determine the final resolved direction.
3811 // character (not byte), that should be freed using g_free.
3812 // RETURNS: a newly allocated array of embedding levels, one item per
3813 // <text>: the text to itemize.
3814 // <length>: the number of bytes (not characters) to process, or -1 if @text is nul-terminated and the length should be calculated.
3815 // <pbase_dir>: input base direction, and output resolved direction.
3816 static ubyte* log2vis_get_embedding_levels(char* text, int length, Direction* pbase_dir) {
3817 return pango_log2vis_get_embedding_levels(text, length, pbase_dir);
3821 // Parses an enum type and stores the result in @value.
3822 // If @str does not match the nick name of any of the possible values for the
3823 // enum and is not an integer, %FALSE is returned, a warning is issued
3824 // if @warn is %TRUE, and a
3825 // string representing the list of possible values is stored in
3826 // "none/start/middle/end". If failed and @possible_values is not %NULL,
3827 // returned string should be freed using g_free().
3828 // RETURNS: %TRUE if @str was successfully parsed.
3829 // <type>: enum type to parse, eg. %PANGO_TYPE_ELLIPSIZE_MODE.
3830 // <str>: string to parse. May be %NULL.
3831 // <value>: integer to store the result in, or %NULL.
3832 // <warn>: if %TRUE, issue a g_warning() on bad input.
3833 // <possible_values>: place to store list of possible values on failure, or %NULL.
3834 static int parse_enum(Type type, char* str, int* value, int warn, char** possible_values) {
3835 return pango_parse_enum(type, str, value, warn, possible_values);
3839 // Parses marked-up text (see
3840 // <link linkend="PangoMarkupFormat">markup format</link>) to create
3841 // a plain-text string and an attribute list.
3842 // If @accel_marker is nonzero, the given character will mark the
3843 // character following it as an accelerator. For example, @accel_marker
3844 // might be an ampersand or underscore. All characters marked
3845 // as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
3846 // and the first character so marked will be returned in @accel_char.
3847 // Two @accel_marker characters following each other produce a single
3848 // literal @accel_marker character.
3849 // If any error happens, none of the output arguments are touched except
3850 // for @error.
3851 // RETURNS: %FALSE if @error is set, otherwise %TRUE
3852 // <markup_text>: markup to parse (see <link linkend="PangoMarkupFormat">markup format</link>)
3853 // <length>: length of @markup_text, or -1 if nul-terminated
3854 // <accel_marker>: character that precedes an accelerator, or 0 for none
3855 // <attr_list>: address of return location for a #PangoAttrList, or %NULL
3856 // <text>: address of return location for text with tags stripped, or %NULL
3857 // <accel_char>: address of return location for accelerator char, or %NULL
3858 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) {
3859 return pango_parse_markup(markup_text, length, accel_marker, attr_list, text, accel_char, error);
3863 // Parses a font stretch. The allowed values are
3864 // "ultra_condensed", "extra_condensed", "condensed",
3865 // "semi_condensed", "normal", "semi_expanded", "expanded",
3866 // "extra_expanded" and "ultra_expanded". Case variations are
3867 // ignored and the '_' characters may be omitted.
3868 // RETURNS: %TRUE if @str was successfully parsed.
3869 // <str>: a string to parse.
3870 // <stretch>: a #PangoStretch to store the result in.
3871 // <warn>: if %TRUE, issue a g_warning() on bad input.
3872 static int parse_stretch(char* str, Stretch* stretch, int warn) {
3873 return pango_parse_stretch(str, stretch, warn);
3877 // Parses a font style. The allowed values are "normal",
3878 // "italic" and "oblique", case variations being
3879 // ignored.
3880 // RETURNS: %TRUE if @str was successfully parsed.
3881 // <str>: a string to parse.
3882 // <style>: a #PangoStyle to store the result in.
3883 // <warn>: if %TRUE, issue a g_warning() on bad input.
3884 static int parse_style(char* str, Style* style, int warn) {
3885 return pango_parse_style(str, style, warn);
3889 // Parses a font variant. The allowed values are "normal"
3890 // and "smallcaps" or "small_caps", case variations being
3891 // ignored.
3892 // RETURNS: %TRUE if @str was successfully parsed.
3893 // <str>: a string to parse.
3894 // <variant>: a #PangoVariant to store the result in.
3895 // <warn>: if %TRUE, issue a g_warning() on bad input.
3896 static int parse_variant(char* str, Variant* variant, int warn) {
3897 return pango_parse_variant(str, variant, warn);
3901 // Parses a font weight. The allowed values are "heavy",
3902 // "ultrabold", "bold", "normal", "light", "ultraleight"
3903 // and integers. Case variations are ignored.
3904 // RETURNS: %TRUE if @str was successfully parsed.
3905 // <str>: a string to parse.
3906 // <weight>: a #PangoWeight to store the result in.
3907 // <warn>: if %TRUE, issue a g_warning() on bad input.
3908 static int parse_weight(char* str, Weight* weight, int warn) {
3909 return pango_parse_weight(str, weight, warn);
3913 // Quantizes the thickness and position of a line, typically an
3914 // underline or strikethrough, to whole device pixels, that is integer
3915 // multiples of %PANGO_SCALE. The purpose of this function is to avoid
3916 // such lines looking blurry.
3917 // Care is taken to make sure @thickness is at least one pixel when this
3918 // function returns, but returned @position may become zero as a result
3919 // of rounding.
3920 // <thickness>: pointer to the thickness of a line, in Pango units
3921 // <position>: corresponding position
3922 static void quantize_line_geometry(int* thickness, int* position) {
3923 pango_quantize_line_geometry(thickness, position);
3927 // Reads an entire line from a file into a buffer. Lines may
3928 // be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter
3929 // is not written into the buffer. Text after a '#' character is treated as
3930 // a comment and skipped. '\' can be used to escape a # character.
3931 // '\' proceeding a line delimiter combines adjacent lines. A '\' proceeding
3932 // any other character is ignored and written into the output buffer
3933 // unmodified.
3934 // the number of lines read (this is useful for maintaining
3935 // a line number counter which doesn't combine lines with '\')
3936 // RETURNS: 0 if the stream was already at an %EOF character, otherwise
3937 // <stream>: a stdio stream
3938 // <str>: #GString buffer into which to write the result
3939 static int read_line(FILE* stream, GLib2.String* str) {
3940 return pango_read_line(stream, str);
3944 // Unintrospectable function: reorder_items() / pango_reorder_items()
3945 // From a list of items in logical order and the associated
3946 // directional levels, produce a list in visual order.
3947 // The original list is unmodified.
3948 // (Please open a bug if you use this function.
3949 // It is not a particularly convenient interface, and the code
3950 // is duplicated elsewhere in Pango for that reason.)
3951 // RETURNS: a #GList of #PangoItem structures in visual order.
3952 // <logical_items>: a #GList of #PangoItem in logical order.
3953 static GLib2.List* reorder_items(GLib2.List* logical_items) {
3954 return pango_reorder_items(logical_items);
3958 // Scans an integer.
3959 // Leading white space is skipped.
3960 // RETURNS: %FALSE if a parse error occurred.
3961 // <pos>: in/out string position
3962 // <out>: an int into which to write the result
3963 static int scan_int(char** pos, int* out_) {
3964 return pango_scan_int(pos, out_);
3968 // Scans a string into a #GString buffer. The string may either
3969 // be a sequence of non-white-space characters, or a quoted
3970 // string with '"'. Instead a quoted string, '\"' represents
3971 // a literal quote. Leading white space outside of quotes is skipped.
3972 // RETURNS: %FALSE if a parse error occurred.
3973 // <pos>: in/out string position
3974 // <out>: a #GString into which to write the result
3975 static int scan_string(char** pos, GLib2.String* out_) {
3976 return pango_scan_string(pos, out_);
3980 // Scans a word into a #GString buffer. A word consists
3981 // of [A-Za-z_] followed by zero or more [A-Za-z_0-9]
3982 // Leading white space is skipped.
3983 // RETURNS: %FALSE if a parse error occurred.
3984 // <pos>: in/out string position
3985 // <out>: a #GString into which to write the result
3986 static int scan_word(char** pos, GLib2.String* out_) {
3987 return pango_scan_word(pos, out_);
3991 // Looks up the #PangoScript for a particular character (as defined by
3992 // Unicode Standard Annex #24). No check is made for @ch being a
3993 // valid Unicode character; if you pass in invalid character, the
3994 // result is undefined.
3995 // As of Pango 1.18, this function simply returns the return value of
3996 // g_unichar_get_script().
3997 // RETURNS: the #PangoScript for the character.
3998 // <ch>: a Unicode character
3999 static Script script_for_unichar(dchar ch) {
4000 return pango_script_for_unichar(ch);
4004 // Given a script, finds a language tag that is reasonably
4005 // representative of that script. This will usually be the
4006 // most widely spoken or used language written in that script:
4007 // for instance, the sample language for %PANGO_SCRIPT_CYRILLIC
4008 // is <literal>ru</literal> (Russian), the sample language
4009 // for %PANGO_SCRIPT_ARABIC is <literal>ar</literal>.
4010 // For some
4011 // scripts, no sample language will be returned because there
4012 // is no language that is sufficiently representative. The best
4013 // example of this is %PANGO_SCRIPT_HAN, where various different
4014 // variants of written Chinese, Japanese, and Korean all use
4015 // significantly different sets of Han characters and forms
4016 // of shared characters. No sample language can be provided
4017 // for many historical scripts as well.
4018 // As of 1.18, this function checks the environment variables
4019 // PANGO_LANGUAGE and LANGUAGE (checked in that order) first.
4020 // If one of them is set, it is parsed as a list of language tags
4021 // separated by colons or other separators. This function
4022 // will return the first language in the parsed list that Pango
4023 // believes may use @script for writing. This last predicate
4024 // is tested using pango_language_includes_script(). This can
4025 // be used to control Pango's font selection for non-primary
4026 // languages. For example, a PANGO_LANGUAGE enviroment variable
4027 // set to "en:fa" makes Pango choose fonts suitable for Persian (fa)
4028 // instead of Arabic (ar) when a segment of Arabic text is found
4029 // in an otherwise non-Arabic text. The same trick can be used to
4030 // choose a default language for %PANGO_SCRIPT_HAN when setting
4031 // context language is not feasible.
4032 // of the script, or %NULL if no such language exists.
4033 // RETURNS: a #PangoLanguage that is representative
4034 // <script>: a #PangoScript
4035 static Language* /*new*/ script_get_sample_language(Script script) {
4036 return pango_script_get_sample_language(script);
4040 // Unintrospectable function: script_iter_new() / pango_script_iter_new()
4041 // Create a new #PangoScriptIter, used to break a string of
4042 // Unicode into runs by text. No copy is made of @text, so
4043 // the caller needs to make sure it remains valid until
4044 // the iterator is freed with pango_script_iter_free().
4045 // to point at the first range in the text, which should be
4046 // freed with pango_script_iter_free(). If the string is
4047 // empty, it will point at an empty range.
4048 // RETURNS: the new script iterator, initialized
4049 // <text>: a UTF-8 string
4050 // <length>: length of @text, or -1 if @text is nul-terminated.
4051 static ScriptIter* script_iter_new(char* text, int length) {
4052 return pango_script_iter_new(text, length);
4056 // Given a segment of text and the corresponding
4057 // #PangoAnalysis structure returned from pango_itemize(),
4058 // convert the characters into glyphs. You may also pass
4059 // in only a substring of the item from pango_itemize().
4060 // <text>: the text to process
4061 // <length>: the length (in bytes) of @text
4062 // <analysis>: #PangoAnalysis structure from pango_itemize()
4063 // <glyphs>: glyph string in which to store results
4064 static void shape(char* text, int length, Analysis* analysis, GlyphString* glyphs) {
4065 pango_shape(text, length, analysis, glyphs);
4069 // Skips 0 or more characters of white space.
4070 // the position at a '\0' character.
4071 // RETURNS: %FALSE if skipping the white space leaves
4072 // <pos>: in/out string position
4073 static int skip_space(char** pos) {
4074 return pango_skip_space(pos);
4078 // Unintrospectable function: split_file_list() / pango_split_file_list()
4079 // Splits a %G_SEARCHPATH_SEPARATOR-separated list of files, stripping
4080 // white space and substituting ~/ with $HOME/.
4081 // RETURNS: a list of strings to be freed with g_strfreev()
4082 // <str>: a %G_SEARCHPATH_SEPARATOR separated list of filenames
4083 static char** split_file_list(char* str) {
4084 return pango_split_file_list(str);
4088 // Trims leading and trailing whitespace from a string.
4089 // RETURNS: A newly-allocated string that must be freed with g_free()
4090 // <str>: a string
4091 static char* /*new*/ trim_string(char* str) {
4092 return pango_trim_string(str);
4096 // Determines the inherent direction of a character; either
4097 // %PANGO_DIRECTION_LTR, %PANGO_DIRECTION_RTL, or
4098 // %PANGO_DIRECTION_NEUTRAL.
4099 // This function is useful to categorize characters into left-to-right
4100 // letters, right-to-left letters, and everything else. If full
4101 // Unicode bidirectional type of a character is needed,
4102 // pango_bidi_type_for_gunichar() can be used instead.
4103 // RETURNS: the direction of the character.
4104 // <ch>: a Unicode character
4105 static Direction unichar_direction(dchar ch) {
4106 return pango_unichar_direction(ch);
4110 // it by %PANGO_SCALE and rounds to nearest integer.
4111 // RETURNS: the value in Pango units.
4112 // <d>: double floating-point value
4113 static int units_from_double(double d) {
4114 return pango_units_from_double(d);
4118 // it by %PANGO_SCALE.
4119 // RETURNS: the double value.
4120 // <i>: value in Pango units
4121 static double units_to_double(int i) {
4122 return pango_units_to_double(i);
4126 // This is similar to the macro %PANGO_VERSION except that
4127 // it returns the encoded version of Pango available at run-time,
4128 // as opposed to the version available at compile-time.
4129 // A version number can be encoded into an integer using
4130 // PANGO_VERSION_ENCODE().
4131 // available at run time.
4132 // RETURNS: The encoded version of Pango library
4133 static int version_() {
4134 return pango_version();
4138 // Checks that the Pango library in use is compatible with the
4139 // given version. Generally you would pass in the constants
4140 // %PANGO_VERSION_MAJOR, %PANGO_VERSION_MINOR, %PANGO_VERSION_MICRO
4141 // as the three arguments to this function; that produces
4142 // a check that the library in use at run-time is compatible with
4143 // the version of Pango the application or module was compiled against.
4144 // of the running library is newer than the version
4145 // the running library must be binary compatible with the
4146 // version @required_major.required_minor.@required_micro
4147 // (same major version.)
4148 // For compile-time version checking use PANGO_VERSION_CHECK().
4149 // given version, or a string describing the version mismatch.
4150 // The returned string is owned by Pango and should not be modified
4151 // or freed.
4152 // RETURNS: %NULL if the Pango library is compatible with the
4153 // <required_major>: the required major version.
4154 // <required_minor>: the required minor version.
4155 // <required_micro>: the required major version.
4156 static char* version_check(int required_major, int required_minor, int required_micro) {
4157 return pango_version_check(required_major, required_minor, required_micro);
4161 // This is similar to the macro %PANGO_VERSION_STRING except that
4162 // it returns the version of Pango available at run-time, as opposed to
4163 // the version available at compile-time.
4164 // available at run time.
4165 // The returned string is owned by Pango and should not be modified
4166 // or freed.
4167 // RETURNS: A string containing the version of Pango library
4168 static char* version_string() {
4169 return pango_version_string();
4173 // C prototypes:
4175 extern (C) {
4176 AttrIterator* pango_attr_iterator_copy(AttrIterator* this_);
4177 void pango_attr_iterator_destroy(AttrIterator* this_);
4178 Attribute* pango_attr_iterator_get(AttrIterator* this_, AttrType type);
4179 GLib2.SList* /*new*/ pango_attr_iterator_get_attrs(AttrIterator* this_);
4180 void pango_attr_iterator_get_font(AttrIterator* this_, FontDescription* desc, Language** language, GLib2.SList** extra_attrs);
4181 int pango_attr_iterator_next(AttrIterator* this_);
4182 void pango_attr_iterator_range(AttrIterator* this_, int* start, int* end);
4183 AttrList* /*new*/ pango_attr_list_new();
4184 void pango_attr_list_change(AttrList* this_, Attribute* attr);
4185 AttrList* /*new*/ pango_attr_list_copy(AttrList* this_);
4186 AttrList* /*new*/ pango_attr_list_filter(AttrList* this_, AttrFilterFunc func, void* data);
4187 AttrIterator* pango_attr_list_get_iterator(AttrList* this_);
4188 void pango_attr_list_insert(AttrList* this_, Attribute* attr);
4189 void pango_attr_list_insert_before(AttrList* this_, Attribute* attr);
4190 AttrList* /*new*/ pango_attr_list_ref(AttrList* this_);
4191 void pango_attr_list_splice(AttrList* this_, AttrList* other, int pos, int len);
4192 void pango_attr_list_unref(AttrList* this_);
4193 Attribute* pango_attribute_copy(Attribute* this_);
4194 void pango_attribute_destroy(Attribute* this_);
4195 int pango_attribute_equal(Attribute* this_, Attribute* attr2);
4196 void pango_attribute_init(Attribute* this_, AttrClass* klass);
4197 Color* /*new*/ pango_color_copy(Color* this_);
4198 void pango_color_free(Color* this_);
4199 int pango_color_parse(Color* this_, char* spec);
4200 char* /*new*/ pango_color_to_string(Color* this_);
4201 Context* /*new*/ pango_context_new();
4202 Direction pango_context_get_base_dir(Context* this_);
4203 Gravity pango_context_get_base_gravity(Context* this_);
4204 FontDescription* /*new*/ pango_context_get_font_description(Context* this_);
4205 FontMap* pango_context_get_font_map(Context* this_);
4206 Gravity pango_context_get_gravity(Context* this_);
4207 GravityHint pango_context_get_gravity_hint(Context* this_);
4208 Language* /*new*/ pango_context_get_language(Context* this_);
4209 Matrix* pango_context_get_matrix(Context* this_);
4210 FontMetrics* /*new*/ pango_context_get_metrics(Context* this_, FontDescription* desc, Language* language);
4211 void pango_context_list_families(Context* this_, FontFamily*** families, int* n_families);
4212 Font* pango_context_load_font(Context* this_, FontDescription* desc);
4213 Fontset* pango_context_load_fontset(Context* this_, FontDescription* desc, Language* language);
4214 void pango_context_set_base_dir(Context* this_, Direction direction);
4215 void pango_context_set_base_gravity(Context* this_, Gravity gravity);
4216 void pango_context_set_font_description(Context* this_, FontDescription* desc);
4217 void pango_context_set_font_map(Context* this_, FontMap* font_map);
4218 void pango_context_set_gravity_hint(Context* this_, GravityHint hint);
4219 void pango_context_set_language(Context* this_, Language* language);
4220 void pango_context_set_matrix(Context* this_, Matrix* matrix);
4221 Coverage* pango_coverage_copy(Coverage* this_);
4222 CoverageLevel pango_coverage_get(Coverage* this_, int index_);
4223 void pango_coverage_max(Coverage* this_, Coverage* other);
4224 Coverage* pango_coverage_ref(Coverage* this_);
4225 void pango_coverage_set(Coverage* this_, int index_, CoverageLevel level);
4226 void pango_coverage_to_bytes(Coverage* this_, ubyte** bytes, int* n_bytes);
4227 void pango_coverage_unref(Coverage* this_);
4228 void pango_font_descriptions_free(FontDescription** descs, int n_descs);
4229 FontDescription* /*new*/ pango_font_describe(Font* this_);
4230 FontDescription* /*new*/ pango_font_describe_with_absolute_size(Font* this_);
4231 EngineShape* pango_font_find_shaper(Font* this_, Language* language, uint ch);
4232 Coverage* pango_font_get_coverage(Font* this_, Language* language);
4233 FontMap* pango_font_get_font_map(Font* this_);
4234 void pango_font_get_glyph_extents(Font* this_, Glyph glyph, Rectangle* ink_rect, Rectangle* logical_rect);
4235 FontMetrics* /*new*/ pango_font_get_metrics(Font* this_, Language* language);
4236 FontDescription* /*new*/ pango_font_description_new();
4237 int pango_font_description_better_match(FontDescription* this_, FontDescription* old_match, FontDescription* new_match);
4238 FontDescription* /*new*/ pango_font_description_copy(FontDescription* this_);
4239 FontDescription* /*new*/ pango_font_description_copy_static(FontDescription* this_);
4240 int pango_font_description_equal(FontDescription* this_, FontDescription* desc2);
4241 void pango_font_description_free(FontDescription* this_);
4242 char* pango_font_description_get_family(FontDescription* this_);
4243 Gravity pango_font_description_get_gravity(FontDescription* this_);
4244 FontMask pango_font_description_get_set_fields(FontDescription* this_);
4245 int pango_font_description_get_size(FontDescription* this_);
4246 int pango_font_description_get_size_is_absolute(FontDescription* this_);
4247 Stretch pango_font_description_get_stretch(FontDescription* this_);
4248 Style pango_font_description_get_style(FontDescription* this_);
4249 Variant pango_font_description_get_variant(FontDescription* this_);
4250 Weight pango_font_description_get_weight(FontDescription* this_);
4251 uint pango_font_description_hash(FontDescription* this_);
4252 void pango_font_description_merge(FontDescription* this_, FontDescription* desc_to_merge, int replace_existing);
4253 void pango_font_description_merge_static(FontDescription* this_, FontDescription* desc_to_merge, int replace_existing);
4254 void pango_font_description_set_absolute_size(FontDescription* this_, double size);
4255 void pango_font_description_set_family(FontDescription* this_, char* family);
4256 void pango_font_description_set_family_static(FontDescription* this_, char* family);
4257 void pango_font_description_set_gravity(FontDescription* this_, Gravity gravity);
4258 void pango_font_description_set_size(FontDescription* this_, int size);
4259 void pango_font_description_set_stretch(FontDescription* this_, Stretch stretch);
4260 void pango_font_description_set_style(FontDescription* this_, Style style);
4261 void pango_font_description_set_variant(FontDescription* this_, Variant variant);
4262 void pango_font_description_set_weight(FontDescription* this_, Weight weight);
4263 char* /*new*/ pango_font_description_to_filename(FontDescription* this_);
4264 char* /*new*/ pango_font_description_to_string(FontDescription* this_);
4265 void pango_font_description_unset_fields(FontDescription* this_, FontMask to_unset);
4266 FontDescription* /*new*/ pango_font_face_describe(FontFace* this_);
4267 char* pango_font_face_get_face_name(FontFace* this_);
4268 int pango_font_face_is_synthesized(FontFace* this_);
4269 void pango_font_face_list_sizes(FontFace* this_, int** sizes, int* n_sizes);
4270 char* pango_font_family_get_name(FontFamily* this_);
4271 int pango_font_family_is_monospace(FontFamily* this_);
4272 void pango_font_family_list_faces(FontFamily* this_, FontFace*** faces, int* n_faces);
4273 Context* pango_font_map_create_context(FontMap* this_);
4274 void pango_font_map_list_families(FontMap* this_, FontFamily*** families, int* n_families);
4275 Font* pango_font_map_load_font(FontMap* this_, Context* context, FontDescription* desc);
4276 Fontset* pango_font_map_load_fontset(FontMap* this_, Context* context, FontDescription* desc, Language* language);
4277 int pango_font_metrics_get_approximate_char_width(FontMetrics* this_);
4278 int pango_font_metrics_get_approximate_digit_width(FontMetrics* this_);
4279 int pango_font_metrics_get_ascent(FontMetrics* this_);
4280 int pango_font_metrics_get_descent(FontMetrics* this_);
4281 int pango_font_metrics_get_strikethrough_position(FontMetrics* this_);
4282 int pango_font_metrics_get_strikethrough_thickness(FontMetrics* this_);
4283 int pango_font_metrics_get_underline_position(FontMetrics* this_);
4284 int pango_font_metrics_get_underline_thickness(FontMetrics* this_);
4285 FontMetrics* /*new*/ pango_font_metrics_ref(FontMetrics* this_);
4286 void pango_font_metrics_unref(FontMetrics* this_);
4287 void pango_fontset_foreach(Fontset* this_, FontsetForeachFunc func, void* data);
4288 Font* pango_fontset_get_font(Fontset* this_, uint wc);
4289 FontMetrics* /*new*/ pango_fontset_get_metrics(Fontset* this_);
4290 GLib2.SList* pango_glyph_item_apply_attrs(GlyphItem* this_, char* text, AttrList* list);
4291 GlyphItem* /*new*/ pango_glyph_item_copy(GlyphItem* this_);
4292 void pango_glyph_item_free(GlyphItem* this_);
4293 void pango_glyph_item_get_logical_widths(GlyphItem* this_, char* text, int* logical_widths);
4294 void pango_glyph_item_letter_space(GlyphItem* this_, char* text, LogAttr* log_attrs, int letter_spacing);
4295 GlyphItem* /*new*/ pango_glyph_item_split(GlyphItem* this_, char* text, int split_index);
4296 GlyphItemIter* /*new*/ pango_glyph_item_iter_copy(GlyphItemIter* this_);
4297 void pango_glyph_item_iter_free(GlyphItemIter* this_);
4298 int pango_glyph_item_iter_init_end(GlyphItemIter* this_, GlyphItem* glyph_item, char* text);
4299 int pango_glyph_item_iter_init_start(GlyphItemIter* this_, GlyphItem* glyph_item, char* text);
4300 int pango_glyph_item_iter_next_cluster(GlyphItemIter* this_);
4301 int pango_glyph_item_iter_prev_cluster(GlyphItemIter* this_);
4302 GlyphString* /*new*/ pango_glyph_string_new();
4303 GlyphString* /*new*/ pango_glyph_string_copy(GlyphString* this_);
4304 void pango_glyph_string_extents(GlyphString* this_, Font* font, Rectangle* ink_rect, Rectangle* logical_rect);
4305 void pango_glyph_string_extents_range(GlyphString* this_, int start, int end, Font* font, Rectangle* ink_rect, Rectangle* logical_rect);
4306 void pango_glyph_string_free(GlyphString* this_);
4307 void pango_glyph_string_get_logical_widths(GlyphString* this_, char* text, int length, int embedding_level, int* logical_widths);
4308 int pango_glyph_string_get_width(GlyphString* this_);
4309 void pango_glyph_string_index_to_x(GlyphString* this_, char* text, int length, Analysis* analysis, int index_, int trailing, int* x_pos);
4310 void pango_glyph_string_set_size(GlyphString* this_, int new_len);
4311 void pango_glyph_string_x_to_index(GlyphString* this_, char* text, int length, Analysis* analysis, int x_pos, int* index_, int* trailing);
4312 Item* /*new*/ pango_item_new();
4313 Item* /*new*/ pango_item_copy(Item* this_);
4314 void pango_item_free(Item* this_);
4315 Item* /*new*/ pango_item_split(Item* this_, int split_index, int split_offset);
4316 char* pango_language_get_sample_string(Language* this_);
4317 Script* pango_language_get_scripts(Language* this_, int* num_scripts);
4318 int pango_language_includes_script(Language* this_, Script script);
4319 int pango_language_matches(Language* this_, char* range_list);
4320 char* pango_language_to_string(Language* this_);
4321 Layout* /*new*/ pango_layout_new(Context* context);
4322 void pango_layout_context_changed(Layout* this_);
4323 Layout* pango_layout_copy(Layout* this_);
4324 Alignment pango_layout_get_alignment(Layout* this_);
4325 AttrList* /*new*/ pango_layout_get_attributes(Layout* this_);
4326 int pango_layout_get_auto_dir(Layout* this_);
4327 int pango_layout_get_baseline(Layout* this_);
4328 Context* pango_layout_get_context(Layout* this_);
4329 void pango_layout_get_cursor_pos(Layout* this_, int index_, /*out*/ Rectangle* strong_pos, /*out*/ Rectangle* weak_pos);
4330 EllipsizeMode pango_layout_get_ellipsize(Layout* this_);
4331 void pango_layout_get_extents(Layout* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4332 FontDescription* pango_layout_get_font_description(Layout* this_);
4333 int pango_layout_get_height(Layout* this_);
4334 int pango_layout_get_indent(Layout* this_);
4335 LayoutIter* /*new*/ pango_layout_get_iter(Layout* this_);
4336 int pango_layout_get_justify(Layout* this_);
4337 LayoutLine* /*new*/ pango_layout_get_line(Layout* this_, int line);
4338 int pango_layout_get_line_count(Layout* this_);
4339 LayoutLine* /*new*/ pango_layout_get_line_readonly(Layout* this_, int line);
4340 GLib2.SList* pango_layout_get_lines(Layout* this_);
4341 GLib2.SList* pango_layout_get_lines_readonly(Layout* this_);
4342 void pango_layout_get_log_attrs(Layout* this_, /*out*/ LogAttr** attrs, /*out*/ int* n_attrs);
4343 void pango_layout_get_pixel_extents(Layout* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4344 void pango_layout_get_pixel_size(Layout* this_, /*out*/ int* width, /*out*/ int* height);
4345 int pango_layout_get_single_paragraph_mode(Layout* this_);
4346 void pango_layout_get_size(Layout* this_, /*out*/ int* width, /*out*/ int* height);
4347 int pango_layout_get_spacing(Layout* this_);
4348 TabArray* /*new*/ pango_layout_get_tabs(Layout* this_);
4349 char* pango_layout_get_text(Layout* this_);
4350 int pango_layout_get_unknown_glyphs_count(Layout* this_);
4351 int pango_layout_get_width(Layout* this_);
4352 WrapMode pango_layout_get_wrap(Layout* this_);
4353 void pango_layout_index_to_line_x(Layout* this_, int index_, int trailing, /*out*/ int* line, int* x_pos);
4354 void pango_layout_index_to_pos(Layout* this_, int index_, /*out*/ Rectangle* pos);
4355 int pango_layout_is_ellipsized(Layout* this_);
4356 int pango_layout_is_wrapped(Layout* this_);
4357 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);
4358 void pango_layout_set_alignment(Layout* this_, Alignment alignment);
4359 void pango_layout_set_attributes(Layout* this_, AttrList* attrs);
4360 void pango_layout_set_auto_dir(Layout* this_, int auto_dir);
4361 void pango_layout_set_ellipsize(Layout* this_, EllipsizeMode ellipsize);
4362 void pango_layout_set_font_description(Layout* this_, FontDescription* desc);
4363 void pango_layout_set_height(Layout* this_, int height);
4364 void pango_layout_set_indent(Layout* this_, int indent);
4365 void pango_layout_set_justify(Layout* this_, int justify);
4366 void pango_layout_set_markup(Layout* this_, char* markup, int length);
4367 void pango_layout_set_markup_with_accel(Layout* this_, char* markup, int length, dchar accel_marker, dchar* accel_char);
4368 void pango_layout_set_single_paragraph_mode(Layout* this_, int setting);
4369 void pango_layout_set_spacing(Layout* this_, int spacing);
4370 void pango_layout_set_tabs(Layout* this_, TabArray* tabs);
4371 void pango_layout_set_text(Layout* this_, char* text, int length);
4372 void pango_layout_set_width(Layout* this_, int width);
4373 void pango_layout_set_wrap(Layout* this_, WrapMode wrap);
4374 int pango_layout_xy_to_index(Layout* this_, int x, int y, /*out*/ int* index_, /*out*/ int* trailing);
4375 int pango_layout_iter_at_last_line(LayoutIter* this_);
4376 LayoutIter* /*new*/ pango_layout_iter_copy(LayoutIter* this_);
4377 void pango_layout_iter_free(LayoutIter* this_);
4378 int pango_layout_iter_get_baseline(LayoutIter* this_);
4379 void pango_layout_iter_get_char_extents(LayoutIter* this_, Rectangle* logical_rect);
4380 void pango_layout_iter_get_cluster_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4381 int pango_layout_iter_get_index(LayoutIter* this_);
4382 Layout* pango_layout_iter_get_layout(LayoutIter* this_);
4383 void pango_layout_iter_get_layout_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4384 LayoutLine* /*new*/ pango_layout_iter_get_line(LayoutIter* this_);
4385 void pango_layout_iter_get_line_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4386 LayoutLine* /*new*/ pango_layout_iter_get_line_readonly(LayoutIter* this_);
4387 void pango_layout_iter_get_line_yrange(LayoutIter* this_, int* y0_, int* y1_);
4388 LayoutRun* pango_layout_iter_get_run(LayoutIter* this_);
4389 void pango_layout_iter_get_run_extents(LayoutIter* this_, Rectangle* ink_rect, Rectangle* logical_rect);
4390 LayoutRun* pango_layout_iter_get_run_readonly(LayoutIter* this_);
4391 int pango_layout_iter_next_char(LayoutIter* this_);
4392 int pango_layout_iter_next_cluster(LayoutIter* this_);
4393 int pango_layout_iter_next_line(LayoutIter* this_);
4394 int pango_layout_iter_next_run(LayoutIter* this_);
4395 void pango_layout_line_get_extents(LayoutLine* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4396 void pango_layout_line_get_pixel_extents(LayoutLine* this_, /*out*/ Rectangle* ink_rect, /*out*/ Rectangle* logical_rect);
4397 void pango_layout_line_get_x_ranges(LayoutLine* this_, int start_index, int end_index, /*out*/ int** ranges, /*out*/ int* n_ranges);
4398 void pango_layout_line_index_to_x(LayoutLine* this_, int index_, int trailing, /*out*/ int* x_pos);
4399 LayoutLine* /*new*/ pango_layout_line_ref(LayoutLine* this_);
4400 void pango_layout_line_unref(LayoutLine* this_);
4401 int pango_layout_line_x_to_index(LayoutLine* this_, int x_pos, /*out*/ int* index_, /*out*/ int* trailing);
4402 void pango_matrix_concat(Matrix* this_, Matrix* new_matrix);
4403 Matrix* /*new*/ pango_matrix_copy(Matrix* this_);
4404 void pango_matrix_free(Matrix* this_);
4405 double pango_matrix_get_font_scale_factor(Matrix* this_);
4406 void pango_matrix_rotate(Matrix* this_, double degrees);
4407 void pango_matrix_scale(Matrix* this_, double scale_x, double scale_y);
4408 void pango_matrix_transform_distance(Matrix* this_, double* dx, double* dy);
4409 void pango_matrix_transform_pixel_rectangle(Matrix* this_, Rectangle* rect);
4410 void pango_matrix_transform_point(Matrix* this_, double* x, double* y);
4411 void pango_matrix_transform_rectangle(Matrix* this_, Rectangle* rect);
4412 void pango_matrix_translate(Matrix* this_, double tx, double ty);
4413 void pango_renderer_activate(Renderer* this_);
4414 void pango_renderer_deactivate(Renderer* this_);
4415 void pango_renderer_draw_error_underline(Renderer* this_, int x, int y, int width, int height);
4416 void pango_renderer_draw_glyph(Renderer* this_, Font* font, Glyph glyph, double x, double y);
4417 void pango_renderer_draw_glyph_item(Renderer* this_, char* text, GlyphItem* glyph_item, int x, int y);
4418 void pango_renderer_draw_glyphs(Renderer* this_, Font* font, GlyphString* glyphs, int x, int y);
4419 void pango_renderer_draw_layout(Renderer* this_, Layout* layout, int x, int y);
4420 void pango_renderer_draw_layout_line(Renderer* this_, LayoutLine* line, int x, int y);
4421 void pango_renderer_draw_rectangle(Renderer* this_, RenderPart part, int x, int y, int width, int height);
4422 void pango_renderer_draw_trapezoid(Renderer* this_, RenderPart part, double y1_, double x11, double x21, double y2, double x12, double x22);
4423 Color* /*new*/ pango_renderer_get_color(Renderer* this_, RenderPart part);
4424 Layout* pango_renderer_get_layout(Renderer* this_);
4425 LayoutLine* /*new*/ pango_renderer_get_layout_line(Renderer* this_);
4426 Matrix* pango_renderer_get_matrix(Renderer* this_);
4427 void pango_renderer_part_changed(Renderer* this_, RenderPart part);
4428 void pango_renderer_set_color(Renderer* this_, RenderPart part, Color* color);
4429 void pango_renderer_set_matrix(Renderer* this_, Matrix* matrix);
4430 void pango_script_iter_free(ScriptIter* this_);
4431 void pango_script_iter_get_range(ScriptIter* this_, char** start, char** end, Script* script);
4432 int pango_script_iter_next(ScriptIter* this_);
4433 TabArray* /*new*/ pango_tab_array_new(int initial_size, int positions_in_pixels);
4434 TabArray* /*new*/ pango_tab_array_new_with_positions(int size, int positions_in_pixels, TabAlign first_alignment, int first_position, ...);
4435 TabArray* /*new*/ pango_tab_array_copy(TabArray* this_);
4436 void pango_tab_array_free(TabArray* this_);
4437 int pango_tab_array_get_positions_in_pixels(TabArray* this_);
4438 int pango_tab_array_get_size(TabArray* this_);
4439 void pango_tab_array_get_tab(TabArray* this_, int tab_index, TabAlign* alignment, int* location);
4440 void pango_tab_array_get_tabs(TabArray* this_, TabAlign** alignments, int** locations);
4441 void pango_tab_array_resize(TabArray* this_, int new_size);
4442 void pango_tab_array_set_tab(TabArray* this_, int tab_index, TabAlign alignment, int location);
4443 Attribute* pango_attr_background_new(ushort red, ushort green, ushort blue);
4444 Attribute* pango_attr_fallback_new(int enable_fallback);
4445 Attribute* pango_attr_family_new(char* family);
4446 Attribute* pango_attr_font_desc_new(FontDescription* desc);
4447 Attribute* pango_attr_foreground_new(ushort red, ushort green, ushort blue);
4448 Attribute* pango_attr_gravity_hint_new(GravityHint hint);
4449 Attribute* pango_attr_gravity_new(Gravity gravity);
4450 Attribute* pango_attr_language_new(Language* language);
4451 Attribute* pango_attr_letter_spacing_new(int letter_spacing);
4452 Attribute* pango_attr_rise_new(int rise);
4453 Attribute* pango_attr_scale_new(double scale_factor);
4454 Attribute* pango_attr_shape_new(Rectangle* ink_rect, Rectangle* logical_rect);
4455 Attribute* pango_attr_shape_new_with_data(Rectangle* ink_rect, Rectangle* logical_rect, void* data, AttrDataCopyFunc copy_func, GLib2.DestroyNotify destroy_func);
4456 Attribute* pango_attr_size_new(int size);
4457 Attribute* pango_attr_size_new_absolute(int size);
4458 Attribute* pango_attr_stretch_new(Stretch stretch);
4459 Attribute* pango_attr_strikethrough_color_new(ushort red, ushort green, ushort blue);
4460 Attribute* pango_attr_strikethrough_new(int strikethrough);
4461 Attribute* pango_attr_style_new(Style style);
4462 char* pango_attr_type_get_name(AttrType type);
4463 AttrType pango_attr_type_register(char* name);
4464 Attribute* pango_attr_underline_color_new(ushort red, ushort green, ushort blue);
4465 Attribute* pango_attr_underline_new(Underline underline);
4466 Attribute* pango_attr_variant_new(Variant variant);
4467 Attribute* pango_attr_weight_new(Weight weight);
4468 BidiType pango_bidi_type_for_unichar(dchar ch);
4469 void pango_break(char* text, int length, Analysis* analysis, LogAttr* attrs, int attrs_len);
4470 Coverage* pango_coverage_from_bytes(ubyte* bytes, int n_bytes);
4471 Coverage* pango_coverage_new();
4472 void pango_extents_to_pixels(Rectangle* inclusive, Rectangle* nearest);
4473 Direction pango_find_base_dir(char* text, int length);
4474 void pango_find_paragraph_boundary(char* text, int length, int* paragraph_delimiter_index, int* next_paragraph_start);
4475 FontDescription* /*new*/ pango_font_description_from_string(char* str);
4476 void pango_get_log_attrs(char* text, int length, int level, Language* language, LogAttr* log_attrs, int attrs_len);
4477 int pango_get_mirror_char(dchar ch, dchar* mirrored_ch);
4478 Gravity pango_gravity_get_for_matrix(Matrix* matrix);
4479 Gravity pango_gravity_get_for_script(Script script, Gravity base_gravity, GravityHint hint);
4480 Gravity pango_gravity_get_for_script_and_width(Script script, int wide, Gravity base_gravity, GravityHint hint);
4481 double pango_gravity_to_rotation(Gravity gravity);
4482 int pango_is_zero_width(dchar ch);
4483 GLib2.List* pango_itemize(Context* context, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter);
4484 GLib2.List* pango_itemize_with_base_dir(Context* context, Direction base_dir, char* text, int start_index, int length, AttrList* attrs, AttrIterator* cached_iter);
4485 Language* /*new*/ pango_language_from_string(char* language);
4486 Language* /*new*/ pango_language_get_default();
4487 ubyte* pango_log2vis_get_embedding_levels(char* text, int length, Direction* pbase_dir);
4488 int pango_parse_enum(Type type, char* str, int* value, int warn, char** possible_values);
4489 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);
4490 int pango_parse_stretch(char* str, Stretch* stretch, int warn);
4491 int pango_parse_style(char* str, Style* style, int warn);
4492 int pango_parse_variant(char* str, Variant* variant, int warn);
4493 int pango_parse_weight(char* str, Weight* weight, int warn);
4494 void pango_quantize_line_geometry(int* thickness, int* position);
4495 int pango_read_line(FILE* stream, GLib2.String* str);
4496 GLib2.List* pango_reorder_items(GLib2.List* logical_items);
4497 int pango_scan_int(char** pos, int* out_);
4498 int pango_scan_string(char** pos, GLib2.String* out_);
4499 int pango_scan_word(char** pos, GLib2.String* out_);
4500 Script pango_script_for_unichar(dchar ch);
4501 Language* /*new*/ pango_script_get_sample_language(Script script);
4502 ScriptIter* pango_script_iter_new(char* text, int length);
4503 void pango_shape(char* text, int length, Analysis* analysis, GlyphString* glyphs);
4504 int pango_skip_space(char** pos);
4505 char** pango_split_file_list(char* str);
4506 char* /*new*/ pango_trim_string(char* str);
4507 Direction pango_unichar_direction(dchar ch);
4508 int pango_units_from_double(double d);
4509 double pango_units_to_double(int i);
4510 int pango_version();
4511 char* pango_version_check(int required_major, int required_minor, int required_micro);
4512 char* pango_version_string();