Debian Codegraph @

tclpkg/gdtclft/examples/allchars.tcl

raw
1 #!/bin/sh
2 # next line is a comment in tcl \
3 exec tclsh "$0" ${1+"$@"}
4
5 package require Gdtclft
6
7 set font /usr/add-on/share/ttf/times.ttf
8
9 set gd [gd create 600 900]
10 set white [gd color new $gd 255 255 255]
11 set black [gd color new $gd 0 0 0]
12
13 # assemble a string that uses all 256 character codes, on 8 x 32 character lines
14 set string ""
15 for {set i 0} {$i < 1024} {incr i} {
16 if {! ($i % 32)} {
17 if {$i} {
18 set string "$string\r\n[format {%-5s: } $i]"
19 } {
20 set string [format {%-5s: } $i]
21 }
22 }
23 set string "$string[format {%c} $i]"
24 }
25
26 gd text $gd $black $font 14 0 50 50 $string
27
28 set f [open "| xv -" w]
29 gd writePNG $gd $f
30 close $f