# wx.FontData¶

This class holds a variety of information related to font dialogs.

## Class Hierarchy¶

Inheritance diagram for class FontData:

## Methods Summary¶

 __init__ Constructor. EnableEffects Enables or disables “effects” under Windows or generic only. GetAllowSymbols Under Windows, returns a flag determining whether symbol fonts can be selected. GetChosenFont Gets the font chosen by the user if the user pressed wx.OK ( wx.FontDialog.ShowModal returned wx.ID_OK). GetColour Gets the colour associated with the font dialog. GetEnableEffects Determines whether “effects” are enabled under Windows. GetInitialFont Gets the font that will be initially used by the font dialog. GetRestrictSelection Returns the state of the flags restricting the selection. GetShowHelp Returns True if the Help button will be shown (Windows only). RestrictSelection Restricts the selection to a subset of the available fonts. SetAllowSymbols Under Windows, determines whether symbol fonts can be selected. SetChosenFont Sets the font that will be returned to the user (for internal use only). SetColour Sets the colour that will be used for the font foreground colour. SetInitialFont Sets the font that will be initially used by the font dialog. SetRange Sets the valid range for the font point size (Windows only). SetShowHelp Determines whether the Help button will be displayed in the font dialog (Windows only).

## Class API¶

class wx.FontData(Object)

Possible constructors:

FontData()


This class holds a variety of information related to font dialogs.

### Methods¶

__init__(self)

Constructor.

Initializes fontColour to black, showHelp to False, allowSymbols to True, enableEffects to True, minSize to 0 and maxSize to 0.

EnableEffects(self, enable)

Enables or disables “effects” under Windows or generic only.

This refers to the controls for manipulating colour, strikeout and underline properties.

The default value is True.

Parameters

enable (bool) –

GetAllowSymbols(self)

Under Windows, returns a flag determining whether symbol fonts can be selected.

Has no effect on other platforms.

The default value is True.

Return type

bool

GetChosenFont(self)

Gets the font chosen by the user if the user pressed wx.OK ( wx.FontDialog.ShowModal returned wx.ID_OK).

Return type

wx.Font

GetColour(self)

Gets the colour associated with the font dialog.

The default value is black.

Return type

wx.Colour

GetEnableEffects(self)

Determines whether “effects” are enabled under Windows.

This refers to the controls for manipulating colour, strikeout and underline properties.

The default value is True.

Return type

bool

GetInitialFont(self)

Gets the font that will be initially used by the font dialog.

This should have previously been set by the application.

Return type

wx.Font

GetRestrictSelection(self)

Returns the state of the flags restricting the selection.

Note that currently these flags are only effectively used in wxMSW.

The default value is FONTRESTRICT_NONE .

Return type

int

Returns

• FONTRESTRICT_NONE If no restriction applies, or a combination of the following flags:

• FONTRESTRICT_SCALABLE To show only scalable fonts - no raster fonts.

• FONTRESTRICT_FIXEDPITCH To show only monospaced fonts.

New in version 4.1/wxWidgets-3.1.4.

GetShowHelp(self)

Returns True if the Help button will be shown (Windows only).

The default value is False.

Return type

bool

RestrictSelection(self, flags)

Restricts the selection to a subset of the available fonts.

Note that currently these flags are only effectively used in wxMSW and are ignored in the other ports.

Possible values are:

• FONTRESTRICT_NONE No restriction, show all fonts in the dialog.

• FONTRESTRICT_SCALABLE To show only scalable fonts - no raster fonts.

• FONTRESTRICT_FIXEDPITCH To show only monospaced fonts.

The default value is FONTRESTRICT_NONE .

Parameters

flags (int) –

New in version 4.1/wxWidgets-3.1.4.

SetAllowSymbols(self, allowSymbols)

Under Windows, determines whether symbol fonts can be selected.

Has no effect on other platforms.

The default value is True.

Parameters

allowSymbols (bool) –

SetChosenFont(self, font)

Sets the font that will be returned to the user (for internal use only).

Parameters

font (wx.Font) –

SetColour(self, colour)

Sets the colour that will be used for the font foreground colour.

The default colour is black.

Parameters

colour (wx.Colour) –

SetInitialFont(self, font)

Sets the font that will be initially used by the font dialog.

Parameters

font (wx.Font) –

SetRange(self, min, max)

Sets the valid range for the font point size (Windows only).

The default is 0, 0 (unrestricted range).

Parameters
• min (int) –

• max (int) –

SetShowHelp(self, showHelp)

Determines whether the Help button will be displayed in the font dialog (Windows only).

The default value is False.

Parameters

showHelp (bool) –

### Properties¶

AllowSymbols

ChosenFont

Colour

InitialFont

ShowHelp