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.
 
 
 
 
 
 

97 lines
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. #include "common.h"
  15. #if !defined(__KERNEL__)
  16. # if defined(HAVE_INTTYPES_H)
  17. # include <inttypes.h>
  18. # endif
  19. # include <stdio.h>
  20. #endif
  21. #include "cucul.h"
  22. #include "caca.h"
  23. int main(int argc, char *argv[])
  24. {
  25. cucul_canvas_t *cv;
  26. caca_display_t *dp;
  27. cv = cucul_create_canvas(0, 0);
  28. dp = caca_create_display(cv);
  29. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
  30. cucul_put_str(cv, 1, 1, "Basic Unicode support");
  31. cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);
  32. cucul_put_str(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |");
  33. cucul_put_str(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |");
  34. cucul_put_str(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |");
  35. cucul_put_str(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere.");
  36. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
  37. cucul_put_str(cv, 1, 7, "Gradient glyphs");
  38. cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);
  39. cucul_put_str(cv, 31, 8, " 0%");
  40. cucul_put_str(cv, 31, 9, " 25%");
  41. cucul_put_str(cv, 31, 10, " 50%");
  42. cucul_put_str(cv, 31, 11, " 75%");
  43. cucul_put_str(cv, 31, 12, "100%");
  44. cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_LIGHTGREEN);
  45. cucul_put_str(cv, 1, 8, " ");
  46. cucul_put_str(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  47. cucul_put_str(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  48. cucul_put_str(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  49. cucul_put_str(cv, 1, 12, "█████████████████████████████");
  50. cucul_set_color_ansi(cv, CUCUL_LIGHTGREEN, CUCUL_LIGHTRED);
  51. cucul_put_str(cv, 36, 8, "█████████████████████████████");
  52. cucul_put_str(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  53. cucul_put_str(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  54. cucul_put_str(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  55. cucul_put_str(cv, 36, 12, " ");
  56. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
  57. cucul_put_str(cv, 1, 14, "Double width characters");
  58. cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_TRANSPARENT);
  59. cucul_put_str(cv, 1, 15, "| ドラゴン ボーレ |");
  60. cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);
  61. cucul_put_str(cv, 1, 16, "| ()()()() ()()() |");
  62. cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_TRANSPARENT);
  63. cucul_put_str(cv, 1, 17, "| ドラゴン");
  64. cucul_put_str(cv, 12, 17, "ボーレ |");
  65. cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);
  66. cucul_put_str(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere.");
  67. cucul_put_str(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼");
  68. cucul_put_str(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■");
  69. cucul_put_str(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟");
  70. caca_refresh_display(dp);
  71. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  72. caca_free_display(dp);
  73. cucul_free_canvas(cv);
  74. return 0;
  75. }