结构
PangoGlyphItemIter
since: 1.22
描述 [src]
struct PangoGlyphItemIter {
PangoGlyphItem* glyph_item;
const gchar* text;
int start_glyph;
int start_index;
int start_char;
int end_glyph;
int end_index;
int end_char;
}
PangoGlyphItemIter 是 PangoGlyphItem 中群集的迭代器。
迭代器的向前方向是文本的逻辑方向。即,随着 start_index 和 start_char 值的增加。如果 glyph_item 是从右到左的(即,如果 glyph_item->item->analysis.level 是奇数),那么 start_glyph 会在迭代器向前移动时减少。此外,在从右到左的情况下,start_glyph 会大于 end_glyph。
应使用 pango_glyph_item_iter_init_start() 或 pango_glyph_item_iter_init_end() 分别针对正向和反向迭代初始化迭代器,并使用 pango_glyph_item_iter_next_cluster() 和 pango_glyph_item_iter_prev_cluster() 的任意所需混合进行遍历。
用于对群集进行正向迭代的常见用法是
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))
{
...
}
请注意,text 是布局的文本开头,然后按 glyph_item->item->offset 进行索引以获取 glyph_item 的文本。start_index 和 end_index 值可以直接索引到 text 中。但是,start_glyph、end_glyph、start_char 和 end_char 值是 glyph_item 的零基。对于每个群集,起始变量指向的项包含在群集中,而结束变量指向的项不包含在群集中。
PangoGlyphItemIter 的任何成员都不应手动修改。
结构成员
glyph_item无可用描述。
text无可用描述。
start_glyph无可用描述。
start_index无可用描述。
start_char无可用描述。
end_glyph无可用描述。
end_index无可用描述。
end_char无可用描述。
自版本 1.22 起提供
实例方法
pango_glyph_item_iter_prev_cluster
将迭代器移动到字符项中的前一个群集。有关群集顺序的详细信息,请参见 PangoGlyphItemIter。
since: 1.22