---
title: "setAttachmentSize(_:forGlyphRange:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/setattachmentsize(_:forglyphrange:)"
---

# setAttachmentSize(_:forGlyphRange:)

Sets the size to use when drawing a glyph that represents an attachment.

## Declaration

```swift
func setAttachmentSize(_ attachmentSize: NSSize, forGlyphRange glyphRange: NSRange)
```

## Parameters

- `attachmentSize`: The glyph size to set.
- `glyphRange`: The attachment glyph’s position in the glyph stream.

## Discussion

Discussion For a glyph corresponding to an attachment, this method should be called to set the size for the attachment cell to occupy. The glyph’s value should be NSControlGlyph. 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

- [setDrawsOutsideLineFragment(_:forGlyphAt:)](appkit/nslayoutmanager/setdrawsoutsidelinefragment(_:forglyphat:).md)
- [setExtraLineFragmentRect(_:usedRect:textContainer:)](appkit/nslayoutmanager/setextralinefragmentrect(_:usedrect:textcontainer:).md)
- [setLineFragmentRect(_:forGlyphRange:usedRect:)](appkit/nslayoutmanager/setlinefragmentrect(_:forglyphrange:usedrect:).md)
- [setLocation(_:forStartOfGlyphRange:)](appkit/nslayoutmanager/setlocation(_:forstartofglyphrange:).md)
- [setNotShownAttribute(_:forGlyphAt:)](appkit/nslayoutmanager/setnotshownattribute(_:forglyphat:).md)
