CTLine

The CTLine opaque type represents 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 Line Positioning

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

The CTFont opaque type represents a Core Text font object. Font objects represent fonts to an application, providing access to characteristics of the font, such as point size, transform matrix, and other attributes. Fonts provide assistance in laying out glyphs relative to one another and are used to establish the current font when drawing in a graphics context.

CTFontCollection

The CTFontCollection opaque type represents a font collection, that is, a group of font descriptors taken together as a single object.

CTFontDescriptor

The CTFontDescriptor opaque type represents a font descriptor, that is, a dictionary of attributes (such as name, point size, and variation) that can completely specify a font.

CTFrame

The CTFrame opaque type represents a frame containing multiple lines of text. The frame object is the output resulting from the text-framing process performed by a framesetter object.

CTFramesetter

The CTFramesetter opaque type is used to generate text frames. That is, CTFramesetter is an object factory for CTFrame objects.

CTGlyphInfo

The CTGlyphInfo opaque type enables you to override a font's specified mapping from Unicode to the glyph ID.

CTParagraphStyle

The CTParagraphStyle opaque type represents paragraph or ruler attributes in an attributed string.

CTRun

The CTRun opaque type represents a glyph run, which is a set of consecutive glyphs sharing the same attributes and direction.

CTRunDelegate

The CTRunDelegate opaque type represents a run delegate, which is assigned to a run (attribute range) to control typographic traits such glyph ascent, glyph descent, and glyph width.

CTTextTab

The CTTextTab opaque type represents a tab in a paragraph style, storing an alignment type and location.

CTTypesetter

The CTTypesetter opaque type represents a typesetter, which performs line layout.