---
title: "substituteFont(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/substitutefont(for:)"
---

# substituteFont(for:)

Replaces the specified font with a suitable screen font if one is available.

## Declaration

```swift
func substituteFont(for originalFont: NSFont) -> NSFont
```

## Parameters

- `originalFont`: The font to replace.

## Return Value

Return Value A screen font suitable for use in place of originalFont, or simply originalFont if a screen font can’t be used or isn’t available.

## Discussion

Discussion A screen font can be substituted if the receiver is set to use screen fonts and if no NSTextView associated with the receiver is scaled or rotated.

## See Also

### Methods

- [showCGGlyphs(_:positions:count:font:matrix:attributes:in:)](appkit/nslayoutmanager/showcgglyphs(_:positions:count:font:matrix:attributes:in:).md)
- [invalidateGlyphs(onLayoutInvalidationForGlyphRange:)](appkit/nslayoutmanager/invalidateglyphs(onlayoutinvalidationforglyphrange:).md)
- [invalidateLayout(forCharacterRange:isSoft:actualCharacterRange:)](appkit/nslayoutmanager/invalidatelayout(forcharacterrange:issoft:actualcharacterrange:).md)
- [textStorage(_:edited:range:changeInLength:invalidatedRange:)](appkit/nslayoutmanager/textstorage(_:edited:range:changeinlength:invalidatedrange:).md)
- [insertGlyph(_:atGlyphIndex:characterIndex:)](appkit/nslayoutmanager/insertglyph(_:atglyphindex:characterindex:).md)
- [insertGlyphs(_:length:forStartingGlyphAt:characterIndex:)](appkit/nslayoutmanager/insertglyphs(_:length:forstartingglyphat:characterindex:).md)
- [glyph(at:)](appkit/nslayoutmanager/glyph(at:).md)
- [glyph(at:isValidIndex:)](appkit/nslayoutmanager/glyph(at:isvalidindex:).md)
- [replaceGlyph(at:withGlyph:)](appkit/nslayoutmanager/replaceglyph(at:withglyph:).md)
- [getGlyphs(_:range:)](appkit/nslayoutmanager/getglyphs(_:range:).md)
- [getGlyphs(in:glyphs:characterIndexes:glyphInscriptions:elasticBits:)](appkit/nslayoutmanager/getglyphs(in:glyphs:characterindexes:glyphinscriptions:elasticbits:).md)
- [getGlyphs(in:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:)](appkit/nslayoutmanager/getglyphs(in:glyphs:characterindexes:glyphinscriptions:elasticbits:bidilevels:).md)
- [deleteGlyphs(in:)](appkit/nslayoutmanager/deleteglyphs(in:).md)
- [setCharacterIndex(_:forGlyphAt:)](appkit/nslayoutmanager/setcharacterindex(_:forglyphat:).md)
- [intAttribute(_:forGlyphAt:)](appkit/nslayoutmanager/intattribute(_:forglyphat:).md)
