Back to index



Class Methods


Instance Methods

 print  print_centered  size


BitmapFont is made with the SFont library and prints text with bitmaps. It is maintained by Karl Bartel on <URL:>.

Here is Karl's README:


The font file can be any type image file. The characters start with ASCII symbol #33. They are seperated by pink(255,0,255) lines at the top of the image. The space between these lines is the width of the caracter. Just take a look at the image, and you'll be able to understand what I tried to explain here.

Example for the font file format is in this picture: <URL:sfont.gif>

The easiest way to create a new font is to use the GIMP's Logo function. Use the following string as text (ASCII 33-127 with escape sequences and spaces between the letters):

! \" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

Class Methods surface )

Creates a new SFont from the drawn characters in surface. To load a font directly from disc, use Surface.load_new('fontfilename') as the argument to

Instance Methods

BitmapFont#print( surface, coordinate, text )

Puts text on surface at coordinate which is an array of [x, y].

BitmapFont#print_centered( surface, y, text )

Puts text on surface at y-coordinate y in the horizontal center of the screen.

BitmapFont#size( text )

Returns the size [width, heigth] in pixels that text will take when written.

Back to index