<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/setIntAttribute(_:value:forGlyphAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)setIntAttribute:value:forGlyphAtIndex:"
  },
  "title" : "setIntAttribute(_:value:forGlyphAt:)"
}
-->

# setIntAttribute(_:value:forGlyphAt:)

Sets a custom attribute value for a given glyph.

```
func setIntAttribute(_ attributeTag: Int, value val: Int, forGlyphAt glyphIndex: Int)
```

## Parameters

`attributeTag`

The custom attribute.

`val`

The new attribute value.

`glyphIndex`

Index of the glyph whose attribute is set.

## Discussion

Custom attributes are glyph attributes such as `NSGlyphInscription` or attributes defined by subclasses. Nonnegative tags are reserved by Apple; you can define your own attributes with negative tags and set values using this method.

This method is part of the `NSGlyphStorage` protocol, for use by the glyph generator to set attributes. It is not usually necessary for anyone but the glyph generator (and perhaps the typesetter) to call it. It is provided as a public method so subclasses can extend it to accept other glyph attributes. To add new glyph attributes to the text system you must do two things. First, you need to arrange for the glyph generator or typesetter to generate and interpret it. Second, you need to subclass `NSLayoutManager` to provide someplace to store the new attribute, overriding this method and [`intAttribute(_:forGlyphAt:)`](/documentation/AppKit/NSLayoutManager/intAttribute(_:forGlyphAt:)) to recognize the new attribute tags and respond to them, while passing any other attributes to the superclass implementation. The `NSLayoutManager` implementation understands the glyph attributes which it is prepared to store, as enumerated in [Glyph Attributes](/documentation/AppKit/glyph-attributes).

---

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)