---
title: "location(forGlyphAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/location(forglyphat:)"
---

# location(forGlyphAt:)

Returns the location for the specified glyph within its line fragment.

## Declaration

```swift
func location(forGlyphAt glyphIndex: Int) -> NSPoint
```

## Parameters

- `glyphIndex`: The glyph whose location is returned.

## Return Value

Return Value The location of the given glyph.

## Discussion

Discussion If the given glyph does not have an explicit location set for it (for example, if it is part of (but not first in) a sequence of nominally spaced characters), the location is calculated by glyph advancements from the location of the most recent preceding glyph with a location set. Glyph locations are relative to their line fragment rectangle’s origin. The line fragment rectangle in turn is defined in the coordinate system of the text container where it resides. This method causes glyph generation and layout for the line fragment containing the specified glyph, or if noncontiguous layout is not enabled, up to and including that line fragment.

## See Also

### Getting layout information

- [attachmentSize(forGlyphAt:)](appkit/nslayoutmanager/attachmentsize(forglyphat:).md)
- [drawsOutsideLineFragment(forGlyphAt:)](appkit/nslayoutmanager/drawsoutsidelinefragment(forglyphat:).md)
- [extraLineFragmentRect](appkit/nslayoutmanager/extralinefragmentrect.md)
- [extraLineFragmentTextContainer](appkit/nslayoutmanager/extralinefragmenttextcontainer.md)
- [extraLineFragmentUsedRect](appkit/nslayoutmanager/extralinefragmentusedrect.md)
- [firstUnlaidCharacterIndex()](appkit/nslayoutmanager/firstunlaidcharacterindex().md)
- [firstUnlaidGlyphIndex()](appkit/nslayoutmanager/firstunlaidglyphindex().md)
- [getFirstUnlaidCharacterIndex(_:glyphIndex:)](appkit/nslayoutmanager/getfirstunlaidcharacterindex(_:glyphindex:).md)
- [lineFragmentRect(forGlyphAt:effectiveRange:)](appkit/nslayoutmanager/linefragmentrect(forglyphat:effectiverange:).md)
- [lineFragmentRect(forGlyphAt:effectiveRange:withoutAdditionalLayout:)](appkit/nslayoutmanager/linefragmentrect(forglyphat:effectiverange:withoutadditionallayout:).md)
- [lineFragmentUsedRect(forGlyphAt:effectiveRange:)](appkit/nslayoutmanager/linefragmentusedrect(forglyphat:effectiverange:).md)
- [lineFragmentUsedRect(forGlyphAt:effectiveRange:withoutAdditionalLayout:)](appkit/nslayoutmanager/linefragmentusedrect(forglyphat:effectiverange:withoutadditionallayout:).md)
- [notShownAttribute(forGlyphAt:)](appkit/nslayoutmanager/notshownattribute(forglyphat:).md)
- [truncatedGlyphRange(inLineFragmentForGlyphAt:)](appkit/nslayoutmanager/truncatedglyphrange(inlinefragmentforglyphat:).md)
