---
title: "CTFontCreateForString(_:_:_:)"
framework: coretext
role: symbol
role_heading: Function
path: "coretext/ctfontcreateforstring(_:_:_:)"
---

# CTFontCreateForString(_:_:_:)

Returns a font reference that most accurately maps the string range based on the current font.

## Declaration

```swift
func CTFontCreateForString(_ currentFont: CTFont, _ string: CFString, _ range: CFRange) -> CTFont
```

## Parameters

- `currentFont`: The current font that contains a valid cascade list.
- `string`: A Unicode string containing characters that can’t be encoded by the current font.
- `range`: A doc://com.apple.documentation/documentation/CoreFoundation/CFRange structure specifying the range of the string to map.

## Return Value

Return Value The best substitute font from the cascade list of the current font that can encode the specified string range.

## Discussion

Discussion If the current font can encode the string range, the function retains and returns the font.

## See Also

### Related Documentation

- [CTFontCopyCharacterSet(_:)](coretext/ctfontcopycharacterset(_:).md)
- [CTFontGetGlyphsForCharacters(_:_:_:_:)](coretext/ctfontgetglyphsforcharacters(_:_:_:_:).md)
- [kCTFontCascadeListAttribute](coretext/kctfontcascadelistattribute.md)

### Creating Fonts

- [CTFontCreateWithName(_:_:_:)](coretext/ctfontcreatewithname(_:_:_:).md)
- [CTFontCreateWithNameAndOptions(_:_:_:_:)](coretext/ctfontcreatewithnameandoptions(_:_:_:_:).md)
- [CTFontCreateWithFontDescriptor(_:_:_:)](coretext/ctfontcreatewithfontdescriptor(_:_:_:).md)
- [CTFontCreateWithFontDescriptorAndOptions(_:_:_:_:)](coretext/ctfontcreatewithfontdescriptorandoptions(_:_:_:_:).md)
- [CTFontCreateUIFontForLanguage(_:_:_:)](coretext/ctfontcreateuifontforlanguage(_:_:_:).md)
- [CTFontCreateCopyWithAttributes(_:_:_:_:)](coretext/ctfontcreatecopywithattributes(_:_:_:_:).md)
- [CTFontCreateCopyWithSymbolicTraits(_:_:_:_:_:)](coretext/ctfontcreatecopywithsymbolictraits(_:_:_:_:_:).md)
- [CTFontCreateCopyWithFamily(_:_:_:_:)](coretext/ctfontcreatecopywithfamily(_:_:_:_:).md)
- [CTFontCreateForStringWithLanguage(_:_:_:_:)](coretext/ctfontcreateforstringwithlanguage(_:_:_:_:).md)
