Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

98 рядки
4.1 KiB

  1. /*
  2. * unicode libcaca Unicode rendering test program
  3. * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "config.h"
  14. #if defined(HAVE_INTTYPES_H)
  15. # include <inttypes.h>
  16. #else
  17. typedef unsigned char uint8_t;
  18. typedef unsigned short uint16_t;
  19. typedef unsigned int uint32_t;
  20. #endif
  21. #include "cucul.h"
  22. #include "caca.h"
  23. int main(void)
  24. {
  25. caca_event_t ev;
  26. cucul_t *qq;
  27. caca_t *kk;
  28. qq = cucul_create(0, 0);
  29. kk = caca_attach(qq);
  30. cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
  31. cucul_putstr(qq, 1, 1, "Basic Unicode support");
  32. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  33. cucul_putstr(qq, 1, 2, "This is ASCII: | abc DEF 123 !@# |");
  34. cucul_putstr(qq, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |");
  35. cucul_putstr(qq, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |");
  36. cucul_putstr(qq, 1, 5, "If the three lines do not have the same length, there is a bug somewhere.");
  37. cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
  38. cucul_putstr(qq, 1, 7, "Gradient glyphs");
  39. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  40. cucul_putstr(qq, 31, 8, " 0%");
  41. cucul_putstr(qq, 31, 9, " 25%");
  42. cucul_putstr(qq, 31, 10, " 50%");
  43. cucul_putstr(qq, 31, 11, " 75%");
  44. cucul_putstr(qq, 31, 12, "100%");
  45. cucul_set_color(qq, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_LIGHTGREEN);
  46. cucul_putstr(qq, 1, 8, " ");
  47. cucul_putstr(qq, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  48. cucul_putstr(qq, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  49. cucul_putstr(qq, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  50. cucul_putstr(qq, 1, 12, "█████████████████████████████");
  51. cucul_set_color(qq, CUCUL_COLOR_LIGHTGREEN, CUCUL_COLOR_LIGHTRED);
  52. cucul_putstr(qq, 36, 8, "█████████████████████████████");
  53. cucul_putstr(qq, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  54. cucul_putstr(qq, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  55. cucul_putstr(qq, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  56. cucul_putstr(qq, 36, 12, " ");
  57. cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
  58. cucul_putstr(qq, 1, 14, "Double width characters");
  59. cucul_set_color(qq, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK);
  60. cucul_putstr(qq, 1, 15, "| ドラゴン ボーレ |");
  61. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  62. cucul_putstr(qq, 1, 16, "| ()()()() ()()() |");
  63. cucul_set_color(qq, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
  64. cucul_putstr(qq, 1, 17, "| ドラゴン");
  65. cucul_putstr(qq, 10, 17, "ボーレ |");
  66. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  67. cucul_putstr(qq, 1, 18, "If the three lines do not have the same length, there is a bug somewhere.");
  68. cucul_putstr(qq, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼");
  69. cucul_putstr(qq, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■");
  70. cucul_putstr(qq, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟");
  71. caca_display(kk);
  72. caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, -1);
  73. caca_detach(kk);
  74. cucul_free(qq);
  75. return 0;
  76. }