<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSATSTypesetter/textTab(forGlyphLocation:writingDirection:maxLocation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSATSTypesetter(im)textTabForGlyphLocation:writingDirection:maxLocation:"
  },
  "title" : "textTab(forGlyphLocation:writingDirection:maxLocation:)"
}
-->

# textTab(forGlyphLocation:writingDirection:maxLocation:)

Returns the text tab closest to the specified glyph location and not beyond a maximum position.

```
func textTab(forGlyphLocation glyphLocation: CGFloat, writingDirection direction: NSWritingDirection, maxLocation: CGFloat) -> NSTextTab?
```

## Discussion

The typesetter calls this method whenever it finds a tab character. To determine the width to advance the next glyph, the typesetter examines the [`NSParagraphStyle`](/documentation/AppKit/NSParagraphStyle) tab array and the default tab interval.

---

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)