Module BaseDoc :: Class FontStyle
[frames] | no frames]

Class FontStyle

source code

Defines a font style. Controls the font face, size, color, and attributes. In order to remain generic, the only font faces available are FONT_SERIF and FONT_SANS_SERIF. Document formatters should convert these to the appropriate fonts for the target format.

The FontStyle represents the desired characteristics. There are no guarentees that the document format generator will be able implement all or any of the characteristics.

Instance Methods
 
__init__(self, style=None)
Create a new FontStyle object, accepting the default values.
source code
 
set(self, face=None, size=None, italic=None, bold=None, underline=None, color=None)
Set font characteristics.
source code
 
set_italic(self, val)
0 disables italics, 1 enables italics
source code
 
get_italic(self)
1 indicates use italics
source code
 
set_bold(self, val)
0 disables bold face, 1 enables bold face
source code
 
get_bold(self)
1 indicates use bold face
source code
 
set_color(self, val)
sets the color using an RGB color tuple
source code
 
get_color(self)
Return an RGB color tuple
source code
 
set_size(self, val)
sets font size in points
source code
 
get_size(self)
returns font size in points
source code
 
set_type_face(self, val)
sets the font face type
source code
 
get_type_face(self)
returns the font face type
source code
 
set_underline(self, val)
1 enables underlining
source code
 
get_underline(self)
1 indicates underlining
source code
Method Details

__init__(self, style=None)
(Constructor)

source code 

Create a new FontStyle object, accepting the default values.

Parameters:
  • style - if specified, initializes the FontStyle from the passed FontStyle instead of using the defaults.

set(self, face=None, size=None, italic=None, bold=None, underline=None, color=None)

source code 

Set font characteristics.

Parameters:
  • face - font type face, either FONT_SERIF or FONT_SANS_SERIF
  • size - type face size in points
  • italic - True enables italics, False disables italics
  • bold - True enables bold face, False disables bold face
  • underline - True enables underline, False disables underline
  • color - an RGB color representation in the form of three integers in the range of 0-255 represeting the red, green, and blue components of a color.