---
title: CTLine
framework: coretext
role: symbol
role_heading: Class
path: coretext/ctline
---

# CTLine

A line of text.

## Declaration

```swift
class CTLine
```

## Overview

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

- [CTLineCreateWithAttributedString(_:)](coretext/ctlinecreatewithattributedstring(_:).md)
- [CTLineCreateTruncatedLine(_:_:_:_:)](coretext/ctlinecreatetruncatedline(_:_:_:_:).md)
- [CTLineCreateJustifiedLine(_:_:_:)](coretext/ctlinecreatejustifiedline(_:_:_:).md)

### Drawing the Line

- [CTLineDraw(_:_:)](coretext/ctlinedraw(_:_:).md)

### Getting Line Data

- [CTLineGetGlyphCount(_:)](coretext/ctlinegetglyphcount(_:).md)
- [CTLineGetGlyphRuns(_:)](coretext/ctlinegetglyphruns(_:).md)
- [CTLineGetStringRange(_:)](coretext/ctlinegetstringrange(_:).md)
- [CTLineGetPenOffsetForFlush(_:_:_:)](coretext/ctlinegetpenoffsetforflush(_:_:_:).md)

### Measuring Lines

- [CTLineGetImageBounds(_:_:)](coretext/ctlinegetimagebounds(_:_:).md)
- [CTLineGetTypographicBounds(_:_:_:_:)](coretext/ctlinegettypographicbounds(_:_:_:_:).md)
- [CTLineGetTrailingWhitespaceWidth(_:)](coretext/ctlinegettrailingwhitespacewidth(_:).md)

### Getting Line Positioning

- [CTLineGetStringIndexForPosition(_:_:)](coretext/ctlinegetstringindexforposition(_:_:).md)
- [CTLineGetOffsetForStringIndex(_:_:_:)](coretext/ctlinegetoffsetforstringindex(_:_:_:).md)
- [CTLineEnumerateCaretOffsets(_:_:)](coretext/ctlineenumeratecaretoffsets(_:_:).md)

### Getting the Type Identifier

- [CTLineGetTypeID()](coretext/ctlinegettypeid().md)

### Constants

- [CTLineTruncationType](coretext/ctlinetruncationtype.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)

## See Also

### Opaque Types

- [CTFont](coretext/ctfont.md)
- [CTFontCollection](coretext/ctfontcollection.md)
- [CTFontDescriptor](coretext/ctfontdescriptor.md)
- [CTFrame](coretext/ctframe.md)
- [CTFramesetter](coretext/ctframesetter.md)
- [CTGlyphInfo](coretext/ctglyphinfo.md)
- [CTParagraphStyle](coretext/ctparagraphstyle.md)
- [CTRun](coretext/ctrun.md)
- [CTRunDelegate](coretext/ctrundelegate.md)
- [CTTextTab](coretext/cttexttab.md)
- [CTTypesetter](coretext/cttypesetter.md)
