BBX Python: FreeType2 Fonts

Posted:   |  More posts about PlayBook Python FreeType2 BBPyProject

This is definitely not ready for serious use, but I thought I'd share a screenshot with the first text rendering support for BBX-Python.


The code's too crude to commit yet, and it's ridiculously sluggish at the moment, since I'm using FreeType to render each character and then -- in Python! -- copying over each pixel into a libscreen pixmap buffer which is then blitted onto the screen. One character at a time.

But hey! I've got some text output!

Here's the top-level code which generated that screen:


xpos = 20
draw_image(xpos, 15, b'shared/documents/scripts/logo.png')

color = 0xff5511
fontsize = 48
leading = 70
ypos = 200
for text in [
    'The time is %s' %,
    'Python ' + sys.version.split('\n', 1)[0],
    'Visit to learn more.',
    draw_text(xpos, ypos, text, fontsize=fontsize, color=color)
    ypos += leading
    fontsize = 36
    color = 0xffffff


As of June 2012, we've renamed this the BlackBerry-Py Project. You can follow news about it at @BBPyProject and the web site has moved too.

Comments powered by Disqus