The CHOOSEFONT structure contains information that the ChooseFont function uses to initialize the Font common dialog box. After the user closes the dialog box, the system returns information about the user’s selection in this structure.
typedef struct { // cf DWORD lStructSize; HWND hwndOwner; HDC hDC; LPLOGFONT lpLogFont; INT iPointSize; DWORD Flags; DWORD rgbColors; LPARAM lCustData; LPCFHOOKPROC lpfnHook; LPCTSTR lpTemplateName; HINSTANCE hInstance; LPTSTR lpszStyle; WORD nFontType; WORD ___MISSING_ALIGNMENT__; INT nSizeMin; INT nSizeMax; } CHOOSEFONT;
Flag |
Meaning |
CF_APPLY |
Causes the dialog box to display the Apply button. You should provide a hook procedure to process WM_COMMAND messages for the Apply button. The hook procedure can send the WM_CHOOSEFONT_GETLOGFONT message to the dialog box to retrieve the address of the LOGFONT structure that contains the current selections for the font. |
CF_ANSIONLY |
This flag is obsolete. To limit font selections to all scripts except those that use the OEM or Symbol character sets, use CF_SCRIPTSONLY. To get the Windows 3.1 CF_ANSIONLY behavior, use CF_SELECTSCRIPT and specify ANSI_CHARSET in the lfCharSet member of the LOGFONT structure pointed to by lpLogFont. |
CF_BOTH |
Causes the dialog box to list the available printer and screen fonts. The hDC member identifies the device context (or information context) associated with the printer. This flag is a combination of the CF_SCREENFONTS and CF_PRINTERFONTS flags. |
CF_TTONLY |
Specifies that ChooseFont should only enumerate and allow the selection of TrueType fonts. |
CF_EFFECTS |
Causes the dialog box to display the controls that allow the user to specify strikeout, underline, and text color options. If this flag is set, you can use the rgbColors member to specify the initial text color. You can use the lfStrikeOut and lfUnderline members of the LOGFONT structure pointed to by lpLogFont to specify the initial settings of the strikeout and underline check boxes. ChooseFont can use these members to return the user’s selections. |
CF_ENABLEHOOK |
Enables the hook procedure specified in the lpfnHook member of this structure. |
CF_ENABLETEMPLATE |
Indicates that the hInstance and lpTemplateName members specify a dialog box template to use in place of the default template. |
CF_ENABLETEMPLATEHANDLE |
Indicates that the hInstance member identifies a data block that contains a preloaded dialog box template. The system ignores the lpTemplateName member if this flag is specified. |
CF_FIXEDPITCHONLY |
Specifies that ChooseFont should select only fixed-pitch fonts. |
CF_FORCEFONTEXIST |
Specifies that ChooseFont should indicate an error condition if the user attempts to select a font or style that does not exist. |
CF_INITTOLOGFONTSTRUCT |
Specifies that ChooseFont should use the LOGFONT structure pointed to by the lpLogFont member to initialize the dialog box controls. |
CF_LIMITSIZE |
Specifies that ChooseFont should select only font sizes within the range specified by the nSizeMin and nSizeMax members. |
CF_NOOEMFONTS |
Same as the CF_NOVECTORFONTS flag. |
CF_NOFACESEL |
When using a LOGFONT structure to initialize the dialog box controls, use this flag to selectively prevent the dialog box from displaying an initial selection for the font name combo box. This is useful when there is no single font name that applies to the text selection. |
CF_NOSCRIPTSEL |
Disables the Script combo box. When this flag is set, the lfCharSet member of the LOGFONT structure is set to DEFAULT_CHARSET when ChooseFont returns. This flag is used only to initialize the dialog box. |
CF_NOSTYLESEL |
When using a LOGFONT structure to initialize the dialog box controls, use this flag to selectively prevent the dialog box from displaying an initial selection for the font style combo box. This is useful when there is no single font style that applies to the text selection. |
CF_NOSIZESEL |
When using a LOGFONT structure to initialize the dialog box controls, use this flag to selectively prevent the dialog box from displaying an initial selection for the font size combo box. This is useful when there is no single font size that applies to the text selection. |
CF_NOSIMULATIONS |
Specifies that ChooseFont should not allow graphics device interface (GDI) font simulations. |
CF_NOVECTORFONTS |
Specifies that ChooseFont should not allow vector font selections. |
CF_NOVERTFONTS |
Causes the Font dialog box to list only horizontally oriented fonts. |
CF_PRINTERFONTS |
Causes the dialog box to list only the fonts supported by the printer associated with the device context (or information context) identified by the hDC member. |
CF_SCALABLEONLY |
Specifies that ChooseFont should allow only the selection of scalable fonts. (Scalable fonts include vector fonts, scalable printer fonts, TrueType fonts, and fonts scaled by other technologies.) |
CF_SCREENFONTS |
Causes the dialog box to list only the screen fonts supported by the system. |
CF_SCRIPTSONLY |
Specifies that ChooseFont should allow selection of fonts for all non-OEM and Symbol character sets, as well as the ANSI character set. This supersedes the CF_ANSIONLY value. |
CF_SELECTSCRIPT |
When specified on input, only fonts with the character set identified in the lfCharSet member of the LOGFONT structure are displayed. The user will not be allowed to change the character set specified in the Scripts combo box. |
CF_SHOWHELP |
Causes the dialog box to display the Help button. The hwndOwner member must specify the window to receive the HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button. |
CF_USESTYLE |
Specifies that the lpszStyle member points to a buffer that contains style data that ChooseFont should use to initialize the Font Style combo box. When the user closes the dialog box, ChooseFont copies style data for the user’s selection to this buffer. |
CF_WYSIWYG |
Specifies that ChooseFont should allow only the selection of fonts available on both the printer and the display. If this flag is specified, the CF_BOTH and CF_SCALABLEONLY flags should also be specified. |
Value |
Meaning |
BOLD_FONTTYPE |
The font weight is bold. This information is duplicated in the lfWeight member of the LOGFONT structure and is equivalent to FW_BOLD. |
ITALIC_FONTTYPE |
The italic font attribute is set. This information is duplicated in the lfItalic member of the LOGFONT structure. |
PRINTER_FONTTYPE |
The font is a printer font. |
REGULAR_FONTTYPE |
The font weight is normal. This information is duplicated in the lfWeight member of the LOGFONT structure and is equivalent to FW_REGULAR. |
SCREEN_FONTTYPE |
The font is a screen font. |
SIMULATED_FONTTYPE |
The font is simulated by the graphics device interface (GDI). |