pyjsdl :: font :: Font :: Class Font

Class Font

object --+
         |
        Font

pyjsdl.font.Font

Instance Methods
 
__init__(self, name, size)
Return Font object.
 
__str__(self)
str(x)
 
__repr__(self)
repr(x)
 
render(self, text, antialias=True, color=(0,0,0), background=None, surface=None)
Render text onto surface. Arguments are text to render, and optional antialias, RGB color of text, RGB color of background, and surface for text rendering.
 
size(self, text)
Return size x,y of a surface for of given text.
 
set_underline(self, setting=True)
Set font underline style. Optional setting argument, default to True.
 
get_underline(self)
Check if font is underlined.
 
set_bold(self, setting=True)
Set font bold style. Optional setting argument, default to True.
 
get_bold(self)
Check if font is bold.
 
set_italic(self, setting=True)
Set font italic style. Optional setting argument, default to True.
 
get_italic(self)
Check if font is italized.
 
get_linesize(self)
Return linesize of font.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, name, size)
(Constructor)

 

        Return Font object.
        Arguments include name of a font and size of font. The name argument can be a string of comma-delimited names to specify fallbacks and use a default font if none found. A font can be loaded from a filename 'fontname.ext' that was set in a css file; note: load process may be delayed a frame.

Example of font file declaration:

# Add css file link to app.html <head> section:
<link rel="stylesheet" href="app.css" />

# Add font-face to app.css:
# (note:font-family is lowercase filename w/o ext)
@font-face {
    font-family: 'freesansbold';
    src: url('freesansbold.ttf');
}
        

Overrides: object.__init__

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)