Version 0 of Easy input of Romanised Sanskrit

Updated 2005-05-29 00:10:35

WJG (29th May, 2005) The basic core code used to enable pinyin input can also be used to allow the user to input other equally obscure characters -in this case romanized Sanskrit and Pali. Naturally, the lookup table can be extended to include other sounds found in other Indic languages.

# ------------------------------------------------------------- # skt_input_0.1a.tcl # Written by William J Giddings, 2005 # ------------------------------------------------------------- # Usage: # skt_input <widget> # # Purpose: # -------- # To provide text editing application with an easy access to the # specialist characters required in romanising the Indic languages. # # User operation: # --------------- # Use combination of Alt-Key to obtain letters with diacritics.

# # Notes: # ------ # The necessary diacritics are not available in the standard unicode # sets. Use modified fonts to obtain diacritics. # # Whils the font URW Palladio IS is currently utilized, other look-up tables # could be used for other font sets such as Normyn. # # References: # ---------- # Obtain suitable fonts from: # http://www.sanskritweb.net/itrans/ # # -------------------------------------------------------------

# ------------------------------------------------------------- # # ------------------------------------------------------------- proc {skt_input} {txt} {

        proc {_skt_insert} {w v} {
                switch $v {
                        a { set code 0E5 }
                        i { set code 0EF }
                        u { set code 0F7 }
                        r { set code 0A1 }
                        R { set code 0A2 }
                        l { set code 0FD }
            L { set code 0FE }          
                        n { set code 0F1 }
                        N { set code 0BD }
            M { set code 0BC }
                        t { set code 0B6 }
                        d { set code 0B7 }
                        S { set code 0B8 }
                        s { set code 0B9 }
                        m { set code 0BA } 
                        h { set code 0B5 } 
                        }
                #puts $code 
                $w insert insert [subst \\u$code] 
        }
    # create specific bindings
        foreach {key} {a i u r R l L N M n t d S s m h} {
                        bind $txt <Alt-Key-$key> [list _skt_insert %W $key]
                } 

}

# ------------------------------------------------------------- # test the code # ------------------------------------------------------------- proc demo {} {

    package require Tk
    text .txt -font {{URW Palladio IS} 14}
    pack .txt -fill both -expand 1 
    skt_input .txt

}

demo