Skip to main content
Version: 20 R7 BETA

Font file

Font file ( fontFamily {; fontStyle} ) : any

ParameterTypeDescription
fontFamilyTextName of font family
fontStyleIntegerFont style: 0=normal (default), 1=bold, 2=italic
Function resultNull, ObjectFont file object

Description

The Font file command returns an object describing the font file in your OS corresponding to the fontFamily and, optionally, fontStyle you passed in parameter.

If the font designated by fontFamily is not installed in the OS, the command returns a Null object.

The optional fontStyle parameter allows to define a style variation to get. You can pass one or a combination of the following constants from the Font Styles theme (any other value is ignored):

ConstantTypeValue
BoldInteger1
ItalicInteger2
PlainInteger0

Example

You want to make sure the font used in a text area is available on the user system for a correct display:

 var $fontName : Text
 var $fontStyle : Integer
 var $fontFile : Object
 $fontName:=OBJECT Get font(*;"vText")
 $fontStyle:=OBJECT Get font style(*;"vText")
 $fontFile:=Font file($fontName;$fontStyle)
 If($fontFile=Null)
    ALERT("Defined font is not available, please install: "+$fontName)
 End if

See also

OBJECT SET FONT