#! /bin/sh
# next line not seen by tcl upon reentry by exec \
DYLD_LIBRARY_PATH=$CSURF_LIBRARY_PATH exec wish8.5 $0 ${1+"$@"}
if {[exec uname] == "Linux"}  {load libTix8.4.3.so}    ;#uses LD_LIBRARY_PATH
if {[exec uname] == "Darwin"} {load libTix8.4.3.dylib} ;#uses DYLD_LIBRARY_PATH
if {[exec uname] == "IRIX"}   {load libTix8.4.3.so}   ;#uses LD_LIBRARYN32_PATH

if ![info exists env(CSURF_DIR)] {
  puts "CSURF_DIR not setenv'd/export'd"
  exit
}
source $env(CSURF_DIR)/lib/tcl/wrappers.tcl

### test/display all fonts used in csurf/tk{surfer,medit,register}
set thinfonts "sfont ffont hfont mfont"
set boldfonts "ffontb ffontbb pfont tfont ifont"

set i 0
foreach fontname "$thinfonts $boldfonts" {
  set fontval [set $fontname]
  label .a$i -text "$fontname -> $fontval" -font [set ffont]
  set actfont [font actual $fontval]
  pack .a$i
  label .d$i -text "actual: $actfont" -font [set ffont]
  pack .d$i
  set line "SessTools subject: marser-qT1 130229MS 0.24"
  label .b$i -font $fontval -text $line
  pack .b$i -side top
  entry .e$i -font $fontval -textvariable v$i -width 50
  set v$i $line
  pack .e$i -side top
  label .c$i -text "" -font [set ffont]
  pack .c$i -side top
  incr i
}

# from tk font manpage: but crashes (on .t tag configure) :-}
#pack [text .t -wrap none] -fill both -expand 1
#set count 0
#set tabwidth 0
#foreach family [lsort -dictionary [font families]] {
#  .t tag configure f[incr count] -font [list $family 10]
#  .t insert end ${family}:\t {} "This is a simple sampler\n" f$count
#  set w [font measure [.t cget -font] ${family}:]
#  if {$w+5 > $tabwidth} {
#    set tabwidth [expr {$w+5}]
#    .t configure -tabs $tabwidth
#  }
#}

