LoadFont

Family: Font · 2 forms

What it does

LoadFont writes to a Font object: it loads rather than reads. It takes szFontFile (a string), and answers an integer. That is the first of 2 forms.

Syntax

1
LoadFont(szFontFile string) → integer
2
LoadFont(iFontID integer, szFontFile string)

Parameters

NameTypeIn forms
szFontFilestringall
iFontIDinteger2

What each form returns

1font = LoadFont("assets/font.ttf")integer
2LoadFont(1, "assets/font.ttf")nothing

Example · generated

Form 1, the command hands back the id

font = LoadFont("assets/font.ttf")DO  Sync()LOOP

Form 2, you choose the id yourself

LoadFont(1, "assets/font.ttf")DO  Sync()LOOP

LoadFont is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

Related commands

8 commands in Font