<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSStringDrawingContext",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSStringDrawingContext"
  },
  "title" : "NSStringDrawingContext"
}
-->

# NSStringDrawingContext

An object that manages metrics for drawing attributed strings.

```
class NSStringDrawingContext
```

## Overview

Prior to drawing, you can create an instance of this class and use it to specify the minimum scale factor and tracking adjustments for a string. After drawing, you can retrieve the actual values that were used during drawing.

To use this class, allocate and initialize a new instance, set the minimum values, and pass your object to one of the corresponding <doc://com.apple.documentation/documentation/Foundation/NSAttributedString> methods that take the context object as a parameter. Upon completion of drawing, you can use the actual drawing values to make adjustments or record where the string was actually drawn.

## Topics

### Accessing the scale factors

[`minimumScaleFactor`](/documentation/UIKit/NSStringDrawingContext/minimumScaleFactor)

The scale factor that determines the smallest font size to use during drawing.

[`actualScaleFactor`](/documentation/UIKit/NSStringDrawingContext/actualScaleFactor)

The actual scale factor that the system applied to the font during drawing.

### Getting the drawing bounds

[`totalBounds`](/documentation/UIKit/NSStringDrawingContext/totalBounds)

The most recent bounding rectangle that the system used to draw the string.

### Deprecated

[`minimumTrackingAdjustment`](/documentation/UIKit/NSStringDrawingContext/minimumTrackingAdjustment)

The smallest amount of space, in points, to maintain between characters.

[`actualTrackingAdjustment`](/documentation/UIKit/NSStringDrawingContext/actualTrackingAdjustment)

The actual tracking value that the system applied during drawing.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)