PageRenderTime 8ms CodeModel.GetById 5ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/vision/basic_examples/basic_unicode.e

http://github.com/tybor/Liberty
Specman e | 62 lines | 32 code | 9 blank | 21 comment | 2 complexity | a1387e37a3e94236c741bade247e08e0 MD5 | raw file
 1class BASIC_UNICODE
 2-- This file is writen in utf8 format. If you read it using utf8 mode
 3-- and good unicode font, you'll see euro symbol. If not, you may see
 4-- three characters instead.
 5--
 6-- If you use linux, try "cat basic_unicode.e". If euro symbol is not
 7-- displayed then try: LC_CTYPE=en_GB.UTF-8 xterm -fn '-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1'&
 8-- If you didn't have this font, look for some font matching '-*-*-*-*-*-*-*-*-*-*-m-*-iso10646-1' or '-*-*-*-*-*-*-*-*-*-*-c-*-iso10646-1'. Use xfontsel
 9-- or xlsfonts -fn '-*-*-*-*-*-*-*-*-*-*-m(or c)-*-iso10646-1'. If you find
10-- none then you need to install unicode fonts (iso10646).
11--
12-- If you are using windows, look for an unicode capable editor 
13-- (Microsoft Word is known to be able to read UTF-8 encoded files)
14-- Many unicode editors are available on the web.
15--
16-- More information is available at:
17-- http://www.unicode.org/
18-- http://www.unicode.org/charts/
19-- http://www.unicode.org/onlinedat/products.html
20
21inherit GRAPHIC
22
23create
24   make
25
26feature {}
27
28   toplevel_window: TOPLEVEL_WINDOW
29
30   make is
31      local
32	 label_1, label_2, label_3, label_4: LABEL
33	 s: UNICODE_STRING
34      do
35	 create s.make(0)
36	 -- utf8 sequence decoding (when read from file for example)
37	 if s.utf8_decode_from("Currency sign for the European monetary: â‚?") then
38	    create toplevel_window.default_create
39	    toplevel_window.set_title("Unicode demo")
40	    toplevel_window.set_background_color(white_color)
41	    toplevel_window.map
42	    create label_1.make(s)
43	    toplevel_window.child_attach(label_1)
44
45	    -- unicode manifest string (in utf8 format)
46	    create label_2.make(U"Latin capital letter A, combining ring above: A%/204/%/138/")
47	    toplevel_window.child_attach(label_2)
48
49	    create label_3.make(U"Angstrom sign: â„?")
50	    toplevel_window.child_attach(label_3)
51
52	    -- unicode manifest string with unicode character number (hexa)
53	    create label_4.make(U"Surface integral symbol: %/Ux222F/")
54	    toplevel_window.child_attach(label_4)
55
56	    toplevel_window.when_close_requested(agent vision.loop_stack.break)
57	    vision.start
58	 else
59	    io.put_string("Error%N")
60	 end
61      end
62end