---
title: "glyphIndex(for:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/glyphindex(for:in:)"
---

# glyphIndex(for:in:)

Returns the index of the glyph at the specified location in a text container.

## Declaration

```swift
func glyphIndex(for point: NSPoint, in container: NSTextContainer) -> Int
```

## Discussion

Discussion This method is a primitive for glyphIndex(for:in:fractionOfDistanceThroughGlyph:). You should always call the main method, not the primitives. Overriding should be done for the primitive methods. Existing subclasses that do not do this overriding will not have their implementations available to Java developers.

## See Also

### Performing advanced layout queries

- [boundingRect(forGlyphRange:in:)](appkit/nslayoutmanager/boundingrect(forglyphrange:in:).md)
- [characterIndex(for:in:fractionOfDistanceBetweenInsertionPoints:)](appkit/nslayoutmanager/characterindex(for:in:fractionofdistancebetweeninsertionpoints:).md)
- [characterRange(forGlyphRange:actualGlyphRange:)](appkit/nslayoutmanager/characterrange(forglyphrange:actualglyphrange:).md)
- [enumerateEnclosingRects(forGlyphRange:withinSelectedGlyphRange:in:using:)](appkit/nslayoutmanager/enumerateenclosingrects(forglyphrange:withinselectedglyphrange:in:using:).md)
- [enumerateLineFragments(forGlyphRange:using:)](appkit/nslayoutmanager/enumeratelinefragments(forglyphrange:using:).md)
- [fractionOfDistanceThroughGlyph(for:in:)](appkit/nslayoutmanager/fractionofdistancethroughglyph(for:in:).md)
- [getLineFragmentInsertionPoints(forCharacterAt:alternatePositions:inDisplayOrder:positions:characterIndexes:)](appkit/nslayoutmanager/getlinefragmentinsertionpoints(forcharacterat:alternatepositions:indisplayorder:positions:characterindexes:).md)
- [glyphIndex(for:in:fractionOfDistanceThroughGlyph:)](appkit/nslayoutmanager/glyphindex(for:in:fractionofdistancethroughglyph:).md)
- [glyphRange(forBoundingRect:in:)](appkit/nslayoutmanager/glyphrange(forboundingrect:in:).md)
- [glyphRange(forBoundingRectWithoutAdditionalLayout:in:)](appkit/nslayoutmanager/glyphrange(forboundingrectwithoutadditionallayout:in:).md)
- [glyphRange(for:)](appkit/nslayoutmanager/glyphrange(for:).md)
- [glyphRange(forCharacterRange:actualCharacterRange:)](appkit/nslayoutmanager/glyphrange(forcharacterrange:actualcharacterrange:).md)
- [range(ofNominallySpacedGlyphsContaining:)](appkit/nslayoutmanager/range(ofnominallyspacedglyphscontaining:).md)
