Name
FontRequest -- open a font requester (V6.0, optional)
Synopsis
int error = FontRequest(APTR handle, STRPTR title, ULONG flags, STRPTR *
                result, ULONG *style, struct hwTagList *tags);
Function
This function must open a font requester, i.e. a dialog box that prompts the user to select a font face, size, color, and style. The function must then return a string to Hollywood that contains information about the user's selection. This string must be formatted like this:

 
facename|size|color (e.g. "Arial|72|16711680")

The color is specified as an RGB value but in decimal notation. Your FontRequest() implementation must set parameter 4 to a string pointer that adheres to the format as described above. The string must be allocated by your function. Hollywood will call FreeRequest() on this string when it is done with it so that you can free it. If the user cancels the font requester, you have to write NULL to the result string pointer.

Additionally, your FontRequest() implementation must set the style pointer to a combination of the following flags which indicate the style the user has selected for this font:

 
#define HWFONTREQWEIGHT_THIN       0x00000001
#define HWFONTREQWEIGHT_EXTRALIGHT 0x00000002
#define HWFONTREQWEIGHT_LIGHT      0x00000004
#define HWFONTREQWEIGHT_BOOK       0x00000008
#define HWFONTREQWEIGHT_NORMAL     0x00000010
#define HWFONTREQWEIGHT_MEDIUM     0x00000020
#define HWFONTREQWEIGHT_SEMIBOLD   0x00000040
#define HWFONTREQWEIGHT_BOLD       0x00000080
#define HWFONTREQWEIGHT_EXTRABOLD  0x00000100
#define HWFONTREQWEIGHT_BLACK      0x00000200
#define HWFONTREQWEIGHT_EXTRABLACK 0x00000400
#define HWFONTREQSLANT_ROMAN       0x00000800
#define HWFONTREQSLANT_ITALIC      0x00001000
#define HWFONTREQSLANT_OBLIQUE     0x00002000
#define HWFONTREQSTYLE_UNDERLINED  0x00004000
#define HWFONTREQSTYLE_STRIKEOUT   0x00008000
#define HWFONTREQSTYLE_BOLD        0x00010000
#define HWFONTREQSTYLE_ITALIC      0x00020000

The HWFONTREQWEIGHT_XXX flags control the font's weight (i.e. how bold the individual characters should appear) and the HWFONTREQSLANT_XXX flags contain the font's slant (i.e. how italic the individual characters should appear). You may only set one flag from the HWFONTREQWEIGHT_XXX and HWFONTREQSLANT_XXX groups.

Hollywood also passes a taglist to this function. Your implementation has to handle the following tags:

HWFONTREQTAG_FROMSCRIPT:
The iData member of this tag item is set to True if Hollywood has called you while the script is running. This might be important to know because requesters should not block window refresh so you might want to setup a temporary modal event loop if this tag has been set to True to enable your display to stay responsive.

HWFONTREQTAG_DEFFONT:
If this tag is in the list, Hollywood wants you to initialize the requester's initial font to the one specified in this tag. The pData member of this tag item is set to a string pointer containing the name of the font.

HWFONTREQTAG_DEFSIZE:
If this tag is in the list, Hollywood wants you to preselect the font size specified in the iData member of this tag item when first opening the requester.

FontRequest() is an optional API and must only be implemented if HWSRAFLAGS_FONTREQUEST has been passed to hw_SetRequesterAdapter(). See hw_SetRequesterAdapter for details.

Inputs
handle
display handle or NULL if no display is open
title
title string for the requester's window
flags
reserved for future use (currently 0)
result
STRPTR pointer for storing the user's selection (see above)
style
ULONG pointer for storing the font's style (see above)
tags
taglist for additional options (see above)
Results
error
error code or 0 for success

Show TOC