<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/invalidateLayout(forCharacterRange:isSoft:actualCharacterRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:"
  },
  "title" : "invalidateLayout(forCharacterRange:isSoft:actualCharacterRange:)"
}
-->

# invalidateLayout(forCharacterRange:isSoft:actualCharacterRange:)

Invalidates the layout information for the glyphs mapped to the given range of characters.

```
func invalidateLayout(forCharacterRange charRange: NSRange, isSoft flag: Bool, actualCharacterRange actualCharRange: NSRangePointer?)
```

## Parameters

`charRange`

The character range for which glyphs are invalidated.

`flag`

If <doc://com.apple.documentation/documentation/Swift/true>, invalidates internal caches in the layout manager; if <doc://com.apple.documentation/documentation/Swift/false>, invalidates layout. See the discussion section.

`actualCharRange`

If not `NULL`, on output, the range of characters mapped to the glyphs whose layout information is invalidated. This range can be larger than the range of characters given due to the effect of context on glyphs and layout.

## Discussion

This method only invalidates information; it performs no glyph generation or layout. You should rarely need to invoke this method.

For code that needs to work on both OS X v10.5 and previous releases, the following procedures should be used. For OS X v10.4 and before, invalidation should consist of

1. Calling this method with the `flag` set to <doc://com.apple.documentation/documentation/Swift/true>, for the range that has actually become invalid.
2. Calling this method with the `flag` set to <doc://com.apple.documentation/documentation/Swift/false>, for the range (if any) that follows that range, usually extending to the end of the text, that might need to be moved due to relayout of the invalidated range.

As of OS X v10.5, the semantics of the `flag` parameter are slightly different. Soft layout holes are obsolete in macOS 10.5 and later, so the flag is no longer necessary. If the method is called with `flag` set to <doc://com.apple.documentation/documentation/Swift/false>, then it has the effect of invalidating layout.  If it’s called with the `flag` set to <doc://com.apple.documentation/documentation/Swift/true>, then it does not actually invalidate layout; it invalidates a number of internal caches, but otherwise has no effect, and in general is unnecessary.

This method is superseded by [`invalidateLayout(forCharacterRange:actualCharacterRange:)`](/documentation/AppKit/NSLayoutManager/invalidateLayout(forCharacterRange:actualCharacterRange:)) and will be deprecated in a future release.

---

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)