Module Font :: Class Font
[hide private]
[frames] | no frames]

Class Font

source code

A texture-mapped font.

Instance Methods [hide private]
 
__init__(self, fileName, size, bold=True, italic=True, underline=True, outline=True, scale=1.0, reversed=True, systemFont=True) source code
 
getStringSize(self, s, scale=0.002)
Get the dimensions of a string when rendered with this font.
source code
 
getHeight(self)
Returns: The height of this font
source code
 
getLineSpacing(self)
Returns: The line spacing of this font
source code
 
setCustomGlyph(self, character, texture)
Replace a character with a texture.
source code
 
_renderString(self, text, pos, direction, scale) source code
 
render(self, text, pos=(0, 0), direction=(1, 0), scale=0.002)
Draw some text.
source code
 
_allocateGlyphTexture(self) source code
 
getGlyph(self, ch)
Get a (Texture, coordinate tuple) pair for a given character.
source code
Method Details [hide private]

getStringSize(self, s, scale=0.002)

source code 
Get the dimensions of a string when rendered with this font.
Parameters:
  • s - String
  • scale - Scale factor
Returns:
(width, height) tuple

getHeight(self)

source code 
Returns:
The height of this font

getLineSpacing(self)

source code 
Returns:
The line spacing of this font

setCustomGlyph(self, character, texture)

source code 
Replace a character with a texture.
Parameters:
  • character - Character to replace
  • texture - Texture instance

render(self, text, pos=(0, 0), direction=(1, 0), scale=0.002)

source code 
Draw some text.
Parameters:
  • text - Text to draw
  • pos - Text coordinate tuple (x, y)
  • direction - Text direction vector (x, y, z)
  • scale - Scale factor

getGlyph(self, ch)

source code 
Get a (Texture, coordinate tuple) pair for a given character.
Parameters:
  • ch - Character
Returns:
(Texture instance, coordinate tuple)