aboutsummaryrefslogtreecommitdiff
path: root/bidi-plugin.tcl
blob: ed3d8e45928bde14e748284989adab7c560ec675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# META bidi plugin
# META DESCRIPTION bidirectional text input
# META AUTHOR IOhannes m zmölnig <zmoelnig@umlaeute.mur.at>
# META VERSION 0.1

package require Tcl 8.4

set auto_path_bidi $auto_path
lappend auto_path $::current_plugin_loadpath

if {[catch {package require fribidi} result]} {
pdtk_post "failed to load bidi-plugin: $result\n"
} else {

###########################################################
# overwritten procedures
rename pdtk_text_set pdtk_text_set_bidi
rename pdtk_text_new pdtk_text_new_bidi

###########################################################
# overwritten

# change the text in an existing text box
proc pdtk_text_set {tkcanvas tag text} {
    pdtk_text_set_bidi $tkcanvas $tag [fribidi::log2vis $text]
}
proc pdtk_text_new {tkcanvas tags x y text font_size color} {
    pdtk_text_new_bidi $tkcanvas $tags $x $y [fribidi::log2vis $text] $font_size $color
}
pdtk_post "loaded: bidi-plugin 0.1\n"
}
set auto_path $auto_path_bidi