---
title: "setLocation(_:forStartOfGlyphRange:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nslayoutmanager/setlocation(_:forstartofglyphrange:)"
---

# setLocation(_:forStartOfGlyphRange:)

Sets the location for the first glyph in the specified range.

## Declaration

```swift
func setLocation(_ location: CGPoint, forStartOfGlyphRange glyphRange: NSRange)
```

## Parameters

- `location`: The location to which the first glyph is set, relative to the origin of the glyph’s line fragment origin.
- `glyphRange`: The glyphs whose location is set.

## Discussion

Discussion Setting the location for a glyph range implies that its first glyph is not nominally spaced with respect to the previous glyph. In the course of layout, all glyphs should end up being included in a range passed to this method, but only glyphs that start a new nominal range should be at the start of such ranges. The first glyph in a line fragment should always start a new nominal range. Glyph locations are given relative to their line fragment rectangle’s origin. Before setting the location for a glyph range, you must specify the text container with setTextContainer(_:forGlyphRange:) and the line fragment rectangle with setLineFragmentRect(_:forGlyphRange:usedRect:). This method is used by the layout mechanism and should be invoked only during typesetting, in almost all cases only by the typesetter. For example, a custom typesetter might invoke it.

## See Also

### Setting layout information

- [setAttachmentSize(_:forGlyphRange:)](uikit/nslayoutmanager/setattachmentsize(_:forglyphrange:).md)
- [setDrawsOutsideLineFragment(_:forGlyphAt:)](uikit/nslayoutmanager/setdrawsoutsidelinefragment(_:forglyphat:).md)
- [setExtraLineFragmentRect(_:usedRect:textContainer:)](uikit/nslayoutmanager/setextralinefragmentrect(_:usedrect:textcontainer:).md)
- [setLineFragmentRect(_:forGlyphRange:usedRect:)](uikit/nslayoutmanager/setlinefragmentrect(_:forglyphrange:usedrect:).md)
- [setNotShownAttribute(_:forGlyphAt:)](uikit/nslayoutmanager/setnotshownattribute(_:forglyphat:).md)
