pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Wiki

TTFToBitmapConverter

      
Search:  
 
 
This is a simple conversion script to convert TTF fonts to a plain Bitmap font table.
import sys
import pygame
 
pygame.init ()
 
if len (sys.argv) < 4  or sys.argv[3] == sys.argv[1]:
    print "usage: %s fontfile size bitmapfile" % sys.argv[0]
    sys.exit ()
 
filename = sys.argv[1]
size = int(sys.argv[2])
outname = sys.argv[3]
 
font = pygame.font.Font (filename, size)
 
strings = [ "0123456789",
            "ABCDEFGHIJ",
            "KLMNOPQRST",
            "UVWXYZ \xc4\xd6\xdc",
            "abcdefghij",
            "klmnopqrst",
            "uvwxyz \xe4\xf6\xfc",
            ",;.:!?-+()"
            ]
 
surface = pygame.Surface ((len (strings[0]) * size, len (strings) * size),
                          depth=32)
surface.fill ((0, 0, 0))
 
for y, s in enumerate (strings):
    for x, c in enumerate (s):
        sf = font.render (c, True, (255, 255, 255))
        surface.blit (sf, (x * size, y * size))
pygame.image.save (surface, outname)
The strings table and colours can be changed as needed
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Oct 20, 2014

Oct 16, 2014

Oct 9, 2014

Oct 8, 2014

Oct 7, 2014

Oct 4, 2014

Oct 1, 2014

Sep 19, 2014

Sep 17, 2014

Sep 9, 2014

Sep 8, 2014

Sep 7, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)