<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSATSTypesetter/boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSATSTypesetter(im)boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:"
  },
  "title" : "boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:)"
}
-->

# boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:)

Returns the bounding rectangle for a control glyph, at the specified glyph position and character index in the text container.

```
func boundingBox(forControlGlyphAt glyphIndex: Int, for textContainer: NSTextContainer, proposedLineFragment proposedRect: NSRect, glyphPosition: NSPoint, characterIndex charIndex: Int) -> NSRect
```

## Discussion

Returns the bounding rectangle for the control glyph at `glyphIndex`, at the given `glyphPosition` and character index `charIndex`, in `textContainer`. The proposed line fragment rectangle is specified by `proposedRect`.

The typesetter calls this method when it encounters an [`NSControlGlyph`](/documentation/AppKit/NSControlGlyph). The default behavior is to return zero width for control glyphs. A subclass can override this method to do something different, such as implement a way to display control characters.

[`NSGlyphGenerator`](/documentation/AppKit/NSGlyphGenerator) can choose whether or not to map control characters to [`NSControlGlyph`](/documentation/AppKit/NSControlGlyph). Tab characters, for example, do not use this facility.

---

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)