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.

figfont.c 1.3 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * figfont libcucul FIGfont test program
  3. * Copyright (c) 2007 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. #include "config.h"
  15. #include "common.h"
  16. #if !defined(__KERNEL__)
  17. # include <stdio.h>
  18. # include <stdlib.h>
  19. #endif
  20. #include "cucul.h"
  21. int main(int argc, char *argv[])
  22. {
  23. cucul_canvas_t *cv;
  24. void *buffer;
  25. unsigned long int len;
  26. uint8_t color = 0;
  27. if(argc < 3)
  28. {
  29. fprintf(stderr, "Too few arguments\n");
  30. return -1;
  31. }
  32. cv = cucul_create_canvas(0, 0);
  33. if(cucul_canvas_set_figfont(cv, argv[1]))
  34. {
  35. fprintf(stderr, "Could not open font\n");
  36. return -1;
  37. }
  38. while(argv[2][0])
  39. {
  40. cucul_set_color_ansi(cv, 1 + ((color += 4) % 15), CUCUL_TRANSPARENT);
  41. cucul_put_figchar(cv, argv[2]++[0]);
  42. }
  43. buffer = cucul_export_memory(cv, "utf8", &len);
  44. fwrite(buffer, len, 1, stdout);
  45. free(buffer);
  46. cucul_free_canvas(cv);
  47. return 0;
  48. }