ComposedFrame
public class ComposedFrame
Represents a frame containing multiple lines of text. It is the output resulting from text-framing process performed by a typesetter.
-
The UTF-16 range of this frame in source string.
Declaration
Swift
public let codeUnitRange: Range<Int>
-
The index to the first character of this frame in source string.
Declaration
Swift
public var startIndex: String.Index { get }
-
The index after the last character of this frame in source string.
Declaration
Swift
public var endIndex: String.Index { get }
-
The width of this frame.
Declaration
Swift
public internal(set) var width: CGFloat { get }
-
The height of this frame.
Declaration
Swift
public internal(set) var height: CGFloat { get }
-
The array containing all the lines of this frame.
Declaration
Swift
public let lines: [ComposedLine]
-
Returns the index of line containing the specified UTF-16 code unit index.
Declaration
Swift
public func indexOfLine(forCodeUnitAt index: Int) -> Int
Parameters
index
The index of UTF-16 code unit for which to return the line index.
Return Value
The index of line containing the specified UTF-16 code unit index.
-
Returns the index of line containing the specified character index.
Declaration
Swift
public func indexOfLine(forCharacterAt index: String.Index) -> Int
Parameters
index
The index of character for which to return the line index.
Return Value
The index of line containing the specified character index.
-
Returns the index of a suitable line representing the specified position.
Declaration
Swift
public func indexOfLine(at position: CGPoint) -> Int
Parameters
position
The position for which to return the line index.
Return Value
The index of a suitable line representing the specified position.
-
Creates a path that contains a set of rectangles covering the specified UTF-16 code unit range.
Declaration
Swift
public func selectionPath(forCodeUnitRange codeUnitRange: Range<Int>) -> CGPath
Parameters
codeUnitRange
The selection range in source string.
Return Value
A path that contains a set of rectangles covering the specified UTF-16 range.
-
Creates a path that contains a set of rectangles covering the specified character range.
Declaration
Swift
public func selectionPath(forCharacterRange characterRange: Range<String.Index>) -> CGPath
Parameters
characterRange
The selection range in source string.
Return Value
A path that contains a set of rectangles covering the specified character range.
-
Draws this frame in the
context
with the specified renderer.Declaration
Swift
public func draw(with renderer: Renderer, in context: CGContext, at point: CGPoint)
Parameters
renderer
The renderer with which to draw the frame.
context
The context in which to draw the frame.
point
The position at which to draw the frame.