printlarge.py
This is an example of how bitmap fonts work. It can also be used to display decimal values in a very large font on simple terminals.
Result
""" printlarge.py
A simple example of how bitmap fonts work.
Created by Martin Hepp on 2009-11-17 http://www.heppnetz.de
"""
font = {'0':(
'****',
'* *',
'* *',
'* *',
'* *',
'* *',
'****'),
'1':(
' * ',
' * ',
' * ',
' * ',
' * ',
' * ',
' * '),
'2':(
'****',
' *',
' *',
'****',
'* ',
'* ',
'****'),
'3':(
'****',
' *',
' *',
'****',
' *',
' *',
'****'),
'4':(
'* *',
'* *',
'* *',
'****',
' *',
' *',
' *'),
'5':(
'****',
'* ',
'* ',
'****',
' *',
' *',
'****'),
'6':(
'* ',
'* ',
'* ',
'****',
'* *',
'* *',
'****'),
'7':(
'****',
' *',
' *',
' *',
' *',
' *',
' *'),
'8':(
'****',
'* *',
'* *',
'****',
'* *',
'* *',
'****'),
'9':(
'****',
'* *',
'* *',
'****',
' *',
' *',
' *'),
',':(
' ',
' ',
' ',
' ',
' ** ',
' ** ',
' ** ')
}
text = "199,49" # define number to be displayed rows = ["","","","","","",""] # seven empty strings representing each line of the output
for char in text:
pattern = font[char]
for i in range(7):
rows[i] += pattern[i] + " "
for line in rows:
print line