diff options
author | Kevin B Kenny <kennykb@acm.org> | 2009-12-15 03:44:22 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2009-12-15 03:44:22 (GMT) |
commit | 7595833de17b0131e3e2d656f3e2142022b4a911 (patch) | |
tree | a45fc2ea0bc71efdcee0f9da358961a48172c0b6 /library/demos/unicodeout.tcl | |
parent | 77874005fc8f9b5191a47c8e0157b02616bdf74d (diff) | |
download | tk-7595833de17b0131e3e2d656f3e2142022b4a911.zip tk-7595833de17b0131e3e2d656f3e2142022b4a911.tar.gz tk-7595833de17b0131e3e2d656f3e2142022b4a911.tar.bz2 |
* library/demos/unicodeout.tcl: Added code to check for
right-to-left support on Windows and adjust Hebrew and Arabic
character strings accordingly. Changed the Hebrew string to
'ktb ebryt' (ktav Ivrit, "Hebrew writing") to be consistent
with at least the Greek and Russian strings. Thanks to
Rodrigo Readi for calling the inconsistency to our attention.
Diffstat (limited to 'library/demos/unicodeout.tcl')
-rw-r--r-- | library/demos/unicodeout.tcl | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl index 3d733e1..84fe245 100644 --- a/library/demos/unicodeout.tcl +++ b/library/demos/unicodeout.tcl @@ -3,7 +3,7 @@ # This demonstration script shows how you can produce output (in label # widgets) using many different alphabets. # -# RCS: @(#) $Id: unicodeout.tcl,v 1.7 2007/12/13 15:27:07 dgp Exp $ +# RCS: @(#) $Id: unicodeout.tcl,v 1.8 2009/12/15 03:44:22 kennykb Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -11,6 +11,26 @@ if {![info exists widgetDemo]} { package require Tk +# On Windows, we need to determine whether the font system will render +# right-to-left text. + +if {[tk windowingsystem] eq {win32}} { + set rkey [join { + HKEY_LOCAL_MACHINE + SOFTWARE + Microsoft + {Windows NT} + CurrentVersion + LanguagePack + } \\] + set w32langs {} + if {![catch {package require registry}]} { + if {[catch {registry values $rkey} w32langs]} { + set w32langs {} + } + } +} + set w .unicodeout catch {destroy $w} toplevel $w @@ -55,32 +75,34 @@ set oldCursor [$w cget -cursor] $w conf -cursor watch update -if {[tk windowingsystem] in {x11 win32}} { - # Using presentation forms (pre-layouted) - addSample $w Arabic \ - "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \ - "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D" +if {[tk windowingsystem] eq {x11} + || (([tk windowingsystem] eq {win32}) && ({ARABIC} ni $w32langs))} { + # Using presentation forms (pre-layouted) + addSample $w Arabic \ + "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \ + "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D" } else { - # Using standard text characters - addSample $w Arabic \ - "\u0627\u0644\u0643\u0644\u0645\u0629 " \ - "\u0627\u0644\u0639\u0631\u0628\u064A\u0629" + # Using standard text characters + addSample $w Arabic \ + "\u0627\u0644\u0643\u0644\u0645\u0629 " \ + "\u0627\u0644\u0639\u0631\u0628\u064A\u0629" } addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57" addSample $w "Simpl. Chinese" "\u6C49\u8BED" addSample $w Greek \ "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \ "\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1" -if {[tk windowingsystem] in {x11 win32}} { - # Visual order (pre-layouted) - addSample $w Hebrew \ - "\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 " \ - "\u05DC\u05D9\u05D0\u05E8\u05E9\u05D9" +if {[tk windowingsystem] eq {x11} + || (([tk windowingsystem] eq {win32}) && ({HEBREW} ni $w32langs))} { + # Visual order (pre-layouted) + addSample $w Hebrew \ + "\u05EA\u05D9\u05E8\u05D1\u05E2 " \ + "\u05D1\u05EA\u05DB" } else { - # Standard logical order - addSample $w Hebrew \ - "\u05D9\u05E9\u05E8\u05D0\u05D9\u05DC " \ - "\u05D9\u05E8\u05D5\u05E9\u05DC\u05D9\u05DD" + # Standard logical order + addSample $w Hebrew \ + "\u05DB\u05EA\u05D1 " \ + "\u05E2\u05D1\u05E8\u05D9\u05EA" } addSample $w Japanese \ "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \ |