File: fonts.py

package info (click to toggle)
pyopengl 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,140 kB
  • sloc: python: 26,428; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 840 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Load font "constants" (actually void *s) from the GLUT DLL"""
from OpenGL import platform
import logging 
log = logging.getLogger( 'OpenGL.GLUT.fonts' )

for name in [
    'GLUT_STROKE_ROMAN',
    'GLUT_STROKE_MONO_ROMAN',
    'GLUT_BITMAP_9_BY_15',
    'GLUT_BITMAP_8_BY_13',
    'GLUT_BITMAP_TIMES_ROMAN_10',
    'GLUT_BITMAP_TIMES_ROMAN_24',
    'GLUT_BITMAP_HELVETICA_10',
    'GLUT_BITMAP_HELVETICA_12',
    'GLUT_BITMAP_HELVETICA_18',
]:
    try:
        # Win32 just has pointers to values 1,2,3,etc
        # GLX has pointers to font structures...
        p = platform.getGLUTFontPointer( name )
    except (ValueError,AttributeError), err:
        if platform.GLUT:
            log.warn( '''Unable to load font: %s''', name )
        globals()[name] = None
    else:
        globals()[name] = p
        del p

del platform, name