g_havecap.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* This file is part of the GNU plotutils package. Copyright (C) 1995,
  2. 1996, 1997, 1998, 1999, 2000, 2005, 2008, Free Software Foundation, Inc.
  3. The GNU plotutils package is free software. You may redistribute it
  4. and/or modify it under the terms of the GNU General Public License as
  5. published by the Free Software foundation; either version 2, or (at your
  6. option) any later version.
  7. The GNU plotutils package is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. You should have received a copy of the GNU General Public License along
  12. with the GNU plotutils package; see the file COPYING. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
  14. Boston, MA 02110-1301, USA. */
  15. /* This file contains the havecap method, which is a GNU extension to
  16. libplot. It queries the current plotter to determine whether or not it
  17. has a specified capability, specified by a string.
  18. Return value is 0/1/2 (no/yes/maybe). If the capability is not
  19. recognized, the return value is 0. */
  20. #include "sys-defines.h"
  21. #include "extern.h"
  22. int
  23. _API_havecap (R___(Plotter *_plotter) const char *s)
  24. {
  25. if (strcasecmp (s, "WIDE_LINES") == 0)
  26. return _plotter->data->have_wide_lines;
  27. else if (strcasecmp (s, "SOLID_FILL") == 0)
  28. return _plotter->data->have_solid_fill;
  29. else if (strcasecmp (s, "DASH_ARRAY") == 0)
  30. return _plotter->data->have_dash_array;
  31. else if (strcasecmp (s, "EVEN_ODD_FILL") == 0)
  32. return _plotter->data->have_odd_winding_fill;
  33. else if (strcasecmp (s, "NONZERO_WINDING_NUMBER_FILL") == 0)
  34. return _plotter->data->have_nonzero_winding_fill;
  35. else if (strcasecmp (s, "SETTABLE_BACKGROUND") == 0)
  36. return _plotter->data->have_settable_bg;
  37. else if (strcasecmp (s, "HERSHEY_FONTS") == 0)
  38. return 1; /* always supported */
  39. else if (strcasecmp (s, "PS_FONTS") == 0)
  40. return _plotter->data->have_ps_fonts;
  41. else if (strcasecmp (s, "PCL_FONTS") == 0)
  42. return _plotter->data->have_pcl_fonts;
  43. else if (strcasecmp (s, "STICK_FONTS") == 0)
  44. return _plotter->data->have_stick_fonts;
  45. else if (strcasecmp (s, "EXTRA_STICK_FONTS") == 0)
  46. return _plotter->data->have_extra_stick_fonts;
  47. else
  48. return 0;
  49. }