summaryrefslogtreecommitdiffstats
path: root/Demo/sgi/gl/glstdwin/fontchart.py
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/sgi/gl/glstdwin/fontchart.py')
-rw-r--r--Demo/sgi/gl/glstdwin/fontchart.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/Demo/sgi/gl/glstdwin/fontchart.py b/Demo/sgi/gl/glstdwin/fontchart.py
new file mode 100644
index 0000000..6b58f12
--- /dev/null
+++ b/Demo/sgi/gl/glstdwin/fontchart.py
@@ -0,0 +1,34 @@
+import stdwingl
+
+import stdwin
+from stdwinevents import *
+
+def main():
+ size = 12
+ w = stdwin.open('Font chart ' + `size`)
+ while 1:
+ type, window, detail = stdwin.getevent()
+ if type == WE_CLOSE:
+ break
+ if type == WE_DRAW:
+ width, height = w.getwinsize()
+ d = w.begindrawing()
+ d.setsize(size)
+ h, v = 0, 0
+ for c in range(32, 256):
+ ch = chr(c)
+ chw = d.textwidth(ch)
+ if h + chw > width:
+ v = v + d.lineheight()
+ h = 0
+ if v >= height:
+ break
+ d.text((h, v), ch)
+ h = h + chw
+ del d
+ if type == WE_MOUSE_UP:
+ size = size + 1
+ w.settitle('Font chart ' + `size`)
+ w.change((0, 0), (2000, 2000))
+
+main()