GlyphItemIterProtocol
public protocol GlyphItemIterProtocol
A PangoGlyphItemIter
is an iterator over the clusters in a
PangoGlyphItem
.
The forward direction of the iterator is the logical direction of text.
That is, with increasing start_index
and start_char
values. If glyph_item
is right-to-left (that is, if glyph_item->item->analysis.level
is odd),
then start_glyph
decreases as the iterator moves forward. Moreover,
in right-to-left cases, start_glyph
is greater than end_glyph
.
An iterator should be initialized using either
pango_glyph_item_iter_init_start()
or
pango_glyph_item_iter_init_end()
, for forward and backward iteration
respectively, and walked over using any desired mixture of
pango_glyph_item_iter_next_cluster()
and
pango_glyph_item_iter_prev_cluster()
.
A common idiom for doing a forward iteration over the clusters is:
PangoGlyphItemIter cluster_iter;
gboolean have_cluster;
for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter,
glyph_item, text);
have_cluster;
have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
{
...
}
Note that text
is the start of the text for layout, which is then
indexed by glyph_item->item->offset
to get to the text of glyph_item
.
The start_index
and end_index
values can directly index into text
. The
start_glyph
, end_glyph
, start_char
, and end_char
values however are
zero-based for the glyph_item
. For each cluster, the item pointed at by
the start variables is included in the cluster while the one pointed at by
end variables is not.
None of the members of a PangoGlyphItemIter
should be modified manually.
The GlyphItemIterProtocol
protocol exposes the methods and properties of an underlying PangoGlyphItemIter
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see GlyphItemIter
.
Alternatively, use GlyphItemIterRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
PangoGlyphItemIter
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
glyph_item_iter_ptr
Default implementationTyped pointer to the underlying
PangoGlyphItemIter
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
PangoGlyphItemIter
instance.Declaration
Swift
var glyph_item_iter_ptr: UnsafeMutablePointer<PangoGlyphItemIter>! { get }
-
Required Initialiser for types conforming to
GlyphItemIterProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
copy()
Extension methodMake a shallow copy of an existing
PangoGlyphItemIter
structure.Declaration
Swift
@inlinable func copy() -> Pango.GlyphItemIterRef!
-
free()
Extension methodFrees a
PangoGlyphItem
Iter.Declaration
Swift
@inlinable func free()
-
initEnd(glyphItem:
Extension methodtext: ) Initializes a
PangoGlyphItemIter
structure to point to the last cluster in a glyph item.See
PangoGlyphItemIter
for details of cluster orders.Declaration
Swift
@inlinable func initEnd<GlyphItemT>(glyphItem: GlyphItemT, text: UnsafePointer<CChar>!) -> Bool where GlyphItemT : GlyphItemProtocol
-
initStart(glyphItem:
Extension methodtext: ) Initializes a
PangoGlyphItemIter
structure to point to the first cluster in a glyph item.See
PangoGlyphItemIter
for details of cluster orders.Declaration
Swift
@inlinable func initStart<GlyphItemT>(glyphItem: GlyphItemT, text: UnsafePointer<CChar>!) -> Bool where GlyphItemT : GlyphItemProtocol
-
nextCluster()
Extension methodAdvances the iterator to the next cluster in the glyph item.
See
PangoGlyphItemIter
for details of cluster orders.Declaration
Swift
@inlinable func nextCluster() -> Bool
-
prevCluster()
Extension methodMoves the iterator to the preceding cluster in the glyph item. See
PangoGlyphItemIter
for details of cluster orders.Declaration
Swift
@inlinable func prevCluster() -> Bool
-
glyphItem
Extension methodUndocumented
Declaration
Swift
@inlinable var glyphItem: GlyphItemRef! { get set }
-
text
Extension methodUndocumented
Declaration
Swift
@inlinable var text: UnsafePointer<gchar>! { get set }
-
startGlyph
Extension methodUndocumented
Declaration
Swift
@inlinable var startGlyph: gint { get set }
-
startIndex
Extension methodUndocumented
Declaration
Swift
@inlinable var startIndex: gint { get set }
-
startChar
Extension methodUndocumented
Declaration
Swift
@inlinable var startChar: gint { get set }
-
endGlyph
Extension methodUndocumented
Declaration
Swift
@inlinable var endGlyph: gint { get set }
-
endIndex
Extension methodUndocumented
Declaration
Swift
@inlinable var endIndex: gint { get set }
-
endChar
Extension methodUndocumented
Declaration
Swift
@inlinable var endChar: gint { get set }