2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = pango-Glyph-Storage.html
27 * outFile = PgGlyphString
28 * strct = PangoGlyphString
31 * clss = PgGlyphString
39 * - pango_glyph_string_
48 * - pango.PgFontDescription
49 * - pango.PgFontMetrics
50 * - pango.PgFontFamily
53 * - pango.PgFontsetSimple
55 * - pango.PgAttributeList
59 * - pango.PgLayoutIter
60 * - pango.PgScriptIter
64 * - PangoAttribute* -> PgAttribute
65 * - PangoAttributeList* -> PgAttributeList
66 * - PangoContext* -> PgContext
67 * - PangoFontDescription* -> PgFontDescription
68 * - PangoFontFace* -> PgFontFace
69 * - PangoFontFamily* -> PgFontFamily
70 * - PangoFontMap* -> PgFontMap
71 * - PangoFontMetrics* -> PgFontMetrics
72 * - PangoFontsetSimple* -> PgFontsetSimple
73 * - PangoItem* -> PgItem
74 * - PangoLanguage* -> PgLanguage
75 * - PangoLayout* -> PgLayout
76 * - PangoLayoutIter* -> PgLayoutIter
77 * - PangoScriptIter* -> PgScriptIter
78 * - PangoTabArray* -> PgTabArray
82 module pango
.PgGlyphString
;
84 private import pango
.pangotypes
;
86 private import lib
.pango
;
88 private import glib
.ListSG
;
89 private import pango
.PgContext
;
90 private import pango
.PgItem
;
91 private import pango
.PgLayout
;
92 private import pango
.PgFontDescription
;
93 private import pango
.PgFontMetrics
;
94 private import pango
.PgFontFamily
;
95 private import pango
.PgFontFace
;
96 private import pango
.PgFontMap
;
97 private import pango
.PgFontsetSimple
;
98 private import pango
.PgAttribute
;
99 private import pango
.PgAttributeList
;
100 private import pango
.PgLanguage
;
101 private import pango
.PgTabArray
;
102 private import pango
.PgLayout
;
103 private import pango
.PgLayoutIter
;
104 private import pango
.PgScriptIter
;
105 private import glib
.Str
;
109 * pango_shape() produces a string of glyphs which
110 * can be measured or drawn to the screen. The following
111 * structures are used to store information about
114 public class PgGlyphString
117 /** the main Gtk struct */
118 protected PangoGlyphString
* pangoGlyphString
;
121 public PangoGlyphString
* getPgGlyphStringStruct()
123 return pangoGlyphString
;
127 /** the main Gtk struct as a void* */
128 protected void* getStruct()
130 return cast(void*)pangoGlyphString
;
134 * Sets our main struct and passes it to the parent class
136 public this (PangoGlyphString
* pangoGlyphString
)
138 this.pangoGlyphString
= pangoGlyphString
;
157 * Copies a PangoMatrix.
159 * a PangoMatrix, can be NULL
161 * the newly allocated PangoMatrix, which should
162 * be freed with pango_matrix_free(), or NULL if
166 public static PangoMatrix
* pangoMatrixCopy(PangoMatrix
* matrix
)
168 // PangoMatrix* pango_matrix_copy (const PangoMatrix *matrix);
169 return pango_matrix_copy(matrix
);
173 * Free a PangoMatrix created with pango_matrix_copy().
174 * Does nothing if matrix is NULL.
176 * a PangoMatrix, or NULL
179 public static void pangoMatrixFree(PangoMatrix
* matrix
)
181 // void pango_matrix_free (PangoMatrix *matrix);
182 pango_matrix_free(matrix
);
186 * Changes the transformation represented by matrix to be the
187 * transformation given by first translating by (tx, ty)
188 * then applying the original transformation.
192 * amount to translate in the X direction
194 * amount to translate in the Y direction
197 public static void pangoMatrixTranslate(PangoMatrix
* matrix
, double tx
, double ty
)
199 // void pango_matrix_translate (PangoMatrix *matrix, double tx, double ty);
200 pango_matrix_translate(matrix
, tx
, ty
);
204 * Changes the transformation represented by matrix to be the
205 * transformation given by first scaling by sx in the X direction
206 * and sy in the Y direction then applying the original
211 * amount to scale by in X direction
213 * amount to scale by in Y direction
216 public static void pangoMatrixScale(PangoMatrix
* matrix
, double scaleX
, double scaleY
)
218 // void pango_matrix_scale (PangoMatrix *matrix, double scale_x, double scale_y);
219 pango_matrix_scale(matrix
, scaleX
, scaleY
);
223 * Changes the transformation represented by matrix to be the
224 * transformation given by first rotating by degrees degrees
225 * counter-clokwise then applying the original transformation.
229 * degrees to rotate counter-clockwise
232 public static void pangoMatrixRotate(PangoMatrix
* matrix
, double degrees
)
234 // void pango_matrix_rotate (PangoMatrix *matrix, double degrees);
235 pango_matrix_rotate(matrix
, degrees
);
239 * Changes the transformation represented by matrix to be the
240 * transformation given by first applying transformation
241 * given by new_matrix then applying the original transformation.
248 public static void pangoMatrixConcat(PangoMatrix
* matrix
, PangoMatrix
* newMatrix
)
250 // void pango_matrix_concat (PangoMatrix *matrix, const PangoMatrix *new_matrix);
251 pango_matrix_concat(matrix
, newMatrix
);
255 * Returns the scale factor of a matrix on the height of the font.
256 * That is, the scale factor in the direction perpendicular to the
257 * vector that the X coordinate is mapped to.
259 * a PangoMatrix, may be NULL
261 * the scale factor of matrix on the height of the font,
262 * or 1.0 if matrix is NULL.
265 public static double pangoMatrixGetFontScaleFactor(PangoMatrix
* matrix
)
267 // double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix);
268 return pango_matrix_get_font_scale_factor(matrix
);
272 * Finds the gravity that best matches the rotation component
277 * the gravity of matrix, which will never be
278 * PANGO_GRAVITY_AUTO, or PANGO_GRAVITY_SOUTH if matrix is NULL
281 public static PangoGravity
pangoMatrixToGravity(PangoMatrix
* matrix
)
283 // PangoGravity pango_matrix_to_gravity (const PangoMatrix *matrix);
284 return pango_matrix_to_gravity(matrix
);
299 * Create a new PangoGlyphString.
301 * the newly allocated PangoGlyphString, which
302 * should be freed with pango_glyph_string_free().
306 // PangoGlyphString* pango_glyph_string_new (void);
307 this(cast(PangoGlyphString
*)pango_glyph_string_new() );
311 * Copy a glyph string and associated storage.
313 * a PangoGlyphString.
315 * the newly allocated PangoGlyphString, which
316 * should be freed with pango_glyph_string_free().
318 public PangoGlyphString
* copy()
320 // PangoGlyphString* pango_glyph_string_copy (PangoGlyphString *string);
321 return pango_glyph_string_copy(pangoGlyphString
);
325 * Resize a glyph string to the given length.
327 * a PangoGlyphString.
329 * the new length of the string.
331 public void setSize(int newLen
)
333 // void pango_glyph_string_set_size (PangoGlyphString *string, gint new_len);
334 pango_glyph_string_set_size(pangoGlyphString
, newLen
);
338 * Free a glyph string and associated storage.
340 * a PangoGlyphString.
344 // void pango_glyph_string_free (PangoGlyphString *string);
345 pango_glyph_string_free(pangoGlyphString
);
349 * Compute the logical and ink extents of a glyph string. See the documentation
350 * for pango_font_get_glyph_extents() for details about the interpretation
357 * rectangle used to store the extents of the glyph string as drawn
358 * or NULL to indicate that the result is not needed.
360 * rectangle used to store the logical extents of the glyph string
361 * or NULL to indicate that the result is not needed.
363 public void extents(PangoFont
* font
, PangoRectangle
* inkRect
, PangoRectangle
* logicalRect
)
365 // void pango_glyph_string_extents (PangoGlyphString *glyphs, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect);
366 pango_glyph_string_extents(pangoGlyphString
, font
, inkRect
, logicalRect
);
370 * Computes the extents of a sub-portion of a glyph string. The extents are
371 * relative to the start of the glyph string range (the origin of their
372 * coordinate system is at the start of the range, not at the start of the entire
379 * end index (the range is the set of bytes with
380 * indices such that start <= index < end)
384 * rectangle used to store the extents of the glyph string range as drawn
385 * or NULL to indicate that the result is not needed.
387 * rectangle used to store the logical extents of the glyph string range
388 * or NULL to indicate that the result is not needed.
390 public void extentsRange(int start
, int end
, PangoFont
* font
, PangoRectangle
* inkRect
, PangoRectangle
* logicalRect
)
392 // void pango_glyph_string_extents_range (PangoGlyphString *glyphs, int start, int end, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect);
393 pango_glyph_string_extents_range(pangoGlyphString
, start
, end
, font
, inkRect
, logicalRect
);
397 * Computes the logical width of the glyph string as can also be computed
398 * using pango_glyph_string_extents(). However, since this only computes the
399 * width, it's much faster. This is in fact only a convenience function that
400 * computes the sum of geometry.width for each glyph in the glyphs.
404 * the logical width of the glyph string.
407 public int getWidth()
409 // int pango_glyph_string_get_width (PangoGlyphString *glyphs);
410 return pango_glyph_string_get_width(pangoGlyphString
);
414 * Converts from character position to x position. (X position
415 * is measured from the left edge of the run). Character positions
416 * are computed by dividing up each cluster into equal portions.
418 * the glyphs return from pango_shape()
420 * the text for the run
422 * the number of bytes (not characters) in text.
424 * the analysis information return from pango_itemize()
426 * the byte index within text
428 * whether we should compute the result for the beginning
429 * or end of the character.
431 * location to store result
433 public void indexToX(char[] text
, int length
, PangoAnalysis
* analysis
, int index
, int trailing
, int* xPos
)
435 // void pango_glyph_string_index_to_x (PangoGlyphString *glyphs, char *text, int length, PangoAnalysis *analysis, int index_, gboolean trailing, int *x_pos);
436 pango_glyph_string_index_to_x(pangoGlyphString
, Str
.toStringz(text
), length
, analysis
, index
, trailing
, xPos
);
440 * Convert from x offset to character position. Character positions
441 * are computed by dividing up each cluster into equal portions.
442 * In scripts where positioning within a cluster is not allowed
443 * (such as Thai), the returned value may not be a valid cursor
444 * position; the caller must combine the result with the logical
445 * attributes for the text to compute the valid cursor position.
447 * the glyphs return from pango_shape()
449 * the text for the run
451 * the number of bytes (not characters) in text.
453 * the analysis information return from pango_itemize()
455 * the x offset (in PangoGlyphUnit)
457 * location to store calculated byte index within text
459 * location to store a integer indicating where
460 * whether the user clicked on the leading or trailing
461 * edge of the character.
463 public void xToIndex(char[] text
, int length
, PangoAnalysis
* analysis
, int xPos
, int* index
, int* trailing
)
465 // void pango_glyph_string_x_to_index (PangoGlyphString *glyphs, char *text, int length, PangoAnalysis *analysis, int x_pos, int *index_, int *trailing);
466 pango_glyph_string_x_to_index(pangoGlyphString
, Str
.toStringz(text
), length
, analysis
, xPos
, index
, trailing
);
470 * Given a PangoGlyphString resulting from pango_shape() and the corresponding
471 * text, determine the screen width corresponding to each character. When
472 * multiple characters compose a single cluster, the width of the entire
473 * cluster is divided equally among the characters.
477 * the text corresponding to the glyphs
479 * the length of text, in bytes
481 * the embedding level of the string
483 * an array whose length is g_utf8_strlen (text, length)
484 * to be filled in with the resulting character widths.
486 public void getLogicalWidths(char[] text
, int length
, int embeddingLevel
, int* logicalWidths
)
488 // void pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs, const char *text, int length, int embedding_level, int *logical_widths);
489 pango_glyph_string_get_logical_widths(pangoGlyphString
, Str
.toStringz(text
), length
, embeddingLevel
, logicalWidths
);
493 * Modifies orig to cover only the text after split_index, and
494 * returns a new item that covers the text before split_index that
495 * used to be in orig. You can think of split_index as the length of
496 * the returned item. split_index may not be 0, and it may not be
497 * greater than or equal to the length of orig (that is, there must
498 * be at least one byte assigned to each item, you can't create a
500 * This function is similar in function to pango_item_split() (and uses
505 * text to which positions in orig apply
507 * byte index of position to split item, relative to the start of the item
509 * the newly allocated item representing text before
510 * split_index, which should be freed
511 * with pango_glyph_item_free().
514 public static PangoGlyphItem
* pangoGlyphItemSplit(PangoGlyphItem
* orig
, char[] text
, int splitIndex
)
516 // PangoGlyphItem* pango_glyph_item_split (PangoGlyphItem *orig, const char *text, int split_index);
517 return pango_glyph_item_split(orig
, Str
.toStringz(text
), splitIndex
);
521 * Splits a shaped item (PangoGlyphItem) into multiple items based
522 * on an attribute list. The idea is that if you have attributes
523 * that don't affect shaping, such as color or underline, to avoid
524 * affecting shaping, you filter them out (pango_attr_list_filter()),
525 * apply the shaping process and then reapply them to the result using
527 * All attributes that start or end inside a cluster are applied
528 * to that cluster; for instance, if half of a cluster is underlined
529 * and the other-half strikethough, then the cluster will end
530 * up with both underline and strikethrough attributes. In these
531 * cases, it may happen that item->extra_attrs for some of the
532 * result items can have multiple attributes of the same type.
533 * This function takes ownership of glyph_item; it will be reused
534 * as one of the elements in the list.
538 * text that list applies to
542 * a list of glyph items resulting from splitting
543 * glyph_item. Free the elements using pango_glyph_item_free(),
544 * the list using g_slist_free().
547 public static ListSG
pangoGlyphItemApplyAttrs(PangoGlyphItem
* glyphItem
, char[] text
, PangoAttrList
* list
)
549 // GSList* pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, const char *text, PangoAttrList *list);
550 return new ListSG( pango_glyph_item_apply_attrs(glyphItem
, Str
.toStringz(text
), list
) );
554 * Adds spacing between the graphemes of glyph_item to
555 * give the effect of typographic letter spacing.
559 * text that glyph_item corresponds to
560 * (glyph_item->item->offset is an offset from the
563 * logical attributes for the item (the
564 * first logical attribute refers to the position
565 * before the first character in the item)
567 * amount of letter spacing to add
568 * in Pango units. May be negative, though too large
569 * negative values will give ugly results.
572 public static void pangoGlyphItemLetterSpace(PangoGlyphItem
* glyphItem
, char[] text
, PangoLogAttr
* logAttrs
, int letterSpacing
)
574 // void pango_glyph_item_letter_space (PangoGlyphItem *glyph_item, const char *text, PangoLogAttr *log_attrs, int letter_spacing);
575 pango_glyph_item_letter_space(glyphItem
, Str
.toStringz(text
), logAttrs
, letterSpacing
);
579 * Frees a PangoGlyphItem and memory to which it points.
584 public static void pangoGlyphItemFree(PangoGlyphItem
* glyphItem
)
586 // void pango_glyph_item_free (PangoGlyphItem *glyph_item);
587 pango_glyph_item_free(glyphItem
);