Liberty BASIC Help Online |
FONTDIALOG
FONTDIALOG fontSpec, fontSpecVar$
Description:
This command opens a Windows Common Fontdialog. It allows a user to select a font face, size and attributes. After the user closes the dialog, the font chosen is contained in the receiver variable fontSpecVar$.
fontSpec
This parameter describes a font by name, size and other attributes. The font dialog opens with a best fit to this specification. The user can then accept or adjust the font selection.
fontSpecVar$
This variable holds a font specification chosen by the user after the Fontdialog is closed. If the user clicked the "Cancel" button, this variable contains an empty string "". The string variable contains this information: "facename size attributes"
"arial 14 italic"
"courier_new 12 bold"
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 in place of the spaces, like this: |
Courier_New (or ignore the uppercase letters and type courier_new). |
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. |
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 is 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" |
Any or all of these attributes (modifiers) can be added - italic, bold, strikeout, and underscore. |
'open a font dialog
fontdialog "arial 10 italic", chosenFont$
if chosenFont$ <> "" then
open "Font sample" for graphics as #font
print #font, "down ; font "; chosenFont$
print #font, "\\AaBbCcDdEeFfGgHhIiJj"
print #font, "trapclose [closeFont]"
wait
end if
end
[closeFont]
close #font
end
Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/