Bubble Letters

Keith Vetter 2011-08-08 : Here's a fun little script that transcribes ASCII text into Unicode circled letters, e.g. Ⓚⓔⓘⓣⓗ Ⓥⓔⓣⓣⓔⓡ

##+##########################################################################
#
# bubbleLetters.tsh -- transcribe argv into bubble letters 
# by Keith Vetter, August 2011
#

set CIRCLED_DIGIT_ZERO 0x24EA
set CIRCLED_DIGIT_ONE 0x2460
set CIRCLED_LATIN_CAPITAL_LETTER_A 0x24b6
set CIRCLED_LATIN_SMALL_LETTER_A 0x24d0

set newArgs {}
foreach arg $argv {
    set newArg ""
    foreach letter [split $arg ""] {
        scan $letter %c ch
        if {$letter eq "0"} {
            append newArg [format %c $CIRCLED_DIGIT_ZERO]
        } elseif {$letter >= "1" && $letter <= "9"} {
            append newArg [format %c [expr {$CIRCLED_DIGIT_ONE + $ch - 49}]]
        } elseif {$letter >= "A" && $letter <= "Z"} {
            append newArg [format %c [expr {$CIRCLED_LATIN_CAPITAL_LETTER_A + $ch - 65}]]
        } elseif {$letter >= "a" && $letter <= "z"} {
            append newArg [format %c [expr {$CIRCLED_LATIN_SMALL_LETTER_A + $ch - 97}]]
        } else {
            append newArg $letter
        }
    }
    lappend newArgs $newArg
}
puts [join $newArgs " "]
return