Liberty BASIC Help Online

How to Specify Fonts
"Font FaceName size attributes"
 
In Liberty BASIC there are many places to specify fonts.  This is done using a font command string containing:
 
  The font facename
  The size of the font
  Optional modifiers: italic, bold, strikeout, underscore
 
Here is an example:
 
  'Draw in a graphics window using the font Arial 14 point italic
  open "Font example" for graphics as #fontExample
  print #fontExample, "trapclose [quit]"
  print #fontExample, "down"
  print #fontExample, "font arial 14 italic"
  print #fontExample, "\\This is Arial 14 point italic"
  wait
[quit]
  close #fontExample
  end
 
In the above example, the line print #fontExample, "font arial 14 italic" contains a font specification. Everything after the word font is the specifier: arial 14 italic.
 
Sending Font Commands to Text Controls
The "font" command is preceded by an exclamation point character ( ! ) when sent to controls that allow text to be printed to them, such as a textbox control or statictext control.  The ( ! ) character signals Liberty BASIC to send a command to the control, rather than print a new text string on it. 
 
Font Specifications
FaceName
The facename is case insensitive, so "Arial" is the same as "ARIAL" and "arial."  To specify a font which has spaces in its name, use underscores like this:
 
  Courier New
 
becomes...
 
  Courier_New  (or ignore the uppercase letters and type courier_new).
 
Size in Points
Specify a point size as above by using a single size parameter.  A "point" is 1/72 of an inch, so there are 72 points in an inch.  A font that is 14 points high is not the same size as a font that is 14 pixels high.
 
Size in Pixels
To specify font size by pixel rather than by point, include parameters for both width and height in the font command.  If the width parameter is set to 0, the default width for that font face and height will be used. 
 
Here are some examples that set font size by point and by pixel:
 
  'specify just a point size with a single size parameter
  print #fontExample, "font Arial 14"
 
  'specify a width and height in pixels
  ' with two size parameters
  print #fontExample, "font Arial 8 15"
 
  'specify a height, and let Windows pick the width
  '(for compatibility with earlier versions of Liberty BASIC)
  print #fontExample, "font Arial 0 15"
 
Attributes
Any or all of these attributes (modifiers) can be added - italic, bold, strikeout, and underscore:
 
  'go nuts and add ALL the modifiers
print #fontExample, "font arial 8 italic bold strikeout underscore"
 


Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/