File: allchars.tcl

package info (click to toggle)
graphviz 14.0.5-2
  • links: PTS
  • area: main
  • in suites: sid
  • size: 139,388 kB
  • sloc: ansic: 141,938; cpp: 11,957; python: 7,766; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (30 lines) | stat: -rwxr-xr-x 642 bytes parent folder | download | duplicates (8)
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
30
#!/bin/sh
# next line is a comment in tcl \
exec tclsh "$0" ${1+"$@"}

package require Gdtclft

set font /usr/add-on/share/ttf/times.ttf 

set gd [gd create 600 900]
set white [gd color new $gd 255 255 255]
set black [gd color new $gd 0 0 0]

# assemble a string that uses all 256 character codes, on 8 x 32 character lines
set string ""
for {set i 0} {$i < 1024} {incr i} {
	if {! ($i % 32)} {
		if {$i} {
			set string "$string\r\n[format {%-5s: } $i]"
		} {
			set string [format {%-5s: } $i]
		}
	}
	set string "$string[format {%c} $i]"
}

gd text $gd $black $font 14 0 50 50 $string
	
set f [open "| xv -" w]
gd writePNG $gd $f
close $f