Artifact
9dfa9cdd8c1ad5604b2921f7f6468ab6f75e44507f61fd96467920555cde77ea:
Attachment "biditest.tcl" to
ticket [1b81ff43]
added by
kevin_walzer
2026-03-23 14:17:48.
package require Tk
wm title . "Tk Unicode / Bidi Rendering Test"
frame .f
pack .f -fill both -expand 1
canvas .f.c -yscrollcommand ".f.s set" -width 900 -height 700
scrollbar .f.s -orient vertical -command ".f.c yview"
pack .f.s -side right -fill y
pack .f.c -side left -fill both -expand 1
frame .f.c.inner
.f.c create window 0 0 -window .f.c.inner -anchor nw
proc testlabel {title text {font "Arial 12"}} {
label .f.c.inner.t[incr ::i] -text $title -font {Arial 12 bold} -anchor w
pack .f.c.inner.t$::i -fill x -pady {15 0}
label .f.c.inner.l[incr ::i] -text $text -font $font -anchor w
pack .f.c.inner.l$::i -fill x
}
set i 0
# Basic shaping
testlabel "Basic multilingual rendering" \
"English العربية हिन्दी ไทย 日本語"
# Bidi mixing
testlabel "Bidi mixing (LTR + RTL)" \
"ABC אבג DEF مرحبا XYZ"
# Arabic ligatures
testlabel "Arabic ligatures" \
"الله محمد مرحبا"
# Hebrew
testlabel "Hebrew RTL" \
"שלום עולם זה מבחן"
# Indic shaping
testlabel "Devanagari shaping" \
"नमस्ते दुनिया भारत एक महान देश है"
# Thai marks
testlabel "Thai combining marks" \
"ภาษาไทยเป็นภาษาที่สวยงาม"
# Combining diacritics
testlabel "Unicode combining marks" \
"á é ô ä ů ñ"
# Emoji fallback
testlabel "Emoji fallback" \
"Hello 🌍 😀 👍 🧠 🚀"
# Font fallback test
testlabel "Fallback fonts test" \
"English العربية हिन्दी 日本語 한국어"
# Long run stress
set longtxt ""
for {set k 0} {$k < 30} {incr k} {
append longtxt "English العربية हिन्दी ไทย "
}
testlabel "Long run stress test" $longtxt {Arial 16}
# Canvas test
label .f.c.inner.canvasTitle -text "Canvas text test" -font {Arial 14 bold}
pack .f.c.inner.canvasTitle -fill x -pady {20 0}
canvas .f.c.inner.canvas -width 800 -height 100 -bg white
pack .f.c.inner.canvas -fill x
.f.c.inner.canvas create text 10 50 -anchor w \
-font {Arial 28} \
-text "Canvas: Hello مرحبا שלום हिन्दी ไทย"
# Text widget test
label .f.c.inner.textTitle -text "Text widget layout test" -font {Arial 12 bold}
pack .f.c.inner.textTitle -fill x -pady {20 0}
text .f.c.inner.t -width 80 -height 8 -font {Arial 12}
pack .f.c.inner.t -fill x
.f.c.inner.t insert end "English العربية हिन्दी ไทย\n"
.f.c.inner.t insert end "ABC אבג DEF مرحبا XYZ\n"
.f.c.inner.t insert end "नमस्ते दुनिया\n"
.f.c.inner.t insert end "שלום עולם\n"
update idletasks
.f.c configure -scrollregion [.f.c bbox all]