Font - Rabbyt Reference

Documentation Index | From module rabbyt.fonts.

# Font

`Font(pygame_font, [alphabet])`

Holds the information for drawing a font.

`pygame_font` should be a `pygame.font.Font` instace.

`alphabet` is a string containing all of the characters that should be loaded into video memory. It defaults to `rabbyt.fonts.default_alphabet` which includes numbers, symbols, and letters used in the English language.

To actually draw a font you need to use a `FontSprite`.

The characters will be rendered onto an OpenGL texture.

## Methods

### get_char_tex_shape

`get_char_tex_shape(char)`

Returns the texture shape of the given character in the form of `(left, top, right, bottom)`.

`KeyError` is raised if `char` is not in the font's `alphabet`.

### get_char_width

`get_char_width(char)`

Returns the width in pixels of the given character.