Package wx :: Class Font
[frames | no frames]

Type Font

object --+        
         |        
    Object --+    
             |    
     GDIObject --+
                 |
                Font


A font is an object which determines the appearance of text. Fonts are used for drawing text to a device context, and setting the appearance of a window's text.

You can retrieve the current system font settings with wx.SystemSettings.

The possible values for the family parameter of wx.Font constructor are:

wx.FONTFAMILY_DEFAULT Chooses a default font.
wx.FONTFAMILY_DECORATIVE A decorative font.
wx.FONTFAMILY_ROMAN A formal, serif font.
wx.FONTFAMILY_SCRIPT A handwriting font.
wx.FONTFAMILY_SWISS A sans-serif font.
wx.FONTFAMILY_MODERN Usually a fixed pitch font.
wx.FONTFAMILY_TELETYPE A teletype font.

The possible values for the weight parameter are:

wx.FONTWEIGHT_NORMAL  
wx.FONTWEIGHT_LIGHT  
wx.FONTWEIGHT_BOLD  

The known font encodings are:

wx.FONTENCODING_SYSTEM system default
wx.FONTENCODING_DEFAULT current default encoding
wx.FONTENCODING_ISO8859_1 West European (Latin1)
wx.FONTENCODING_ISO8859_2 Central and East European (Latin2)
wx.FONTENCODING_ISO8859_3 Esperanto (Latin3)
wx.FONTENCODING_ISO8859_4 Baltic (old) (Latin4)
wx.FONTENCODING_ISO8859_5 Cyrillic
wx.FONTENCODING_ISO8859_6 Arabic
wx.FONTENCODING_ISO8859_7 Greek
wx.FONTENCODING_ISO8859_8 Hebrew
wx.FONTENCODING_ISO8859_9 Turkish (Latin5)
wx.FONTENCODING_ISO8859_10 Variation of Latin4 (Latin6)
wx.FONTENCODING_ISO8859_11 Thai
wx.FONTENCODING_ISO8859_12 doesn't exist currently, but put it here anyhow to make all ISO8859 consecutive numbers
wx.FONTENCODING_ISO8859_13 Baltic (Latin7)
wx.FONTENCODING_ISO8859_14 Latin8
wx.FONTENCODING_ISO8859_15 Latin9 (a.k.a. Latin0, includes euro)
wx.FONTENCODING_KOI8 Cyrillic charset
wx.FONTENCODING_ALTERNATIVE same as MS-DOS CP866
wx.FONTENCODING_BULGARIAN used under Linux in Bulgaria
wx.FONTENCODING_CP437 original MS-DOS codepage
wx.FONTENCODING_CP850 CP437 merged with Latin1
wx.FONTENCODING_CP852 CP437 merged with Latin2
wx.FONTENCODING_CP855 another cyrillic encoding
wx.FONTENCODING_CP866 and another one
wx.FONTENCODING_CP874 WinThai
wx.FONTENCODING_CP1250 WinLatin2
wx.FONTENCODING_CP1251 WinCyrillic
wx.FONTENCODING_CP1252 WinLatin1
wx.FONTENCODING_CP1253 WinGreek (8859-7)
wx.FONTENCODING_CP1254 WinTurkish
wx.FONTENCODING_CP1255 WinHebrew
wx.FONTENCODING_CP1256 WinArabic
wx.FONTENCODING_CP1257 WinBaltic (same as Latin 7)
wx.FONTENCODING_UTF7 UTF-7 Unicode encoding
wx.FONTENCODING_UTF8 UTF-8 Unicode encoding

Method Summary
Font __init__(self, pointSize, family, style, weight, underline, face, encoding)
Creates a font object with the specified attributes.
  __del__(self)
bool __eq__(self, other)
bool __ne__(self, other)
  __nonzero__(self)
int GetDefaultEncoding()
Returns the encoding used for all fonts created with an encoding of wx.FONTENCODING_DEFAULT. (Static method)
int GetEncoding(self)
Get the font's encoding.
String GetFaceName(self)
Returns the typeface name associated with the font, or the empty string if there is no typeface information.
int GetFamily(self)
Gets the font family.
String GetFamilyString(self)
Returns a string representation of the font family.
NativeFontInfo GetNativeFontInfo(self)
Constructs a wx.NativeFontInfo object from this font.
String GetNativeFontInfoDesc(self)
Returns the platform-dependent string completely describing this font or an empty string if the font isn't valid.
String GetNativeFontInfoUserDesc(self)
Returns a human readable version of GetNativeFontInfoDesc.
bool GetNoAntiAliasing(self)
Size GetPixelSize(self)
Returns the size in pixels if the font was constructed with a pixel size.
int GetPointSize(self)
Gets the point size.
int GetStyle(self)
Gets the font style.
String GetStyleString(self)
Returns a string representation of the font style.
bool GetUnderlined(self)
Returns True if the font is underlined, False otherwise.
int GetWeight(self)
Gets the font weight.
String GetWeightString(self)
Return a string representation of the font weight.
bool IsFixedWidth(self)
Returns true if the font is a fixed width (or monospaced) font, false if it is a proportional one or font is invalid.
bool IsOk(self)
Returns True if this font was successfully created.
bool IsUsingSizeInPixels(self)
Returns True if the font is using a pixelSize.
bool Ok(self)
Returns True if this font was successfully created.
  SetDefaultEncoding(encoding)
Sets the default font encoding. (Static method)
  SetEncoding(self, encoding)
Set the font encoding.
bool SetFaceName(self, faceName)
Sets the facename for the font.
  SetFamily(self, family)
Sets the font family.
  SetNativeFontInfo(self, info)
Set the font's attributes from a wx.NativeFontInfo object.
bool SetNativeFontInfoFromString(self, info)
Set the font's attributes from string representation of a wx.NativeFontInfo object.
bool SetNativeFontInfoUserDesc(self, info)
Set the font's attributes from a string formerly returned from GetNativeFontInfoDesc.
  SetNoAntiAliasing(self, no)
  SetPixelSize(self, pixelSize)
Sets the size in pixels rather than points.
  SetPointSize(self, pointSize)
Sets the point size.
  SetStyle(self, style)
Sets the font style.
  SetUnderlined(self, underlined)
Sets underlining.
  SetWeight(self, weight)
Sets the font weight.

Property Summary
  Encoding: See GetEncoding and SetEncoding
  FaceName: See GetFaceName and SetFaceName
  Family: See GetFamily and SetFamily
  FamilyString: See GetFamilyString
  NativeFontInfo: See GetNativeFontInfo and SetNativeFontInfo
  NativeFontInfoDesc: See GetNativeFontInfoDesc
  NativeFontInfoUserDesc: See GetNativeFontInfoUserDesc and SetNativeFontInfoUserDesc
  NoAntiAliasing: See GetNoAntiAliasing and SetNoAntiAliasing
  PixelSize: See GetPixelSize and SetPixelSize
  PointSize: See GetPointSize and SetPointSize
  Style: See GetStyle and SetStyle
  StyleString: See GetStyleString
  thisown: The membership flag
  Underlined: See GetUnderlined and SetUnderlined
  Weight: See GetWeight and SetWeight
  WeightString: See GetWeightString

Instance Method Details

__init__(self, pointSize, family, style, weight, underline=False, face=EmptyString, encoding=FONTENCODING_DEFAULT)
(Constructor)

Creates a font object with the specified attributes.

Parameters:
pointSize - The size of the font in points.
           (type=int)

family - Font family. A generic way of referring to fonts without specifying actual facename. It can be One of the wx.FONTFAMILY_xxx constants.
           (type=int)

style - One of the wx.FONTSTYLE_xxx constants.
           (type=int)

weight - Font weight, sometimes also referred to as font boldness. One of the wx.FONTWEIGHT_xxx constants.
           (type=int)

underline - The value can be True or False and indicates whether the font will include an underline. This may not be supported on all platforms.
           (type=bool)

face - An optional string specifying the actual typeface to be used. If it is an empty string, a default typeface will be chosen based on the family.
           (type=String)

encoding - An encoding which may be one of the wx.FONTENCODING_xxx constants. If the specified encoding isn't available, no font is created.
           (type=int)

Returns:
Font
Overrides:
wx.GDIObject.__init__

See Also:

wx.FFont, wx.FontFromPixelSize, wx.FFontFromPixelSize, wx.FontFromNativeInfoString, wx.FontFromNativeInfo

GetEncoding(self)

Get the font's encoding.

Returns:
int

GetFaceName(self)

Returns the typeface name associated with the font, or the empty string if there is no typeface information.

Returns:
String

GetFamily(self)

Gets the font family.

Returns:
int

GetFamilyString(self)

Returns a string representation of the font family.

Returns:
String

GetNativeFontInfo(self)

Constructs a wx.NativeFontInfo object from this font.

Returns:
NativeFontInfo

GetNativeFontInfoDesc(self)

Returns the platform-dependent string completely describing this font or an empty string if the font isn't valid.

Returns:
String

GetNativeFontInfoUserDesc(self)

Returns a human readable version of GetNativeFontInfoDesc.

Returns:
String

GetPixelSize(self)

Returns the size in pixels if the font was constructed with a pixel size.

Returns:
Size

GetPointSize(self)

Gets the point size.

Returns:
int

GetStyle(self)

Gets the font style.

Returns:
int

GetStyleString(self)

Returns a string representation of the font style.

Returns:
String

GetUnderlined(self)

Returns True if the font is underlined, False otherwise.

Returns:
bool

GetWeight(self)

Gets the font weight.

Returns:
int

GetWeightString(self)

Return a string representation of the font weight.

Returns:
String

IsFixedWidth(self)

Returns true if the font is a fixed width (or monospaced) font, false if it is a proportional one or font is invalid.

Returns:
bool

IsOk(self)

Returns True if this font was successfully created.

Returns:
bool

IsUsingSizeInPixels(self)

Returns True if the font is using a pixelSize.

Returns:
bool

Ok(self)

Returns True if this font was successfully created.

Returns:
bool

SetEncoding(self, encoding)

Set the font encoding.

Parameters:
encoding
           (type=int)

SetFaceName(self, faceName)

Sets the facename for the font. The facename, which should be a valid font installed on the end-user's system.

To avoid portability problems, don't rely on a specific face, but specify the font family instead or as well. A suitable font will be found on the end-user's system. If both the family and the facename are specified, wxWidgets will first search for the specific face, and then for a font belonging to the same family.

Parameters:
faceName
           (type=String)

Returns:
bool

SetFamily(self, family)

Sets the font family.

Parameters:
family
           (type=int)

SetNativeFontInfo(self, info)

Set the font's attributes from a wx.NativeFontInfo object.

Parameters:
info
           (type=NativeFontInfo)

SetNativeFontInfoFromString(self, info)

Set the font's attributes from string representation of a wx.NativeFontInfo object.

Parameters:
info
           (type=String)

Returns:
bool

SetNativeFontInfoUserDesc(self, info)

Set the font's attributes from a string formerly returned from GetNativeFontInfoDesc.

Parameters:
info
           (type=String)

Returns:
bool

SetPixelSize(self, pixelSize)

Sets the size in pixels rather than points. If there is platform API support for this then it is used, otherwise a font with the closest size is found using a binary search.

Parameters:
pixelSize
           (type=Size)

SetPointSize(self, pointSize)

Sets the point size.

Parameters:
pointSize
           (type=int)

SetStyle(self, style)

Sets the font style.

Parameters:
style
           (type=int)

SetUnderlined(self, underlined)

Sets underlining.

Parameters:
underlined
           (type=bool)

SetWeight(self, weight)

Sets the font weight.

Parameters:
weight
           (type=int)


Static Method Details

GetDefaultEncoding()

Returns the encoding used for all fonts created with an encoding of wx.FONTENCODING_DEFAULT.

Returns:
int

SetDefaultEncoding(encoding)

Sets the default font encoding.

Parameters:
encoding
           (type=int)


Property Details

Encoding

See GetEncoding and SetEncoding

Get Method:
GetEncoding(self)
Set Method:
SetEncoding(self, encoding)

FaceName

See GetFaceName and SetFaceName

Get Method:
GetFaceName(self)
Set Method:
SetFaceName(self, faceName)

Family

See GetFamily and SetFamily

Get Method:
GetFamily(self)
Set Method:
SetFamily(self, family)

FamilyString

See GetFamilyString

Get Method:
GetFamilyString(self)

NativeFontInfo

See GetNativeFontInfo and SetNativeFontInfo

Get Method:
GetNativeFontInfo(self)
Set Method:
SetNativeFontInfo(self, info)

NativeFontInfoDesc

See GetNativeFontInfoDesc

Get Method:
GetNativeFontInfoDesc(self)

NativeFontInfoUserDesc

See GetNativeFontInfoUserDesc and SetNativeFontInfoUserDesc

Get Method:
GetNativeFontInfoUserDesc(self)
Set Method:
SetNativeFontInfoUserDesc(self, info)

NoAntiAliasing

See GetNoAntiAliasing and SetNoAntiAliasing

Get Method:
GetNoAntiAliasing(self)
Set Method:
SetNoAntiAliasing(self, no)

PixelSize

See GetPixelSize and SetPixelSize

Get Method:
GetPixelSize(self)
Set Method:
SetPixelSize(self, pixelSize)

PointSize

See GetPointSize and SetPointSize

Get Method:
GetPointSize(self)
Set Method:
SetPointSize(self, pointSize)

Style

See GetStyle and SetStyle

Get Method:
GetStyle(self)
Set Method:
SetStyle(self, style)

StyleString

See GetStyleString

Get Method:
GetStyleString(self)

thisown

The membership flag

Underlined

See GetUnderlined and SetUnderlined

Get Method:
GetUnderlined(self)
Set Method:
SetUnderlined(self, underlined)

Weight

See GetWeight and SetWeight

Get Method:
GetWeight(self)
Set Method:
SetWeight(self, weight)

WeightString

See GetWeightString

Get Method:
GetWeightString(self)

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:14:01 2007 http://epydoc.sf.net