%
% This file is a product of Sun Microsystems, Inc. and is provided for
% unrestricted use provided that this legend is included on all tape
% media and as a part of the software program in whole or part.  Users
% may copy or modify this file without charge, but are not authorized to
% license or distribute it to anyone else except as part of a product
% or program developed by the user.
% 
% THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% 
% This file is provided with no support and without any obligation on the
% part of Sun Microsystems, Inc. to assist in its use, correction,
% modification or enhancement.
% 
% SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE
% OR ANY PART THEREOF.
% 
% In no event will Sun Microsystems, Inc. be liable for any lost revenue
% or profits or other special, indirect and consequential damages, even
% if Sun has been advised of the possibility of such damages.
% 
% Sun Microsystems, Inc.
% 2550 Garcia Avenue
% Mountain View, California  94043
%
%
% @(#)languagedemo 23.2 90/06/19
%

%
%  LanguageDemo: Language pot-pourri.
%

/LanguageCanvas [ClassCanvas] dictbegin
    /Lang 0 def
dictend
classbegin

    /makeKstr {					% mark n n ... => string
	counttomark /n exch def n string dup    % mark n n n ... str
	n 1 sub -1 0 {                          % mark n n n ... str str i
	    3 index 128 add put exch pop dup    % mark n n ... str str
	} for
	pop exch pop
    } def

    /ChinesePara [
	(\272\307\275\351\315\255\300\273\270\300)
	()
    ] def
    /ChineseList [
	mark 49 81 74 56 makeKstr
	mark 67 102 74 56 makeKstr
	mark 75 33  74 56 makeKstr
	mark 70 65 74 56 makeKstr
	mark 70 124 74 56 makeKstr
	mark 48 85 66 103 77 120 74 56 makeKstr
	mark 64 62 72 73 38 88 74 56 makeKstr
    ] def
    
    /JapanesePara [
	mark 61 105  36 97  36 75  56 64  77 85  36 34  36 106  36 45  makeKstr
	()
    ] def
    /JapaneseList [
	mark 49 81  56 108 makeKstr
	mark 67 102 57 113 56 108 makeKstr
	mark 37 85 37 105 37 115 37 57 56 108 makeKstr
	mark 37 73 37 36 37 68 56 108 makeKstr
	mark 70 124 75 92 56 108 makeKstr
	mark 37 36 37 63 37 106 37 34 56 108 makeKstr
	mark 37 57 37 90 37 36 37 115 56 108 makeKstr
    ] def

    /EnglishPara [
	(In the beginning was the Word)
	()
    ] def
    /EnglishList [
	(English) (Chinese) (French) (German)
	(Japanese) (Italian) (Spanish)
    ] def

    /FrenchPara [
	(Au d\351but fut la parole)
	()
    ] def
    /FrenchList [
	(Anglais) (Chinois) (Fran\347ais) (Allemand)
	(Japonais) (Italien) (Espagnol)
    ] def

    /GermanPara [
	(Am anfang war das Wort)
	()
    ] def
    /GermanList [
	(Englisch) (Chinesisch) (Franz\366sisch) (Deutsch)
	(Japanisch) (Italienisch) (Spanisch)
    ] def

    /ItalianPara [
	(Al' inizi\363 c'era la parola)
	()
    ] def
    /ItalianList [
	(Inglese) (Cinese) (Francese) (Tedesco)
	(Giapponese) (Italiano) (Spagnolo)
    ] def

    /SpanishPara [
	(Al principio fu\351 la palabra)
	()
    ] def
    /SpanishList [
	(Ingl\351s) (Chino) (Franc\351s) (Alem\341n)
	(Japon\351s) (Italiano) (Espa\361ol)
    ] def

    /LangList [ EnglishList ChineseList FrenchList GermanList
	 	JapaneseList ItalianList SpanishList ] def

    /ParaList [ EnglishPara ChinesePara FrenchPara GermanPara
	 	JapanesePara ItalianPara SpanishPara ] def

    /FontList [ /Times-Roman-Latin-1 /Kanji /Times-Roman-Latin-1
		/Times-Roman-Latin-1
	 	/Kanji /Times-Roman-Latin-1 /Times-Roman-Latin-1 ] def

    /PaintCanvas {
	gsave
	    FontList Lang get findfont 24 scalefont setfont
	    FillColor fillcanvas
	    TextColor setcolor
	    /y Height def
	    {
		ParaList Lang get {
		    /y y currentfont fontheight sub def
		    5 y moveto show
		} forall
		y 0 le {exit} if
	    } loop
	grestore
    } def

    /SetLang { % n => - 
	/Lang exch def
	CanvasMenu /TextFamily FontList Lang get put
	LangList Lang get 0 1 2 index length 1 sub {
	    2 copy get /setgraphic CanvasMenu send
	} for pop
	/paint self send
    } def

    /preferredsize {
	/preferredsize super send
	140 max exch 320 max exch
    } def

    /newinit {
	/newinit super send

	/CreateMenu self send

FontDirectory /Times-Roman-Latin-1 known not {
     30 dict begin
     /Times-Roman findfont { def } forall
     /FontName /Times-Roman-Latin-1 def
     /Encoding { 
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/space /exclam   /quotedbl   /numbersign   /dollar  /percent  /ampersand
/quoteright /parenleft   /parenright  /asterisk   /plus  /comma  /hyphen
/period /slash  /zero /one  /two /three  /four /five  /six /seven /eight
/nine /colon /semicolon /less /equal /greater /question /at /A  /B /C /D
/E /F /G /H /I /J /K  /L /M  /N /O  /P /Q  /R /S  /T /U  /V /W  /X /Y /Z
/bracketleft /backslash     /bracketright    /asciicircum    /underscore
/quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o  /p /q  /r /s /t
/u /v  /w  /x  /y  /z  /braceleft /bar  /braceright /asciitilde /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef  /.notdef /.notdef /.notdef
/.notdef /exclamdown  /cent  /sterling /currency  /yen /.notdef /section
/.notdef /.notdef /ordfeminine /guillemotleft /.notdef /.notdef /.notdef
/.notdef /.notdef   /.notdef   /.notdef   /.notdef   /.notdef   /.notdef
/paragraph /bullet   /.notdef   /.notdef  /ordmasculine  /guillemotright
/.notdef /.notdef  /.notdef  /questiondown  /Agrave /Aacute /Acircumflex
/Atilde /Adieresis  /Aring  /AE  /Ccedilla  /Egrave /Eacute /Ecircumflex
/Edieresis /Igrave  /Iacute  /Icircumflex  /Idieresis  /.notdef  /Ntilde
/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /.notdef /Oslash /Ugrave
/Uacute /Ucircumflex  /Udieresis  /.notdef  /.notdef /germandbls /agrave
/aacute /acircumflex  /.notdef  /adieresis /aring  /ae /ccedilla /egrave
/eacute /ecircumflex /edieresis /igrave  /iacute /icircumflex /idieresis
/.notdef /ntilde   /ograve   /oacute   /ocircumflex  /otilde  /odieresis
/.notdef /oslash  /ugrave  /uacute  /ucircumflex  /udieresis  /ydieresis
/.notdef /Ydieresis
    } cvlit def
    FontName currentdict definefont pop
    end
} if

    } def

    /CreateMenu {
	/CanvasMenu EnglishList null {
	    /value self send
	    /SetLang /sendtarget 4 -1 roll send
	} framebuffer /newdefault ClassMenu send def
	true /setpinnable CanvasMenu send
    } def

classend def

/win [LanguageCanvas] []
framebuffer /newdefault ClassBaseFrame send def

null /seticonlabel win send
(Languages) /setlabel win send

/place win send
/map win send
/activate win send

newprocessgroup
currentfile closefile
