textFont

core/typography.py

tags:

Set the font used when rendering text.

syntax

setFont(filename)

parameters

filename path to font file

additional arguments

size font size (default=10)

examples

set font type

def display():
   textFont('data/fonts/DroidSans.ttf')
   text("Droid Sans", 0, 0, 5)

   textFont('data/fonts/times.ttf')
   text("Times", 0, 0, 0)

   textFont('data/fonts/webdings.ttf')
   text("Webdings", 0, 0, -5)

set font type and size

def display():
   textFont('data/fonts/DroidSans.ttf', 32)
   text("Droid Sans", 0, 0, 5)

   textFont('data/fonts/times.ttf', 32)
   text("Times", 0, 0, 0)

   textFont('data/fonts/webdings.ttf', 32)
   text("Webdings", 0, 0, -5)