Closed eeucalyptus closed 7 years ago
I think PIL would be a good choice to render the fonts. But the more important issue seems to be the conversion into a gl texture. This module creates a texture using numpy. Dunno if thats anything similar.
I'll give freetype-py a chance. It's a collection of freetype bindings for python. freetype is distributed under a BSD-style license. That'd entail rendering bitmaps in-situ, maybe in steps of a factor of 2 in size, whenever they're needed. It should be pretty enough for now and easily enough implemented for me not to be pissed if we eventually replace it.
Fun fact on FreeType: Apple used to hold some patents on font hinting and prevented their usage in FreeType until 2011 (expiration date). Nevertheless, FreeType was used in macOS and iOS, with the activated hinting features. I'm trying not to judge this, but I really find this interesting :D source
The branch is merged so I think our work here is almost done.
Explaination
We need some kind of text rendering in gl. The most efficient way to do so seams to be rendering on a gl texture and then mapping this texture on a quad to determine the geometry.
Specs:
tex = RenderText(fontPath="fonts/freesans.ttf", text="Hello World", textHeight, isBold=False, isItalic=False, isUnderlined=False, isOverlined=False)
To start...
Some reading on that topic: