Blender's blf module is terrible...

I can’t believe Blender’s blf module. It’s actually quite terrible. Not only does the fact that it uses pixels per inch - but if you enter in font size , it uses blender units as font size - and it can’t get any smaller. In other words - the text you get to draw is HUGE. The only way to get around this is to have the camera in orthographic view from a ridiculous distance away or - with a view factor of a ridiculous number making organizing text virtually impossible… Anyone know another way? I’d rather use the drawLine() to create the text…

EDIT: also - one of the methods (blf.aspect()) doesn’t even work…

Have you tried bgui? I haven’t had time to look at it yet, but it seems quite promising.

The bgui handles all the size and positioning of the text, you can set it using pixels or normalised 0.0-1.0 coordinates.

Heres a quick example of how to use the Label widget in the bgui:

import bge

import bgui

own = bge.logic.getCurrentController().owner

if 'gui' not in own:
    own['gui'] = bgui.System()
    own['gui_label'] = bgui.Label(own['gui'], 'label', 'text to display', font='path/to/font.ttf', options=bgui.BGUI_DEFAULT|bgui.BGUI_CENTERED)

bge.logic.getCurrentScene().post_draw = [own['gui'].render]

You can grab the bgui from google code these days:
http://code.google.com/p/bgui/

Thanks for the example, Andrew. This’ll make things far simpler to deal with.