Updated 2015-11-05 10:26:41 by SeS

SeS 4th Nov 2015

Following is created to find all mono spaced font types in a given OS. This can be handy in case of source code editors, their fonts often preferred to be mono spaced. An example how it is used, see Another Font Chooser Dialog.
# ---------------------------------------------------------------------
# Purpose    : extract mono spaced font names within OS system
proc findFontClass {{type mono}} {
  foreach f [font families] {
    if {[font measure "{$f} 8" "A"]==[font measure "{$f} 8" "."]} {lappend fm $f} {lappend fv $f}
  if {"$type"=="mono"} {return $fm} {return $fv}

This proc is now part of generic_tcl.tcl library of tcl-functions, in tG² v1.09.01 - beta 2. Tested within a wish.exe console v8.4.19.

kpv: I believe that you can just query the font metrics to determine if the font is fixed width: font metrics font_name -fixed

SeS Thank you kpv! I will adapt the little proc, using the apparently already available method. I thought I had a good look to the available options in the user manual, missed it I guess.