1## Displays Greek letters and mathematically interesting Unicode ranges 2## Copyright (C) 2005 Alan Irwin 3## Copyright (C) 2005 Andrew Ross 4## 5## 6## This file is part of PLplot. 7## 8## PLplot is free software; you can redistribute it and/or modify 9## it under the terms of the GNU Library General Public License as published 10## by the Free Software Foundation; either version 2 of the License, or 11## (at your option) any later version. 12## 13## PLplot is distributed in the hope that it will be useful, 14## but WITHOUT ANY WARRANTY; without even the implied warranty of 15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16## GNU Library General Public License for more details. 17## 18## You should have received a copy of the GNU Library General Public License 19## along with PLplot; if not, write to the Free Software 20## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21## 22 231; 24 25## Displays Greek letters and mathematically interesting Unicode ranges 26 27function ix23c(strm) 28 29 # Redirect output to file if required 30 if (nargin == 0) 31 strm = stdout; 32 endif 33 34 35 Greek = [... 36"#gA";"#gB";"#gG";"#gD";"#gE";"#gZ";"#gY";"#gH";"#gI";"#gK";"#gL";"#gM"; 37"#gN";"#gC";"#gO";"#gP";"#gR";"#gS";"#gT";"#gU";"#gF";"#gX";"#gQ";"#gW"; 38"#ga";"#gb";"#gg";"#gd";"#ge";"#gz";"#gy";"#gh";"#gi";"#gk";"#gl";"#gm"; 39"#gn";"#gc";"#go";"#gp";"#gr";"#gs";"#gt";"#gu";"#gf";"#gx";"#gq";"#gw"; 40 ]; 41 42 Type1 = [... 430x0020,0x0021,0x0023,0x0025,0x0026,... 440x0028,0x0029,0x002b,0x002c,0x002e,... 450x002f,0x0030,0x0031,0x0032,0x0033,... 460x0034,0x0035,0x0036,0x0037,0x0038,... 470x0039,0x003a,0x003b,0x003c,0x003d,... 480x003e,0x003f,0x005b,0x005d,0x005f,... 490x007b,0x007c,0x007d,0x00a9,0x00ac,... 500x00ae,0x00b0,0x00b1,0x00d7,0x00f7,... 510x0192,0x0391,0x0392,0x0393,0x0394,... 520x0395,0x0396,0x0397,0x0398,0x0399,... 530x039a,0x039b,0x039c,0x039d,0x039e,... 540x039f,0x03a0,0x03a1,0x03a3,0x03a4,... 550x03a5,0x03a6,0x03a7,0x03a8,0x03a9,... 560x03b1,0x03b2,0x03b3,0x03b4,0x03b5,... 570x03b6,0x03b7,0x03b8,0x03b9,0x03ba,... 580x03bb,0x03bc,0x03bd,0x03be,0x03bf,... 590x03c0,0x03c1,0x03c2,0x03c3,0x03c4,... 600x03c5,0x03c6,0x03c7,0x03c8,0x03c9,... 610x03d1,0x03d2,0x03d5,0x03d6,0x2022,... 620x2026,0x2032,0x2033,0x203e,0x2044,... 630x2111,0x2118,0x211c,0x2122,0x2126,... 640x2135,0x2190,0x2191,0x2192,0x2193,... 650x2194,0x21b5,0x21d0,0x21d1,0x21d2,... 660x21d3,0x21d4,0x2200,0x2202,0x2203,... 670x2205,0x2206,0x2207,0x2208,0x2209,... 680x220b,0x220f,0x2211,0x2212,0x2215,... 690x2217,0x221a,0x221d,0x221e,0x2220,... 700x2227,0x2228,0x2229,0x222a,0x222b,... 710x2234,0x223c,0x2245,0x2248,0x2260,... 720x2261,0x2264,0x2265,0x2282,0x2283,... 730x2284,0x2286,0x2287,0x2295,0x2297,... 740x22a5,0x22c5,0x2320,0x2321,0x2329,... 750x232a,0x25ca,0x2660,0x2663,0x2665,... 760x2666,... 77]; 78 79 title = { 80"#<0x10>PLplot Example 23 - Greek Letters"; 81"#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)"; 82"#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)"; 83"#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)"; 84"#<0x10>PLplot Example 23 - Number Forms Unicode Block"; 85"#<0x10>PLplot Example 23 - Arrows Unicode Block (a)"; 86"#<0x10>PLplot Example 23 - Arrows Unicode Block (b)"; 87"#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)"; 88"#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)"; 89"#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)"; 90"#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)" 91}; 92 93 lo = [ 940x0, 950x0, 960x40, 970x80, 980x2153, 990x2190, 1000x21d0, 1010x2200, 1020x2240, 1030x2280, 1040x22c0, 105]; 106 107 hi = [ 1080x30, 1090x40, 1100x80, 1110xA6, 1120x2184, 1130x21d0, 1140x2200, 1150x2240, 1160x2280, 1170x22c0, 1180x2300, 119]; 120 121 nxcells = [ 12212, 1238, 1248, 1258, 1268, 1278, 1288, 1298, 1308, 1318, 1328, 133]; 134 135nycells = [ 1368, 1378, 1388, 1398, 1408, 1418, 1428, 1438, 1448, 1458, 1468, 147]; 148 149## non-zero values Must be consistent with nxcells and nycells. 150offset = [ 1510, 1520, 15364, 154128, 1550, 1560, 1570, 1580, 1590, 1600, 1610, 162]; 163 164## 30 possible FCI values. 165FCI_COMBINATIONS = 30; 166 167fci = [ 1680x80000000, 1690x80000001, 1700x80000002, 1710x80000003, 1720x80000004, 1730x80000010, 1740x80000011, 1750x80000012, 1760x80000013, 1770x80000014, 1780x80000020, 1790x80000021, 1800x80000022, 1810x80000023, 1820x80000024, 1830x80000100, 1840x80000101, 1850x80000102, 1860x80000103, 1870x80000104, 1880x80000110, 1890x80000111, 1900x80000112, 1910x80000113, 1920x80000114, 1930x80000120, 1940x80000121, 1950x80000122, 1960x80000123, 1970x80000124, 198]; 199 200family = [ 201 "sans-serif"; 202 "serif"; 203 "monospace"; 204 "script"; 205 "symbol" 206]; 207style = [ 208 "upright"; 209 "italic"; 210 "oblique" 211]; 212weight = [ 213 "medium"; 214 "bold" 215]; 216 217 218## plparseopts(&argc, argv, PL_PARSE_FULL); 219 220plinit; 221 222for page=1:11 223 224 pladv(0); 225 226 ## Set up viewport and window 227 228 plvpor(0.02, 0.98, 0.02, 0.90); 229 plwind(0.0, 1.0, 0.0, 1.0); 230 [xmin, xmax, ymin, ymax] = plgspa; 231 plschr(0., 0.8); 232 ycharacter_scale = (1.0 - 0.0)/(ymax-ymin); 233 234 ## Factor should be 0.5, but heuristically it turns out to be larger. 235 [chardef, charht] = plgchr; 236 yoffset = 1.0*charht*ycharacter_scale; 237 238 ## Draw the grid using plbox 239 240 plcol0(2); 241 242 deltax = 1.0/nxcells(page); 243 deltay = 1.0/nycells(page); 244 plbox("bcg", deltax, 0, "bcg", deltay, 0); 245 plcol0(15); 246 length=hi(page)-lo(page); 247 slice = 0; 248 for j=nycells(page)-1:-1:0; 249 y = (0.5+j)*deltay; 250 for i=0:nxcells(page)-1; 251 x = (0.5+i)*deltax; 252 if (slice < length) 253 if (page == 1) 254 cmdString = sprintf("#%s",Greek(slice+1,:)); 255 elseif ((page >= 2) && (page <= 4)) 256 cmdString = sprintf("##[0x%.4x]",Type1(offset(page)+slice+1)); 257 elseif (page >= 5) 258 cmdString = sprintf("##[0x%.4x]",lo(page)+slice); 259 end 260 strlen = size(cmdString)(2); 261 plptex(x,y+yoffset,1.,0.,0.5, cmdString(2:strlen)); 262 plptex(x,y-yoffset,1.,0.,0.5, cmdString); 263 end 264 slice += 1; 265 end 266 end 267 268 plschr(0., 1.0); 269 ## Page title 270 plmtex("t", 1.5, 0.5, 0.5, title(page,:)); 271 272end 273 274## Demonstrate methods of getting the current fonts 275fci_old = plgfci(); 276[ifamily,istyle,iweight] = plgfont(); 277fprintf(strm,"For example 23 prior to page 12 the FCI is 0x%x\n",fci_old); 278fprintf(strm,"For example 23 prior to page 12 the font family, style and weight are %s %s %s\n",deblank(family(ifamily+1,:)), deblank(style(istyle+1,:)), deblank(weight(iweight+1,:))); 279 280for page=11:15 281 dy = 0.030; 282 283 pladv(0); 284 plvpor(0.02, 0.98, 0.02, 0.90); 285 plwind(0.0, 1.0, 0.0, 1.0); 286 plsfci(0); 287 if (page == 11) 288 plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with plsfci"); 289 elseif (page == 12) 290 plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with plsfont"); 291 elseif (page == 13) 292 plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct"); 293 elseif(page == 14) 294 plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs"); 295 elseif(page == 15) 296 plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ##<FCI COMMAND STRING/> constructs"); 297 endif 298 plschr(0., 0.75); 299 for i = 0:FCI_COMBINATIONS-1 300 family_index = mod(i,5); 301 style_index = mod(floor(i/5),3); 302 weight_index = mod(floor((i/5)/3),2); 303 if(page == 11) 304 plsfci(fci(i+1)); 305 string = sprintf("Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:))); 306 elseif(page == 12) 307 plsfont(family_index, style_index, weight_index); 308 string = sprintf("Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:))); 309 elseif(page == 13) 310 string = sprintf("Page 14, %s, %s, %s: #<0x%x>The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:)),fci(i+1)); 311 elseif(page == 14) 312 string = sprintf("Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:)),family_index,style_index,weight_index); 313 elseif(page == 15) 314 string = sprintf("Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:)),deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:))); 315 endif 316 plptex (0., 1. - (i+0.5)*dy, 1., 0., 0., string); 317 endfor 318 plschr(0., 1.0); 319endfor 320 321## Restore defaults 322plcol0(1); 323 324plend1; 325 326end 327 328if (exist("strm","var")) 329 ix23c(strm); 330else 331 ix23c(); 332endif 333 334