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
PangoGlyphItem
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
glyph_item_ptr
Default implementationTyped pointer to the underlying
PangoGlyphItem
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
PangoGlyphItem
instance.Declaration
Swift
var glyph_item_ptr: UnsafeMutablePointer<PangoGlyphItem>! { get }
-
Required Initialiser for types conforming to
GlyphItemProtocol
Declaration
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
PangoGlyphItem
structure.Declaration
Swift
@inlinable func copy() -> Pango.GlyphItemRef!
-
free()
Extension methodFrees a
PangoGlyphItem
and resources to which it points.Declaration
Swift
@inlinable func free()
-
getLogicalWidths(text:
Extension methodlogicalWidths: ) Given a
PangoGlyphItem
and 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_item
to 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
orig
to cover only the text aftersplit_index
, and returns a new item that covers the text beforesplit_index
that used to be inorig
.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 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!
-
item
Extension methodcorresponding
PangoItem
Declaration
Swift
@inlinable var item: ItemRef! { get set }
-
glyphs
Extension methodcorresponding
PangoGlyphString
Declaration
Swift
@inlinable var glyphs: GlyphStringRef! { get set }
-
yOffset
Extension methodshift of the baseline, relative to the baseline of the containing line. Positive values shift upwards
Declaration
Swift
@inlinable var yOffset: gint { get set }
-
startXOffset
Extension methodhorizontal displacement to apply before the glyph item. Positive values shift right
Declaration
Swift
@inlinable var startXOffset: gint { get set }
-
endXOffset
Extension methodhorizontal displacement to apply after th glyph item. Positive values shift right
Declaration
Swift
@inlinable var endXOffset: gint { get set }