Summary
Function CHECKFONT(FONT$)
Returns 1 if input font is found on system, 0 if font is not found.
Description
You may assume that a particular font is present and you may be usually correct.
However it's probably a good idea to check in programs designed for the general public.
This function makes it easier for your programs to select different fonts.
Here is a typical snippet using the CHECKFONT function.
-------------------------
Rem Use the first font found from this list:
Rem 1) Copperplate Gothic Bold - 2) Mechanical - 3) Blacksmith - 4) Rockwell Extra Bold
Rem 5) Tahoma - 6) Verdana - 7) Arial - 8) Times New Roman
Rem Setup a default display font in case none are found!
DISF$= Text Font$()
If CHECKFONT("Copperplate Gothic Bold")
DISF$= "Copperplate Gothic Bold"
Else
If CHECKFONT("Mechanical")
DISF$= "Mechanical"
Else
If CHECKFONT("Blacksmith")
DISF$= "Blacksmith"
Else
If CHECKFONT("Rockwell Extra Bold")
DISF$= "Rockwell Extra Bold"
Else
If CHECKFONT("Tahoma")
DISF$= "Tahoma"
Else
If CHECKFONT("Verdana")
DISF$= "Verdana"
Else
If CHECKFONT("Arial")
DISF$= "Arial"
Else
If CHECKFONT("Times New Roman")
DISF$= "Times New Roman"
Endif
Endif
Endif
Endif
Endif
Endif
Endif
Endif
Print DISF$
Wait Key
Code
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
Function CHECKFONT(FONT$)
Rem Check if input font is on system
VALID= 0
Perform Checklist For Fonts
NF= Checklist Quantity()
For I = 1 To NF
If FONT$= Checklist String$(I)
VALID= 1
Goto EXIT_CF
Endif
Next I
EXIT_CF:
Endfunction VALID
|