You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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