CTLine

A line of text.

Overview

A CTLine object contains an array of glyph runs. Line objects are created by the typesetter during a framesetting operation and can draw themselves directly into a graphics context.

Topics

Creating Lines

func CTLineCreateWithAttributedString(CFAttributedString) -> CTLine

Creates a single immutable line object directly from an attributed string.

func CTLineCreateJustifiedLine(CTLine, CGFloat, Double) -> CTLine?

Creates a justified line from an existing line.

Drawing the Line

Getting Line Data

func CTLineGetGlyphCount(CTLine) -> CFIndex

Returns the total glyph count for the line object.

func CTLineGetGlyphRuns(CTLine) -> CFArray

Returns the array of glyph runs that make up the line object.

func CTLineGetStringRange(CTLine) -> CFRange

Gets the range of characters that originally spawned the glyphs in the line.

func CTLineGetPenOffsetForFlush(CTLine, CGFloat, Double) -> Double

Gets the pen offset required to draw flush text.

Getting the Type Identifier

func CTLineGetTypeID() -> CFTypeID

Returns the Core Foundation type identifier of the line object.

Data Types

class CTLine

A reference to a line object.

Constants

enum CTLineTruncationType

Truncation types required by the CTLineCreateTruncatedLine(_:_:_:_:) function to tell the truncation engine which type of truncation is being requested.

See Also

Opaque Types

CTFont

A font object.

CTFramesetter

Generate text frames.

CTGlyphInfo

Override a font's specified mapping from Unicode to the glyph ID.

CTParagraphStyle

Paragraph or ruler attributes in an attributed string.

CTTextTab

A tab in a paragraph style, storing an alignment type and location.

CTTypesetter

A typesetter which performs line layout.