Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

unicode.c 4.1 KiB

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