Pango.GlyphItem¶
Fields¶
| Name | Type | Access | Description | 
|---|---|---|---|
| glyphs | Pango.GlyphString | r/w | corresponding Pango.GlyphString. | 
| item | Pango.Item | r/w | corresponding Pango.Item. | 
Methods¶
| apply_attrs(text, list) | |
| copy() | |
| free() | |
| get_logical_widths(text, logical_widths) | |
| letter_space(text, log_attrs, letter_spacing) | |
| split(text, split_index) | 
Details¶
- 
class Pango.GlyphItem¶
- A - Pango.GlyphItemis a pair of a- Pango.Itemand the glyphs resulting from shaping the text corresponding to an item. As an example of the usage of- Pango.GlyphItem, the results of shaping text with- Pango.Layoutis a list of- Pango.LayoutLine, each of which contains a list of- Pango.GlyphItem.- 
apply_attrs(text, list)[source]¶
- Parameters: - text (str) – text that list applies to
- list (Pango.AttrList) – aPango.AttrList
 - Returns: - a list of glyph items resulting from splitting self. Free the elements using - Pango.GlyphItem.free(), the list using g_slist_free().- Return type: - Splits a shaped item ( - Pango.GlyphItem) into multiple items based on an attribute list. The idea is that if you have attributes that don’t affect shaping, such as color or underline, to avoid affecting shaping, you filter them out (- Pango.AttrList.filter()), apply the shaping process and then reapply them to the result using this function.- All attributes that start or end inside a cluster are applied to that cluster; for instance, if half of a cluster is underlined and the other-half strikethrough, then the cluster will end up with both underline and strikethrough attributes. In these cases, it may happen that item->extra_attrs for some of the result items can have multiple attributes of the same type. - This function takes ownership of self; it will be reused as one of the elements in the list. - New in version 1.2. 
- text (
 - 
copy()[source]¶
- Returns: - the newly allocated - Pango.GlyphItem, which should be freed with- Pango.GlyphItem.free(), or- Noneif self was- None.- Return type: - Pango.GlyphItemor- None- Make a deep copy of an existing - Pango.GlyphItemstructure.- New in version 1.20. 
 - 
free()[source]¶
- Frees a - Pango.GlyphItemand resources to which it points.- New in version 1.6. 
 - 
get_logical_widths(text, logical_widths)[source]¶
- Parameters: - Given a - Pango.GlyphItemand the corresponding text, determine the screen width corresponding to each character. When multiple characters compose a single cluster, the width of the entire cluster is divided equally among the characters.- See also - Pango.GlyphString.get_logical_widths().- New in version 1.26. 
 - 
letter_space(text, log_attrs, letter_spacing)[source]¶
- Parameters: - text (str) – text that self corresponds to (glyph_item->item->offset is an offset from the start of text)
- log_attrs ([Pango.LogAttr]) – logical attributes for the item (the first logical attribute refers to the position before the first character in the item)
- letter_spacing (int) – amount of letter spacing to add in Pango units. May be negative, though too large negative values will give ugly results.
 - Adds spacing between the graphemes of self to give the effect of typographic letter spacing. - New in version 1.6. 
- text (
 - 
split(text, split_index)[source]¶
- Parameters: - Returns: - the newly allocated item representing text before split_index, which should be freed with - Pango.GlyphItem.free().- Return type: - Modifies self to cover only the text after split_index, and returns a new item that covers the text before split_index that used to be in self. You can think of split_index as the length of the returned item. split_index may not be 0, and it may not be greater than or equal to the length of self (that is, there must be at least one byte assigned to each item, you can’t create a zero-length item). - This function is similar in function to - Pango.Item.split() (and uses it internally.)- New in version 1.2. 
 
-