| | |
- object
-
- PangoFont
-
- SysFont
class PangoFont(object) |
| |
Base class for a pygame.font.Font-like object drawn by Pango
Attributes of note:
fd -- instances Pango FontDescription object
WEIGHT_* -- parameters for use with set_weight
STYLE_* -- parameters for use with set_style |
| |
Methods defined here:
- __init__(self, family=None, size=None, bold=False, italic=False, underline=False, fd=None)
- If you know what pango.FontDescription (fd) you want, pass it in as
'fd'. Otherwise, specify any number of family, size, bold, or italic,
and we will try to match something up for you.
- get_bold(self)
- Return whether our font's weight is bold (or above)
- get_italic(self)
- Return whether we are currently italicised
- get_style(self)
- Get our font description's pango-style
- get_underline(self)
- Retrieve our current underline setting
- get_weight(self)
- Explicitly get our pango-style weight value
- render(self, text, antialias=True, color=(255, 255, 255), background=None)
- Render the font onto a new Surface and return it.
We ignore 'antialias' and use system settings.
text -- (unicode) string with the text to render
antialias -- attempt to antialias the text or not
color -- three or four-tuple of 0-255 values specifying rendering
colour for the text
background -- three or four-tuple of 0-255 values specifying rendering
colour for the background, or None for trasparent background
returns a pygame image instance
- set_bold(self, bold=True)
- Set our font description's weight to "bold" or "normal"
bold -- boolean, whether to set the value to "bold" weight or not
- set_italic(self, italic=True)
- Set our "italic" value (style)
- set_style(self, style)
- Set our font description's pango-style
- set_underline(self, underline=True)
- Set our current underlining properly
- set_weight(self, weight)
- Explicitly set our pango-style weight value
- size(self, text)
- Determine space required to render given text
returns tuple of (width,height)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- STYLE_ITALIC = <enum PANGO_STYLE_ITALIC of type PangoStyle>
- STYLE_NORMAL = <enum PANGO_STYLE_NORMAL of type PangoStyle>
- STYLE_OBLIQUE = <enum PANGO_STYLE_OBLIQUE of type PangoStyle>
- WEIGHT_BOLD = <enum PANGO_WEIGHT_BOLD of type PangoWeight>
- WEIGHT_HEAVY = <enum PANGO_WEIGHT_HEAVY of type PangoWeight>
- WEIGHT_LIGHT = <enum PANGO_WEIGHT_LIGHT of type PangoWeight>
- WEIGHT_NORMAL = <enum PANGO_WEIGHT_NORMAL of type PangoWeight>
- WEIGHT_SEMIBOLD = <enum PANGO_WEIGHT_SEMIBOLD of type PangoWeight>
- WEIGHT_ULTRABOLD = <enum PANGO_WEIGHT_ULTRABOLD of type PangoWeight>
- WEIGHT_ULTRALIGHT = <enum PANGO_WEIGHT_ULTRALIGHT of type PangoWeight>
|
class SysFont(PangoFont) |
| |
Construct a PangoFont from a font description (name), size in pixels,
bold, and italic designation. Similar to SysFont from Pygame. |
| |
- Method resolution order:
- SysFont
- PangoFont
- object
Methods defined here:
- __init__(self, name, size, bold=False, italic=False)
Methods inherited from PangoFont:
- get_bold(self)
- Return whether our font's weight is bold (or above)
- get_italic(self)
- Return whether we are currently italicised
- get_style(self)
- Get our font description's pango-style
- get_underline(self)
- Retrieve our current underline setting
- get_weight(self)
- Explicitly get our pango-style weight value
- render(self, text, antialias=True, color=(255, 255, 255), background=None)
- Render the font onto a new Surface and return it.
We ignore 'antialias' and use system settings.
text -- (unicode) string with the text to render
antialias -- attempt to antialias the text or not
color -- three or four-tuple of 0-255 values specifying rendering
colour for the text
background -- three or four-tuple of 0-255 values specifying rendering
colour for the background, or None for trasparent background
returns a pygame image instance
- set_bold(self, bold=True)
- Set our font description's weight to "bold" or "normal"
bold -- boolean, whether to set the value to "bold" weight or not
- set_italic(self, italic=True)
- Set our "italic" value (style)
- set_style(self, style)
- Set our font description's pango-style
- set_underline(self, underline=True)
- Set our current underlining properly
- set_weight(self, weight)
- Explicitly set our pango-style weight value
- size(self, text)
- Determine space required to render given text
returns tuple of (width,height)
Data descriptors inherited from PangoFont:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from PangoFont:
- STYLE_ITALIC = <enum PANGO_STYLE_ITALIC of type PangoStyle>
- STYLE_NORMAL = <enum PANGO_STYLE_NORMAL of type PangoStyle>
- STYLE_OBLIQUE = <enum PANGO_STYLE_OBLIQUE of type PangoStyle>
- WEIGHT_BOLD = <enum PANGO_WEIGHT_BOLD of type PangoWeight>
- WEIGHT_HEAVY = <enum PANGO_WEIGHT_HEAVY of type PangoWeight>
- WEIGHT_LIGHT = <enum PANGO_WEIGHT_LIGHT of type PangoWeight>
- WEIGHT_NORMAL = <enum PANGO_WEIGHT_NORMAL of type PangoWeight>
- WEIGHT_SEMIBOLD = <enum PANGO_WEIGHT_SEMIBOLD of type PangoWeight>
- WEIGHT_ULTRABOLD = <enum PANGO_WEIGHT_ULTRABOLD of type PangoWeight>
- WEIGHT_ULTRALIGHT = <enum PANGO_WEIGHT_ULTRALIGHT of type PangoWeight>
| |