---
title: CATextLayer
framework: quartzcore
role: symbol
role_heading: Class
path: quartzcore/catextlayer
---

# CATextLayer

A layer that provides simple text layout and rendering of plain or attributed strings.

## Declaration

```swift
class CATextLayer
```

## Overview

Overview The first line is aligned to the top of the layer. note: CATextLayer disables sub-pixel antialiasing when rendering text. Text can only be drawn using sub-pixel antialiasing when it is composited into an existing opaque background at the same time that it’s rasterized. There is no way to draw text with sub-pixel antialiasing by itself, whether into an image or a layer, in advance of having the background pixels to weave the text pixels into. Setting the opacity property of the layer to true does not change the rendering mode. note: In macOS, when a CATextLayer instance is positioned using the CAConstraintLayoutManager class the bounds of the layer is resized to fit the text content.

## Topics

### Getting and Setting the Text

- [string](quartzcore/catextlayer/string.md)

### Text Visual Properties

- [font](quartzcore/catextlayer/font.md)
- [fontSize](quartzcore/catextlayer/fontsize.md)
- [foregroundColor](quartzcore/catextlayer/foregroundcolor.md)
- [allowsFontSubpixelQuantization](quartzcore/catextlayer/allowsfontsubpixelquantization.md)

### Text Alignment and Truncation

- [isWrapped](quartzcore/catextlayer/iswrapped.md)
- [alignmentMode](quartzcore/catextlayer/alignmentmode.md)
- [truncationMode](quartzcore/catextlayer/truncationmode.md)

### Constants

- [Truncation modes](quartzcore/truncation-modes.md)
- [Horizontal alignment modes](quartzcore/horizontal-alignment-modes.md)

## Relationships

### Inherits From

- [CALayer](quartzcore/calayer.md)

### Conforms To

- [CAMediaTiming](quartzcore/camediatiming.md)
- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Text, Shapes, and Gradients

- [CAShapeLayer](quartzcore/cashapelayer.md)
- [CAGradientLayer](quartzcore/cagradientlayer.md)
