---
title: "glyph(withName:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsfont/glyph(withname:)"
---

# glyph(withName:)

Returns the named encoded glyph, or –1 if the receiver contains no such glyph.

## Declaration

```swift
func glyph(withName name: String) -> NSGlyph
```

## Parameters

- `name`: The name of the glyph.

## Return Value

Return Value The named encoded glyph.

## Discussion

Discussion Returns –1 if the glyph named glyphName isn’t encoded. Glyph names in fonts do not always accurately identify the glyph. The layout manager, an instance of NSLayoutManager, finds the correspondence between characters and glyphs. See NSLayoutManager for more information.

## See Also

### Instance Methods

- [advancement(forGlyph:)](appkit/nsfont/advancement(forglyph:).md)
- [boundingRect(forGlyph:)](appkit/nsfont/boundingrect(forglyph:).md)
- [getAdvancements(_:forGlyphs:count:)](appkit/nsfont/getadvancements(_:forglyphs:count:).md)
- [getAdvancements(_:forPackedGlyphs:length:)](appkit/nsfont/getadvancements(_:forpackedglyphs:length:).md)
- [getBoundingRects(_:forGlyphs:count:)](appkit/nsfont/getboundingrects(_:forglyphs:count:).md)
- [screenFont(with:)](appkit/nsfont/screenfont(with:).md)
- [withSize(_:)](appkit/nsfont/withsize(_:).md)
