Updated 2018-03-06 20:35:51 by JOB

Keith Vetter 2004-10-22 : A very simple font viewer that displays all fonts on your system. Fixed width fonts are prefixed with a star.
 package require Tk
 canvas .c -bd 0 -height 0 -highlightthickness 0 ;# Just for resizing by pixels
 scrollbar .sb -orient vertical -command {.t yview}
 text .t -wrap none -yscrollcommand {.sb set} -width 0
 pack .sb -fill y -side right
 pack .c  -fill both -expand 1 -side top
 pack .t  -fill both -expand 1 -side left
 bind all <Key-F2> {console show}
 catch {eval font delete [font names]}
 set default [lindex [.t config -font] 3]
 .t tag configure default -font $default
 set sample "AaBbCcDdEeFfGgHhIi 1234567890 .,+-:*?!"
 set left  0
 set width 0
 foreach font [lsort -dictionary [font families]] {
    set len [font measure $default $font]       ;# Size of font name
    if {$len > $left} {set left $len}
    set f [font create -family $font]
    set len [font measure $f $sample]
    if {$len > $width} {set width $len}
    if {[font metrics $f -fixed]} {
        .t insert end "*" default
    .t tag configure tag_$f -font $f
    .t insert end "$font\t" default "$sample\n" tag_$f
 set left  [expr {$left + 5}]
 set width [expr {$width + $left + 10}]
 .t config -tabs [list [expr {($left + $width) / 2}] center]
 .c config -width $width

This displays all fonts at once. If you instead want to choose a font then checkout BWidget's [SelectFont], A little font chooser, A small font chooser or Another font chooser dialog - based on tablelist

Oct-08-2005 There is also a font selection dialogue by dkf. Look at http://people.man.ac.uk/~zzcgudf/tcl/mwidx.html#fontdlg

LES When I maximize this app, the font pane remains in the same size, in more or less the center of the window. All my experiments with -expand have failed. How can I make it expand correctly?

MG Try changing the line
  pack .c -fill both -expand 1 -side top

so that it reads
  pack .c -fill x -expand 0 -side top

That seems to fix the problem for me.