[Previous] [Contents] [Index] [Next]


Display a modal dialog for selecting a font


const char *PtFontSelection( PtWidget_t *parent, 
                             const PhPoint_t *pos,
                             const char *title, 
                             const char *font,
                             long symbol,
                             unsigned flags,
                             const char *sample);


This function displays a modal dialog allowing the user to select a text font. The dialog is parented off the parent widget, which may be NULL; if non-NULL, that parent widget is blocked and its cursor is changed to reflect this.

The dialog is positioned according to the pos parameter: if NULL, the dialog is centered on the screen; if parent is NULL, the dialog is placed at the absolute coordinates of pos; otherwise it's placed at the relative offset of pos within parent.

The title of the dialog is given by title; if this is NULL a default title of "Select Text Font" is used.

The initial font selected in the dialog is given by font.

The symbol parameter specifies which character will be used to construct the list of available font families (refer to PfQueryFonts() in the Library Reference); if -1L is specified a default symbol 'A' (standard Latin fonts) is used.

The flags parameter is used to limit the inclusion of fonts based on certain characteristics:

To include: Use this flag:
Scalable fonts PHFONT_SCALABLE
Bitmapped fonts PHFONT_BITMAP
Proportional fonts PHFONT_PROP
Fixed-width fonts PHFONT_FIXED

You can OR the flags together to obtain a suitable mask. The default is PHFONT_ALL_FONTS (which is every option set).

The sample parameter sets the text string used to display a sample of the selected font; if NULL the default of AaBbCcXxYyZz is used.

The modal dialog is constructed and the user may select a text font using comboboxes for the family and size, and buttons for the style. A sample of text using the font is dynamically updated.

The user may click a Cancel button or close the window to cancel the selection, or click an OK button to accept it.


A pointer to the new font string if one selected, NULL otherwise. This string is obtained using the strdup() function, so the application should free() it once finished with the font name.



Interrupt handler No
Signal handler No
Thread No

See also:

PtFontSel in the Photon Widget Reference

[Previous] [Contents] [Index] [Next]