I am trying to align my bitmap font text in my OpenGL application but I can't find anything on getting the width of each character. This is my renderText function:
def renderText( self, text, fontFace, position ):
..... (omitted code to make post shorter)
glRasterPos2i( position[0], self.windowSize[1] - position[1] )
glPushAttrib( GL_LIST_BIT )
glListBase( self.fonts[ fontFace ] - 32 )
glCallLists( text )
glPopAttrib()
......
I create the bitmap font and use glGenList to store it.
self.fonts[ fontFace ] = glGenLists( 96 )
font = win32ui.CreateFont( fontProperties )
font = hDisplayContext.SelectObject( font )
wglUseFontBitmaps( displayContext, 32, 96, self.fonts[ fontFace ] )
Anyone know if it's possible to get the character widths or even just the final rendered text's total width? Thanks!