FontManager - No Tutorial or Example & it is Broken

Issue #47 wontfix
Jordan F created an issue

Well using py-sdl2 I was about to move on to making a menu when I suddenly realized that I had no idea how to create text. I had the API open and understand how to get a surface from the FontManager but was unable to find any further documentation or even an example.

I then proceeded to try and build a test case to see how I would go about converting the text into a surface and then into a sprite and finally into an entity. But I encountered this error while creating the FontManager:

Traceback (most recent call last): File "", line 34, in <module> font_manager = sdl2.ext.FontManager('Villa.ttf') File "/usr/local/lib/python3.3/dist-packages/sdl2/ext/", line 187, in init "FontManager requires sdlttf support") sdl2.ext.compat.UnsupportedError: 'FontManager requires sdlttf support' Exception AttributeError: "'FontManager' object has no attribute 'fonts'" in <bound method FontManager.del of <sdl2.ext.font.FontManager object at 0x7fef2b3e3110>> ignored

My system is Linux Mint 16 64-bit and I have both libsdl-ttf2.0-dev (ver2.0.11-2ubuntu1) and libsdl-ttf2.0-0 (ver2.0.11-2ubuntu1) installed.

Comments (4)

  1. Marcus von Appen repo owner

    You need the SDL2_ttf version compatible with SDL 2 , not SDL 1.2. Do the packages, you mention, install a library named

  2. Jordan F reporter

    It appears I can only install libsdl2-2.0-0, libsdl2-image-2.0-0, libsdl2-mixer-2.0-0, libsdl2-net-2.0-0. Thus it appears that Linux Mint 16 does not have a libsdl2-ttf-2.0-0 package which I believe would have the desired file. Searching my system for "" yeild no results. I was able to find the desired package here:

    Now i am working on getting the code correct. I was getting a traceback about hardware acceleration. But i think that is because I had defined a Software renderer in a Hardware manner. I will just need to work out the proper details, butI did get some text to display albiet on very noise filled surface.

    So with the proper dependency installed that still leaves the issue of tutorial and example code. I may post some example code once I work out the details.

    Thanks for your help so far, and for the excellent code. By the way I believe the UI functionality of the pysdl2 is your killer feature, because I know longer need to figure out which sprites are hit by user clicks, instead I can just create an onclick event callback!

  3. Marcus von Appen repo owner

    Great to hear that it works for you now.

    Examples and documentation is lacking all over the place, so rest assured that this is a known issue ;-).

    I'll close this issue for now; if you are running into further issues with using the FontManager class, please open a new one.

  4. Log in to comment