GlyphItemProtocol
public protocol GlyphItemProtocol
A PangoGlyphItem is a pair of a PangoItem and the glyphs
resulting from shaping the items text.
As an example of the usage of PangoGlyphItem, the results
of shaping text with PangoLayout is a list of PangoLayoutLine,
each of which contains a list of PangoGlyphItem.
The GlyphItemProtocol protocol exposes the methods and properties of an underlying PangoGlyphItem 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 GlyphItem.
Alternatively, use GlyphItemRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
PangoGlyphIteminstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
glyph_item_ptrDefault implementationTyped pointer to the underlying
PangoGlyphIteminstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
PangoGlyphIteminstance.Declaration
Swift
var glyph_item_ptr: UnsafeMutablePointer<PangoGlyphItem>! { get } -
Required Initialiser for types conforming to
GlyphItemProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
applyAttrs(text:Extension methodlist: ) Splits a shaped item (
PangoGlyphItem) 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 ([method
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
glyph_item; it will be reused as one of the elements in the list.Declaration
Swift
@inlinable func applyAttrs<AttrListT>(text: UnsafePointer<CChar>!, list: AttrListT) -> GLib.SListRef! where AttrListT : AttrListProtocol -
copy()Extension methodMake a deep copy of an existing
PangoGlyphItemstructure.Declaration
Swift
@inlinable func copy() -> Pango.GlyphItemRef! -
free()Extension methodFrees a
PangoGlyphItemand resources to which it points.Declaration
Swift
@inlinable func free() -
getLogicalWidths(text:Extension methodlogicalWidths: ) Given a
PangoGlyphItemand the corresponding text, determine the 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 [method
Pango.GlyphString.get_logical_widths].Declaration
Swift
@inlinable func getLogicalWidths(text: UnsafePointer<CChar>!, logicalWidths: UnsafeMutablePointer<CInt>!) -
letterSpace(text:Extension methodlogAttrs: letterSpacing: ) Adds spacing between the graphemes of
glyph_itemto give the effect of typographic letter spacing.Declaration
Swift
@inlinable func letterSpace(text: UnsafePointer<CChar>!, logAttrs: UnsafeMutablePointer<PangoLogAttr>!, letterSpacing: Int) -
split(text:Extension methodsplitIndex: ) Modifies
origto cover only the text aftersplit_index, and returns a new item that covers the text beforesplit_indexthat used to be inorig.You can think of
split_indexas the length of the returned item.split_indexmay not be 0, and it may not be greater than or equal to the length oforig(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.)Declaration
Swift
@inlinable func split(text: UnsafePointer<CChar>!, splitIndex: Int) -> Pango.GlyphItemRef! -
itemExtension methodcorresponding
PangoItemDeclaration
Swift
@inlinable var item: ItemRef! { get set } -
glyphsExtension methodcorresponding
PangoGlyphStringDeclaration
Swift
@inlinable var glyphs: GlyphStringRef! { get set } -
yOffsetExtension methodshift of the baseline, relative to the baseline of the containing line. Positive values shift upwards
Declaration
Swift
@inlinable var yOffset: gint { get set } -
startXOffsetExtension methodhorizontal displacement to apply before the glyph item. Positive values shift right
Declaration
Swift
@inlinable var startXOffset: gint { get set } -
endXOffsetExtension methodhorizontal displacement to apply after th glyph item. Positive values shift right
Declaration
Swift
@inlinable var endXOffset: gint { get set }
View on GitHub
Install in Dash
GlyphItemProtocol Protocol Reference