ItemProtocol
public protocol ItemProtocol
The PangoItem structure stores information about a segment of text.
You typically obtain PangoItems by itemizing a piece of text
with [funcitemize].
The ItemProtocol protocol exposes the methods and properties of an underlying PangoItem 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 Item.
Alternatively, use ItemRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
PangoIteminstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
item_ptrDefault implementationTyped pointer to the underlying
PangoIteminstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
PangoIteminstance.Declaration
Swift
var item_ptr: UnsafeMutablePointer<PangoItem>! { get } -
Required Initialiser for types conforming to
ItemProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
applyAttrs(iter:Extension method) Add attributes to a
PangoItem.The idea is that you have attributes that don’t affect itemization, such as font features, so you filter them out using [method
Pango.AttrList.filter], itemize your text, then reapply the attributes to the resulting items using this function.The
itershould be positioned before the range of the item, and will be advanced past it. This function is meant to be called in a loop over the items resulting from itemization, while passing the iter to each call.Declaration
Swift
@inlinable func applyAttrs<AttrIteratorT>(iter: AttrIteratorT) where AttrIteratorT : AttrIteratorProtocol -
copy()Extension methodCopy an existing
PangoItemstructure.Declaration
Swift
@inlinable func copy() -> Pango.ItemRef! -
free()Extension methodFree a
PangoItemand all associated memory.Declaration
Swift
@inlinable func free() -
split(splitIndex:Extension methodsplitOffset: ) 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).split_offsetis the length of the first item in chars, and must be provided because the text used to generate the item isn’t available, sopango_item_split()can’t count the char length of the split items itself.Declaration
Swift
@inlinable func split(splitIndex: Int, splitOffset: Int) -> Pango.ItemRef! -
shapeItem(paragraphText:Extension methodparagraphLength: logAttrs: glyphs: flags: ) Convert the characters in
iteminto glyphs.This is similar to [func
Pango.shape_with_flags], except it takes aPangoIteminstead of separateitem_textandanalysisarguments. It also takeslog_attrs, which may be used in implementing text transforms.Note that the extra attributes in the
analyisthat is returned from [funcPango.itemize] have indices that are relative to the entire paragraph, so you do not pass the full paragraph text asparagraph_text, you need to subtract the item offset from their indices before calling [funcPango.shape_with_flags].Declaration
Swift
@inlinable func shapeItem<GlyphStringT>(paragraphText: UnsafePointer<CChar>? = nil, paragraphLength: Int, logAttrs: LogAttrRef? = nil, glyphs: GlyphStringT, flags: ShapeFlags) where GlyphStringT : GlyphStringProtocol -
shapeItem(paragraphText:Extension methodparagraphLength: logAttrs: glyphs: flags: ) Convert the characters in
iteminto glyphs.This is similar to [func
Pango.shape_with_flags], except it takes aPangoIteminstead of separateitem_textandanalysisarguments. It also takeslog_attrs, which may be used in implementing text transforms.Note that the extra attributes in the
analyisthat is returned from [funcPango.itemize] have indices that are relative to the entire paragraph, so you do not pass the full paragraph text asparagraph_text, you need to subtract the item offset from their indices before calling [funcPango.shape_with_flags].Declaration
Swift
@inlinable func shapeItem<GlyphStringT, LogAttrT>(paragraphText: UnsafePointer<CChar>? = nil, paragraphLength: Int, logAttrs: LogAttrT?, glyphs: GlyphStringT, flags: ShapeFlags) where GlyphStringT : GlyphStringProtocol, LogAttrT : LogAttrProtocol -
offsetExtension methodbyte offset of the start of this item in text.
Declaration
Swift
@inlinable var offset: gint { get set } -
lengthExtension methodlength of this item in bytes.
Declaration
Swift
@inlinable var length: gint { get set } -
numCharsExtension methodnumber of Unicode characters in the item.
Declaration
Swift
@inlinable var numChars: gint { get set } -
analysisExtension methodanalysis results for the item.
Declaration
Swift
@inlinable var analysis: PangoAnalysis { get set }
View on GitHub
Install in Dash
ItemProtocol Protocol Reference