Summary edit
Richard Suchenwirth 2003-05-28 - This is a crude little canvas presentation graphics that runs on PocketPCs, but also on bigger boxes (one might scale fonts and dimensions there). Switch pages with Left/Right cursor, or left/right mouseclick (though a stylus cannot right-click).Not much, but it's compact, and with a cute little language for content specification, see example at end (which shows what I'm going to present in Nuremberg...)Code edit
proc slide args { global slides if {![info exist slides]} slide'init incr slides(N) set slides(title,$slides(N)) [join $args] } proc slide'line {type args} { global slides lappend slides(body,$slides(N)) [list $type [join $args]] } foreach name {* + -} {interp alias {} $name {} slide'line $name} proc slide'init {} { global slides array set slides { canvas .c N 0 show 1 dy 20 titlefont {Tahoma 14 bold} * {Tahoma 9 bold} + {Tahoma 8} - {Courier 9} } pack [canvas .c -bg white] foreach e {<1> <Right>} {bind . $e {slide'show 1}} foreach e {<3> <Left>} {bind . $e {slide'show -1}} wm geometry . +0+0 after idle {slide'show 0} } proc slide'show delta { upvar #0 slides s incr s(show) $delta if {$s(show)<1 || $s(show)>$s(N)} { incr s(show) [expr -$delta] } else { set c $s(canvas) $c delete all set x 10; set y 20 $c create text $x $y -anchor w -text $s(title,$s(show))\ -font $s(titlefont) -fill blue incr y $s(dy) $c create line $x $y 2048 $y -fill red -width 4 foreach line $s(body,$s(show)) { foreach {type text} $line break incr y $s(dy) $c create text $x $y -anchor w -text $text \ -font $s($type) } } } bind . <Up> {exec wish $argv0 &; exit} ;# dev helper #--------------- The rest is data - or is it code? Anyway, here's my show: slide i18n - Tcl for the world + Richard Suchenwirth, Nuremberg 2003 + * i18n: internationalization + 'make software work with many languages' + * l10n: localization + 'make software work with the local language' slide Terminology * Glyphs: + visible elements of writing * Characters: + abstract elements of writing * Byte sequences: + physical text data representation * Rendering: character -> glyph * Encoding: character <-> byte sequence slide Before Unicode * Bacon (1580), Baudot: 5-bit encodings * Fieldata (6 bits), EBCDIC (8 bits) * ASCII (7 bits) + world-wide "kernel" of encodings * 8-bit codepages: DOS, Mac, Windows * ISO 8859-x: 16 varieties slide East Asia * Thousands of characters/country + Solution: use 2 bytes, 94x94 matrix + Japan: JIS C-6226/0208/0212 + China: GB2312-80 + Korea: KS-C 5601 + * coexist with ASCII in EUC encodings slide Unicode covers all * Common standard of software industry * kept in synch with ISO 10646 + Used to be 16 bits, until U 3.1 + Now needs up to 31 bits * Byte order problem: + little-endian/big-endian + U+FEFF "Byte Order Mark" + U+FFFE --illegal-- slide UTF-8 * Varying length: 1..3(..6) bytes + 1 byte: ASCII + 2 bytes: pages 00..07, Alphabets + 3 bytes: pages 08..FF, rest of BMP + >3 bytes: higher pages + * Standard in XML, coming in Unix slide Tcl i18n * Everything is a Unicode string (BMP) + internal rep: UTF-8/UCS-2 * Important commands: - fconfigure \$ch -encoding \$e - encoding convertfrom \$e \$s - encoding convertto \$e \$s + * msgcat supports l10n: - {"File" -> [mc "File"]} slide Tk i18n * Any widget text is Unicoded * Automatic font finding + Fonts must be provided by system + * Missing: bidi treatment + right-to-left conversion (ar,he) slide Input i18n * Keyboard rebinding (bindtags) * East Asia: keyboard buffering + Menu selection for ambiguities + * Virtual keyboard (buttons, canvas) * String conversion: *lish family - {[ruslish Moskva]-[greeklish Aqh'nai]} slide i18n - Tcl for the world + + + Thank you.
Comments edit
See also: Canvas presentation graphics - A simple slideshowAnyone know what it would take to modify the above so that if the window is resized, the fonts used would get larger?16 Nov 2005 - it would take adding a <Configure> binding to the main window, and the use of font measure and a little math to determine the largest font that would still let everything fit on the page. A couple dozen lines of code perhaps.escargo 28 May 2003 - At first I didn't think this page was going to be reapable, until I took a closer look. My difficulty was due to my preliminary look missing the interp alias that's the core of processing your little language (which makes the data at the end really a part of the program). That's really clever.