StyledText.Font

From Xojo Documentation

Method

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

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.Font(7, 5) = "Courier"