OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 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. |
| 43 | dofile("plplot_examples.lua") |
| 44 | |
| 45 | red = { 240, 204, 204, 204, 0, 39, 125 } |
| 46 | green = { 240, 0, 125, 204, 204, 80, 0 } |
| 47 | blue = { 240, 0, 0, 0, 0, 204, 125 } |
| 48 | |
| 49 | px = { 0, 0, 1, 1 } |
| 50 | py = { 0, 0.25, 0.25, 0 } |
| 51 | |
| 52 | sx = { |
| 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 | |
| 67 | sy = { |
| 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 | |
| 85 | peace = { |
| 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 | |
| 112 | pl.parseopts(arg, pl.PL_PARSE_FULL) |
| 113 | |
| 114 | pl.init() |
| 115 | |
| 116 | pl.adv(0) |
| 117 | pl.vpor(0, 1, 0, 1) |
| 118 | pl.wind(0, 1, 0, 1) |
| 119 | pl.col0(0) |
| 120 | pl.box("", 1, 0, "", 1, 0) |
| 121 | |
| 122 | pl.scmap0n(7) |
| 123 | pl.scmap0(red, green, blue) |
| 124 | |
| 125 | pl.schr(0, 4) |
| 126 | pl.font(1) |
| 127 | |
| 128 | for 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 |
| 135 | end |
| 136 | |
| 137 | pl.col0(0) |
| 138 | for i = 1, 12 do |
| 139 | pl.ptex(sx[i], sy[i], 1, 0, 0.5, peace[i]) |
| 140 | end |
| 141 | |
| 142 | pl.plend() |
| 143 |
