pygame   documentation
||  Home  ||  Help Contents  ||
 
|| pygame || cdrom || constants || cursor || display || draw ||
|| event || font || image || joystick || key || mixer ||
|| mixer_music || mouse || movie || sndarray || surfarray || time ||
|| transform ||
 
|| CD || Channel || Clock || Font || Joystick || Movie ||
|| Overlay || Rect || Sound || Surface ||
 
|| color || cursors || sprite ||

Font

The font object is created only from pygame.font.Font(). Once a font is created it's size and TTF file cannot be changed. The Font objects are mainly used to render() text into a new Surface. The Font objects also have a few states that can be set with set_underline(bool), set_bold(bool), set_italic(bool). Each of these functions contains an equivalent get_XXX() routine to find the current state. There are also many routines to query the dimensions of the text. The rendering functions work with both normal python strings, as well as with unicode strings.
get_ascent - gets the font ascent
get_bold - status of the bold attribute
get_descent - gets the font descent
get_height - average height of font glyph
get_italic - status of the italic attribute
get_linesize - gets the font recommended linesize
get_underline - status of the underline attribute
render - render text to a new image
set_bold - assign the bold attribute
set_italic - assign the italic attribute
set_underline - assign the underline attribute
size - size of rendered text

get_ascent
Font.get_ascent() -> int
 
get_bold
Font.get_bold() -> bool
 
get_descent
Font.get_descent() -> int
 
get_height
Font.get_height() -> int
 
get_italic
Font.get_italic() -> bool
 
get_linesize
Font.get_linesize() -> int
 
get_underline
Font.get_underline() -> bool
 
render
Font.render(text, antialias, fore_RGBA, [back_RGBA]) -> Surface
 
set_bold
Font.set_bold(bool) -> None
 
set_italic
Font.set_italic(bool) -> None
 
set_underline
Font.set_underline(bool) -> None
 
size
Font.size(text) -> width, height