RZ 19 Feb 2015 - This is a procedure to display the original hershey vector font data in a canvas.
## Display hershey font data. # # \param pattern Glob like pattern of hershey files. proc hershey_display {pattern} { array set myData {} foreach myFile [glob $pattern] { array set myData [hershey_readfile $myFile] } catch {destroy .f} grid rowconfigure . 1 -weight 1 grid columnconfigure . 1 -weight 1 grid [frame .f] -row 1 -column 1 -sticky nesw grid rowconfigure .f 1 -weight 1 grid columnconfigure .f 1 -weight 1 grid [scrollbar .f.v -command {.f.c yview} -orient vertical] -row 1 -column 2 -sticky ns grid [scrollbar .f.h -command {.f.c xview} -orient horizontal] -row 2 -column 1 -sticky ew grid [canvas .f.c -xscrollcommand {.f.h set} -yscrollcommand {.f.v set}] -row 1 -column 1 -sticky nesw set r 0 set c 0 foreach myNr [lsort -integer [array names myData]] { if {[incr c] > 10} { set c 1 incr r } .f.c create text [expr {10+60*$c}] [expr {30+40*$r}] -text $myNr: -anchor s hershey_glyph .f.c $myData($myNr) [expr {30+60*$c}] [expr {30+40*$r}] 0 1 } .f.c configure -scrollregion [.f.c bbox all] } ## Draw a single glyph on a canvas. # \param canvas Name of canvas widget. # \param data Converted glyph line from hershey file. # \param x X-offset in canvas. # \param y Y-offset in canvas. # \param angle Angle of glyph. # \param scale Scaling factor of glyph. # \private proc hershey_glyph {canvas data x y angle scale} { if {$angle == 0} { set l [lindex $data 0] set xoff [expr {$x - $l * $scale}] set yoff [expr {$y - 9 * $scale}] foreach myCoor [lrange $data 2 end] { set myList {} foreach {x2 y2} $myCoor { lappend myList [expr {$xoff+$scale*$x2}] [expr {$yoff+$scale*$y2}] } if {[llength $myList] < 4} continue $canvas create line $myList } } else { set s [expr {sin(0.0174532925199433 * -$angle)}] set c [expr {cos(0.0174532925199433 * $angle)}] set l [lindex $data 0] set xoff [expr {$x + $scale * (-$l * $c + 9 * $s)}] set yoff [expr {$y + $scale * (-9 * $c - $l * $s)}] foreach myCoor [lrange $data 2 end] { set myList {} foreach {x2 y2} $myCoor { set px [expr {$x2 * $c - $y2 * $s}] set py [expr {$x2 * $s + $y2 * $c}] lappend myList [expr {$xoff+$scale*$px}] [expr {$yoff+$scale*$py}] } if {[llength $myList] < 4} continue $canvas create line $myList } } } ## Create internal data representation from original hershey data. # \param file Name of hershey.oc? file proc hershey_readfile {file} { set myFd [open $file r] set myC [read $myFd] close $myFd set myNr 0 foreach myLine [split $myC \n] { if {[string index $myLine 4] in {0 1 2 3 4 5 6 7 8 9}} { set myNr [string trim [string range $myLine 1 4]] # ignore chars at 5,6,7 set myGlyph($myNr) [string range $myLine 8 end] } else { append myGlyph($myNr) $myLine } } # Parse all found entries, R==82 # xxlr.. -- xx=word count (not used) l=left margin, r=right margin array set myRet {} foreach {myNr myLine} [array get myGlyph] { set myRet($myNr) [expr {[scan [string index $myLine 0] %c]-82}] lappend myRet($myNr) [expr {[scan [string index $myLine 1] %c]-82}] set myList {} set myR 0 foreach myC [split [string range $myLine 2 end] {}] { if {$myR} { if {$myC ne {R}} {error $myNr=$myLine} set myR 0 continue } if {$myC eq { }} { lappend myRet($myNr) $myList set myList {} set myR 1 continue } lappend myList [expr {[scan $myC %c]-82}] } if {[llength $myList]} {lappend myRet($myNr) $myList} } return [array get myRet] }
Then get the original hersh.oc1..4 files (see at Vector Font) and start with:
hershey_display hershey-font/hersh.oc?