Font

From Real Software Documentation

Jump to: navigation, search
Method

Used to access the names of fonts installed on the user’s computer.


Syntax

result=Font(index)

Part Type Description
result String The name of the font whose index number is passed. Result is in the appropriate WorldScript encoding.
Changed 5.5
index Integer The number of the font.

Notes

Fonts are accessed in alphabetical order where font 0 is the first font. Use the FontCount function to determine the number of fonts.

Under Mac OS X Cocoa, Font returns font families instead of fonts. This is closer to the Carbon behavior, but it does not return identical results.

Examples

This is an example of a function that determines if the font named passed is installed on the user’s computer:

Function FontAvailable(FontName As String) as Boolean
Dim i,n as Integer
n=FontCount-1
For i=0 to n
If Font(i)=FontName Then
Return True
Exit
End If
Next
Return False


This example dynamically creates a Font menu using a menu item array named FontFontName:

Dim m as MenuItem
Dim i,n as Integer
n= FontCount-1
FontFontName(0).Text=Font(0)
For i=1 to n
m=New FontFontName
m.Text=Font(i)
Next

See Also

FontCount function.

Personal tools