StyledText.FontName

From Xojo Documentation

Method

StyledText.FontName(Start as Integer,Length as Integer) As String

New in 2019r2

Supported for all project types and targets.

Gets or sets the font for the selected text in Text.

Notes

Start is the starting position in Text (0-based). The default value for Length is 1. Returns a String. Use assignment syntax to set the value.

Note: On macOS, if Start + Length is greater than the Length of the String, then an OutOfBoundsException is raised. On other platforms, the change will apply to the end of the string.

Example

Change the font for some text in a TextArea:

TextArea1.StyledText.Value = "Hello, World!"
TextArea1.StyledText.FontName(7, 5) = "Courier"