[PyOpenGL-Users] true type fonts
Brought to you by:
mcfletch
|
From: Sean R. <mrr...@ya...> - 2003-01-12 03:09:17
|
Here is some code I used to get true type font working. This took a while to
figure out...
handle = 55
def createFont(fontName, fontSize):
props = {"name":fontName,
"height":(int)(fontSize),
"charset":0, "weight":1,
"pitch and family":18}
pf = win32ui.CreateFont( props )
hdc = wglGetCurrentDC()
pdc = win32ui.CreateDCFromHandle(hdc)
old = pdc.SelectObject(pf)
result = wglUseFontBitmaps(hdc , 0, 255, handle)
if not result:
print "ERROR!"
pdc.SelectObject(old)
def drawText(text, pos, color):
glColor4ub( color[0], color[1], color[2], color[3] )
glRasterPos2i(position[0], position[1])
glListBase(handle)
glCallLists(text)
This fails on some machines though, when trying to create the truetype
font... I
dunno why.
---------------------------------
"I'm not as interested in being witty as I am in being clear", Scott Meyers
Sean Riley
MrR...@ya...
|