Root/nanonote-example-files/example-files/data/Examples/lua-plplot-examples/x24.lua

Source at commit a08dac6 created 13 years 1 month ago.
By Xiangfu Liu, nanonote-example-files, install to data, prepare for add script-files
1--[[ $Id: x24.lua 9414 2009-01-29 22:48:54Z airwin $
2
3    Unicode Pace Flag
4
5  Copyright (C) 2008 Werner Smekal
6
7  This file is part of PLplot.
8
9  PLplot is free software you can redistribute it and/or modify
10  it under the terms of the GNU General Library Public License as published
11  by the Free Software Foundation either version 2 of the License, or
12  (at your option) any later version.
13
14  PLplot is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Library General Public License for more details.
18
19  You should have received a copy of the GNU Library General Public License
20  along with PLplot if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
23   In Debian, run like this:
24
25   ( TTFDIR=/usr/share/fonts/truetype \
26     PLPLOT_FREETYPE_SANS_FONT=$TTFDIR/arphic/bkai00mp.ttf \
27     PLPLOT_FREETYPE_SERIF_FONT=$TTFDIR/freefont/FreeSerif.ttf \
28     PLPLOT_FREETYPE_MONO_FONT=$TTFDIR/ttf-devanagari-fonts/lohit_hi.ttf \
29     PLPLOT_FREETYPE_SCRIPT_FONT=$TTFDIR/unfonts/UnBatang.ttf \
30     PLPLOT_FREETYPE_SYMBOL_FONT=$TTFDIR/ttf-bengali-fonts/JamrulNormal.ttf \
31     ./x24c -dev png -drvopt smooth=0 -o x24c.png )
32
33   Packages needed:
34
35   ttf-arphic-bkai00mp
36   ttf-freefont
37   ttf-devanagari-fonts
38   ttf-unfonts
39   ttf-bengali-fonts
40--]]
41
42-- initialise Lua bindings for PLplot examples.
43dofile("plplot_examples.lua")
44
45red = { 240, 204, 204, 204, 0, 39, 125 }
46green = { 240, 0, 125, 204, 204, 80, 0 }
47blue = { 240, 0, 0, 0, 0, 204, 125 }
48
49px = { 0, 0, 1, 1 }
50py = { 0, 0.25, 0.25, 0 }
51
52sx = {
53  0.16374,
54  0.15844,
55  0.15255,
56  0.17332,
57  0.50436,
58  0.51721,
59  0.49520,
60  0.48713,
61  0.83976,
62  0.81688,
63  0.82231,
64  0.82647
65}
66
67sy = {
68  0.125,
69  0.375,
70  0.625,
71  0.875,
72  0.125,
73  0.375,
74  0.625,
75  0.875,
76  0.125,
77  0.375,
78  0.625,
79  0.875
80}
81
82
83-- Taken from http://www.columbia.edu/~fdc/pace/
84
85peace = {
86  -- Mandarin
87  "#<0x00>和平",
88  -- Hindi
89  "#<0x20>शांति",
90  -- English
91  "#<0x10>Peace",
92  -- Hebrew
93  "#<0x10>שלום",
94  -- Russian
95  "#<0x10>Мир",
96  -- German
97  "#<0x10>Friede",
98  -- Korean
99  "#<0x30>평화",
100  -- French
101  "#<0x10>Paix",
102  -- Spanish
103  "#<0x10>Paz",
104  -- Arabic
105  "#<0x10>ﺳﻼم",
106  -- Turkish
107  "#<0x10>Barış",
108  -- Kurdish
109  "#<0x10>Hasîtî",
110}
111
112pl.parseopts(arg, pl.PL_PARSE_FULL)
113
114pl.init()
115
116pl.adv(0)
117pl.vpor(0, 1, 0, 1)
118pl.wind(0, 1, 0, 1)
119pl.col0(0)
120pl.box("", 1, 0, "", 1, 0)
121
122pl.scmap0n(7)
123pl.scmap0(red, green, blue)
124
125pl.schr(0, 4)
126pl.font(1)
127
128for i = 1, 4 do
129  pl.col0(i)
130  pl.fill(px, py)
131
132  for j = 1, 4 do
133    py[j] = py[j] + 1/4
134  end
135end
136
137pl.col0(0)
138for i = 1, 12 do
139  pl.ptex(sx[i], sy[i], 1, 0, 0.5, peace[i])
140end
141
142pl.plend()
143

Archive Download this file



interactive