1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 module pango.c.glyph_item; 7 8 import pango.c.attributes; 9 import pango.c.break_; 10 import pango.c.item; 11 import pango.c.glyph; 12 13 import glib; 14 import gobject; 15 16 extern (C): 17 18 /** 19 * PangoGlyphItem: 20 * 21 * A #PangoGlyphItem is a pair of a #PangoItem and the glyphs 22 * resulting from shaping the text corresponding to an item. 23 * As an example of the usage of #PangoGlyphItem, the results 24 * of shaping text with #PangoLayout is a list of #PangoLayoutLine, 25 * each of which contains a list of #PangoGlyphItem. 26 */ 27 struct PangoGlyphItem 28 { 29 PangoItem *item; 30 PangoGlyphString *glyphs; 31 } 32 33 34 pure GType pango_glyph_item_get_type (); 35 36 PangoGlyphItem *pango_glyph_item_split (PangoGlyphItem *orig, 37 const(char) *text, 38 int split_index); 39 PangoGlyphItem *pango_glyph_item_copy (PangoGlyphItem *orig); 40 void pango_glyph_item_free (PangoGlyphItem *glyph_item); 41 GSList * pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, 42 const(char) *text, 43 PangoAttrList *list); 44 void pango_glyph_item_letter_space (PangoGlyphItem *glyph_item, 45 const(char) *text, 46 PangoLogAttr *log_attrs, 47 int letter_spacing); 48 void pango_glyph_item_get_logical_widths (PangoGlyphItem *glyph_item, 49 const(char) *text, 50 int *logical_widths); 51 52 53 /** 54 * PangoGlyphItemIter: 55 * 56 * A #PangoGlyphItemIter is an iterator over the clusters in a 57 * #PangoGlyphItem. The <firstterm>forward direction</firstterm> of the 58 * iterator is the logical direction of text. That is, with increasing 59 * @start_index and @start_char values. If @glyph_item is right-to-left 60 * (that is, if <literal>@glyph_item->item->analysis.level</literal> is odd), 61 * then @start_glyph decreases as the iterator moves forward. Moreover, 62 * in right-to-left cases, @start_glyph is greater than @end_glyph. 63 * 64 * An iterator should be initialized using either of 65 * pango_glyph_item_iter_init_start() and 66 * pango_glyph_item_iter_init_end(), for forward and backward iteration 67 * respectively, and walked over using any desired mixture of 68 * pango_glyph_item_iter_next_cluster() and 69 * pango_glyph_item_iter_prev_cluster(). A common idiom for doing a 70 * forward iteration over the clusters is: 71 * <programlisting> 72 * PangoGlyphItemIter cluster_iter; 73 * gboolean have_cluster; 74 * 75 * for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter, 76 * glyph_item, text); 77 * have_cluster; 78 * have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter)) 79 * { 80 * ... 81 * } 82 * </programlisting> 83 * 84 * Note that @text is the start of the text for layout, which is then 85 * indexed by <literal>@glyph_item->item->offset</literal> to get to the 86 * text of @glyph_item. The @start_index and @end_index values can directly 87 * index into @text. The @start_glyph, @end_glyph, @start_char, and @end_char 88 * values however are zero-based for the @glyph_item. For each cluster, the 89 * item pointed at by the start variables is included in the cluster while 90 * the one pointed at by end variables is not. 91 * 92 * None of the members of a #PangoGlyphItemIter should be modified manually. 93 * 94 * Since: 1.22 95 */ 96 struct PangoGlyphItemIter 97 { 98 PangoGlyphItem *glyph_item; 99 const(gchar) *text; 100 101 int start_glyph; 102 int start_index; 103 int start_char; 104 105 int end_glyph; 106 int end_index; 107 int end_char; 108 } 109 110 111 pure GType pango_glyph_item_iter_get_type (); 112 PangoGlyphItemIter *pango_glyph_item_iter_copy (PangoGlyphItemIter *orig); 113 void pango_glyph_item_iter_free (PangoGlyphItemIter *iter); 114 115 gboolean pango_glyph_item_iter_init_start (PangoGlyphItemIter *iter, 116 PangoGlyphItem *glyph_item, 117 const(char) *text); 118 gboolean pango_glyph_item_iter_init_end (PangoGlyphItemIter *iter, 119 PangoGlyphItem *glyph_item, 120 const(char) *text); 121 gboolean pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter); 122 gboolean pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter); 123