summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog36
-rw-r--r--library/demos/unicodeout.tcl105
2 files changed, 85 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index a6ce2b7..67022b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,24 +1,30 @@
+2009-12-15 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/demos/unicodeout.tcl (usePresentationFormsFor): Split out
+ the code to decide whether to use presentation forms for clarity, and
+ add some more languages (though only in natural uncomposed form for
+ Devanagari script).
+
2009-12-14 Kevin B. Kenny <kennykb@acm.org>
- * 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.
-
+ * 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.
+
2009-12-02 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkInt.decls: [Bugs 220600, 220690]: Comment that
- TkWinChildProc is exported through the stubs table
- since 8.5.9
+ * win/tkInt.decls: [Bugs 220600, 220690]: Comment that TkWinChildProc
+ is exported through the stubs table since 8.5.9
2009-12-11 Jan Nijtmans <nijtmans@users.sf.net>
- * win/makefile.vc: Fix dependancies on ${TKSTUBLIB} when
- TCL_USE_STATIC_PACKAGES is defined
- * generic/tkWindow.c: Fix gcc warning, using gcc-4.3.4 on cygwin
- warning: array subscript has type 'char'
+ * win/makefile.vc: Fix dependancies on ${TKSTUBLIB} when
+ TCL_USE_STATIC_PACKAGES is defined
+ * generic/tkWindow.c: Fix gcc warning, using gcc-4.3.4 on cygwin
+ warning: array subscript has type 'char'
2009-12-11 Donal K. Fellows <dkf@users.sf.net>
@@ -205,7 +211,7 @@
2009-10-26 Don Porter <dgp@users.sourceforge.net>
- * unix/Makefile.in: Remove $(PACKAGE).* and prototype from the
+ * unix/Makefile.in: Remove $(PACKAGE).* and prototype from the
`make distclean` target. Completes 2009-10-20 commit.
2009-10-25 Donal K. Fellows <dkf@users.sf.net>
diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl
index 84fe245..46bbfd2 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.8 2009/12/15 03:44:22 kennykb Exp $
+# RCS: @(#) $Id: unicodeout.tcl,v 1.9 2009/12/15 11:50:33 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -11,26 +11,6 @@ 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
@@ -52,11 +32,9 @@ pack $w.msg -side top
set btns [addSeeDismiss $w.buttons $w]
pack $btns -side bottom -fill x
-pack [label $w.wait -text "Please wait while loading fonts..." \
- -font {Helvetica 12 italic}]
-pack [frame $w.f] -expand 1 -fill both -padx 2m -pady 1m
+## The frame that will contain the sample texts.
+pack [frame $w.f] -side bottom -expand 1 -fill both -padx 2m -pady 1m
grid columnconfigure $w.f 1 -weight 1
-
set i 0
proc addSample {w language args} {
global font i
@@ -68,42 +46,87 @@ proc addSample {w language args} {
grid configure $w.f.l$j -padx 1m
}
-# Processing when some characters are missing might take a while, so make
-# sure we're displaying something in the meantime...
+## A helper procedure that determines what form to use to express languages
+## that have complex rendering rules...
+proc usePresentationFormsFor {language} {
+ switch [tk windowingsystem] {
+ aqua {
+ # OSX wants natural character order; the renderer knows how to
+ # compose things for display for all languages.
+ return false
+ }
+ x11 {
+ # The X11 font renderers that Tk supports all know nothing about
+ # composing characters, so we need to use presentation forms.
+ return true
+ }
+ win32 {
+ # On Windows, we need to determine whether the font system will
+ # render right-to-left text. This varies by language!
+ try {
+ package require registry
+ set rkey [join {
+ HKEY_LOCAL_MACHINE
+ SOFTWARE
+ Microsoft
+ {Windows NT}
+ CurrentVersion
+ LanguagePack
+ } \\]
+ return [expr {
+ [string toupper $language] ni [registry values $rkey]
+ }]
+ } trap error {} {
+ # Cannot work it out, so use presentation forms.
+ return true
+ }
+ }
+ default {
+ # Default to using presentation forms.
+ return true
+ }
+ }
+}
+## Processing when some characters are not currently cached by the display
+## engine might take a while, so make sure we're displaying something in the
+## meantime...
+pack [label $w.wait -text "Please wait while loading fonts..." \
+ -font {Helvetica 12 italic}]
set oldCursor [$w cget -cursor]
$w conf -cursor watch
update
-if {[tk windowingsystem] eq {x11}
- || (([tk windowingsystem] eq {win32}) && ({ARABIC} ni $w32langs))} {
+## Add the samples...
+if {[usePresentationFormsFor Arabic]} {
# Using presentation forms (pre-layouted)
addSample $w Arabic \
- "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \
- "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
+ "\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"
+ "\u0627\u0644\u0643\u0644\u0645\u0629 " \
+ "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
}
-addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
+addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
addSample $w "Simpl. Chinese" "\u6C49\u8BED"
+addSample $w French "Langue fran\u00E7aise"
addSample $w Greek \
"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
"\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
-if {[tk windowingsystem] eq {x11}
- || (([tk windowingsystem] eq {win32}) && ({HEBREW} ni $w32langs))} {
+if {[usePresentationFormsFor Hebrew]} {
# Visual order (pre-layouted)
addSample $w Hebrew \
- "\u05EA\u05D9\u05E8\u05D1\u05E2 " \
- "\u05D1\u05EA\u05DB"
+ "\u05EA\u05D9\u05E8\u05D1\u05E2 \u05D1\u05EA\u05DB"
} else {
# Standard logical order
addSample $w Hebrew \
- "\u05DB\u05EA\u05D1 " \
- "\u05E2\u05D1\u05E8\u05D9\u05EA"
+ "\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA"
}
+addSample $w Hindi \
+ "\u0939\u093f\u0928\u094d\u0926\u0940 \u092d\u093e\u0937\u093e"
+addSample $w Icelandic "\u00CDslenska"
addSample $w Japanese \
"\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
"\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
@@ -111,6 +134,6 @@ addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
addSample $w Russian \
"\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
-# We're done processing, so change things back to normal running...
+## We're done processing, so change things back to normal running...
destroy $w.wait
$w conf -cursor $oldCursor