Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

unicode.php 4.5 KiB

16 anos atrás
16 anos atrás
16 anos atrás
16 anos atrás
16 anos atrás
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. header('Content-Type: text/html; charset=UTF-8');
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  7. <?php
  8. /*
  9. * unicode libcaca Unicode rendering test program
  10. * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>
  11. *
  12. * This file is a Php port of "examples/unicode.c"
  13. * which is:
  14. * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
  15. * All Rights Reserved
  16. *
  17. * This program is free software. It comes without any warranty, to
  18. * the extent permitted by applicable law. You can redistribute it
  19. * and/or modify it under the terms of the Do What the Fuck You Want
  20. * to Public License, Version 2, as published by Sam Hocevar. See
  21. * http://www.wtfpl.net/ for more details.
  22. */
  23. ?>
  24. <head>
  25. <title>libcaca Unicode rendering test program</title>
  26. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  27. </head>
  28. <body text="silver" bgcolor="black">
  29. <?php
  30. $cv = caca_create_canvas(80, 25);
  31. if(! $cv)
  32. {
  33. die("Can't created canvas\n");
  34. }
  35. caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
  36. caca_put_str($cv, 1, 1, "Basic Unicode support");
  37. caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
  38. caca_put_str($cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |");
  39. caca_put_str($cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |");
  40. caca_put_str($cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |");
  41. caca_put_str($cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere.");
  42. caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
  43. caca_put_str($cv, 1, 7, "Gradient glyphs");
  44. caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
  45. caca_put_str($cv, 31, 8, " 0%");
  46. caca_put_str($cv, 31, 9, " 25%");
  47. caca_put_str($cv, 31, 10, " 50%");
  48. caca_put_str($cv, 31, 11, " 75%");
  49. caca_put_str($cv, 31, 12, "100%");
  50. caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_LIGHTGREEN);
  51. caca_put_str($cv, 1, 8, " ");
  52. caca_put_str($cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  53. caca_put_str($cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  54. caca_put_str($cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  55. caca_put_str($cv, 1, 12, "█████████████████████████████");
  56. caca_set_color_ansi($cv, CACA_LIGHTGREEN, CACA_LIGHTRED);
  57. caca_put_str($cv, 36, 8, "█████████████████████████████");
  58. caca_put_str($cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  59. caca_put_str($cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  60. caca_put_str($cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  61. caca_put_str($cv, 36, 12, " ");
  62. caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
  63. caca_put_str($cv, 1, 14, "Double width characters");
  64. caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_TRANSPARENT);
  65. caca_put_str($cv, 1, 15, "| ドラゴン ボーレ |");
  66. caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
  67. caca_put_str($cv, 1, 16, "| ()()()() ()()() |");
  68. caca_set_color_ansi($cv, CACA_YELLOW, CACA_TRANSPARENT);
  69. caca_put_str($cv, 1, 17, "| ドラゴン");
  70. caca_put_str($cv, 12, 17, "ボーレ |");
  71. caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT);
  72. caca_put_str($cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere.");
  73. caca_put_str($cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼");
  74. caca_put_str($cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■");
  75. caca_put_str($cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟ ─ │ ┌ ┐ └ ┘ ├ ┤");
  76. caca_put_str($cv, 1, 23, "more drawing: ┬ ┴ ┼ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬");
  77. caca_put_str($cv, 1, 24, "misc Unicode: ● ☭ ☮ ☯ ♔ ♛ ♙ ♞ ⚒ ⚓ ⚠");
  78. echo caca_export_string($cv, "html3");
  79. ?>
  80. </body>
  81. </html>