if 0 {[Richard Suchenwirth] 2004-08-20 - "Small Caps" is a typesetting style in which each letter is set with an uppercase glyph, but the logical "lowercases" are in a smaller point size, like 60..80 % of the logical "uppercase" letters. Here's my take to implement them for [Tk]'s [text] widget. You specify the widget, the position where to insert (I often use "end" there), the text itself, and optionally a font, and a smallness percentage (defaults to 67%). [http://mini.net/files/smallcaps.png] I noticed that on Win95 with Tcl 8.4.5, the default font for text widgets {{MS Sans Serif]} 8} is not rendered smaller to 5 pt, even if specified. So better give an explicit font if the smallcapping doesn't seem to work... #(1): (Couldn't you use [[[[:upper:]]]] in place of [[A-Z]]? ISTR that character classes handle umlauts etc. (in a locale specific way?) - I would test in a tkcon here, but I don't actually know how to persuade my keyboard to produce an umlauted char! --[MNO] - [RS]: Oh yes, [[[[:upper:]]]] works indeed well in my 8.4.5. I just didn't read man re_syntax too carefully... Thanks, fixed!) } proc smallcaps {w index text {font ""} {smallness 67}} { if {$font eq ""} {set font [$w cget -font]} set bigtag [string map {" " _ \{ _ \} _} $font] $w tag configure $bigtag -font $font set bigsize [lindex $font 1] set smallsize [expr {round($bigsize*$smallness/100.)}] set smallfont [lreplace $font 1 1 $smallsize] set smalltag [string map {" " _ \{ _ \} _} $smallfont] $w tag configure $smalltag -font $smallfont set cmd [list $w insert $index] #set re {([A-Z]*)([^A-Z]*)} ;# (1) set re {([[:upper:]]*)([^[:upper:]]*)} foreach {- big small} [regexp -all -inline $re $text] { lappend cmd $big $bigtag [string toupper $small] $smalltag } eval $cmd } #-- Testing: pack [text .t] smallcaps .t end "Testing SmallCaps..\n\n" {Times 12} .t insert end "This is normal text, in comparison" ---- [Arts and crafts of Tcl-Tk programming]