Name
FontRequest -- ask user to select a font (V5.0)
Synopsis
t = FontRequest(title$[, t])
Deprecated syntax
t = FontRequest(title$[, font$, size])
Function
This command will open a requester that will list all fonts currently available in the system. The user is then prompted to select a font from this list. The user can also choose an output size for the font, as well as the font style and font color. Note that the color selection is not supported on every platform. The title$ argument specifies the title text for the requester's dialog window.

FontRequest() supports several additional arguments. Before Hollywood 9.0, those had to be passed as optional parameters (see above). Since Hollywood 9.0, however, it is recommended to use the new syntax, which has a single optional table argument that can be used to pass one or more optional arguments to FontRequest().

The following table fields are recognized by this function:

Font:
Use this table tag to specify the name of a font that shall be initially selected.

Size:
Use this table tag to specify the font size that shall be initially selected.

X:
Initial x-position for the font requester on the screen. Not all platforms support this. (V9.0)

Y:
Initial y-position for the font requester on the screen. Not all platforms support this. (V9.0)

Width:
Initial width for the font requester dialog. Not all platforms support this. (V9.0)

Height:
Initial height for the font requester dialog. Not all platforms support this. (V9.0)

Upon return, FontRequest() initializes a table containing all parameters selected by the user and returns this table to the script. The return table will have the following fields initialized:

Name:
The complete font name (i.e. family name plus style). For example, "Arial Bold Italic". This is a string you could pass directly to SetFont() or OpenFont().

Family:
The family name of this font, e.g. "Arial".

Size:
Contains the selected font size (e.g. 36).

Weight:
The weight of the font. This will be set to one of the following weight constants:

 
#FONTWEIGHT_THIN
#FONTWEIGHT_EXTRALIGHT
#FONTWEIGHT_ULTRALIGHT
#FONTWEIGHT_LIGHT
#FONTWEIGHT_BOOK
#FONTWEIGHT_NORMAL
#FONTWEIGHT_REGULAR
#FONTWEIGHT_MEDIUM
#FONTWEIGHT_SEMIBOLD
#FONTWEIGHT_DEMIBOLD
#FONTWEIGHT_BOLD
#FONTWEIGHT_EXTRABOLD
#FONTWEIGHT_ULTRABOLD
#FONTWEIGHT_HEAVY
#FONTWEIGHT_BLACK
#FONTWEIGHT_EXTRABLACK
#FONTWEIGHT_ULTRABLACK

Slant:
The slant style of the font. This will be set to one of the following slant constants:

 
#FONTSLANT_ROMAN
#FONTSLANT_ITALIC
#FONTSLANT_OBLIQUE

Bold:
True if the user chose a bold font style.

Italic:
True if the user chose an italic font style.

Underline:
True if the user chose an underlined font style.

StrikeOut:
True if the user chose a striked out font style.

Color:
The font color chosen by the user in RGB format.

Please note that the Underline, StrikeOut, and Color fields are not supported on all platforms. If the host operating system's font dialog does not support them, they will all be set to False.

Inputs
title$
title for the requester
t
optional: table containing further arguments (see above) (V9.0)
Results
t
a table containing all parameters chosen by the user (see above for a description of the table fields)
Example
t = FontRequest("Select a font")
NPrint("Font:", t.name)
NPrint("Family:", t.family)
NPrint("Size:", t.size)
NPrint("Weight:", t.weight)
NPrint("Slant:", t.slant)
NPrint("Underline:", t.underline)
NPrint("Strike:", t.strikeout)
NPrint("Color:", HexStr(t.color))
The code above pops up a font requester and then prints out all information gathered from the user.

Show TOC