gimpfonts_pdb.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* LIBGIMP - The GIMP Library
  2. * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
  3. *
  4. * gimpfonts_pdb.c
  5. *
  6. * This library is free software: you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library. If not, see
  18. * <http://www.gnu.org/licenses/>.
  19. */
  20. /* NOTE: This file is auto-generated by pdbgen.pl */
  21. #include "config.h"
  22. #include "gimp.h"
  23. /**
  24. * SECTION: gimpfonts
  25. * @title: gimpfonts
  26. * @short_description: Operations related to fonts.
  27. *
  28. * Operations related to fonts.
  29. **/
  30. /**
  31. * gimp_fonts_refresh:
  32. *
  33. * Refresh current fonts. This function always succeeds.
  34. *
  35. * This procedure retrieves all fonts currently in the user's font path
  36. * and updates the font dialogs accordingly.
  37. *
  38. * Returns: TRUE on success.
  39. **/
  40. gboolean
  41. gimp_fonts_refresh (void)
  42. {
  43. GimpParam *return_vals;
  44. gint nreturn_vals;
  45. gboolean success = TRUE;
  46. return_vals = gimp_run_procedure ("gimp-fonts-refresh",
  47. &nreturn_vals,
  48. GIMP_PDB_END);
  49. success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  50. gimp_destroy_params (return_vals, nreturn_vals);
  51. return success;
  52. }
  53. /**
  54. * gimp_fonts_get_list:
  55. * @filter: An optional regular expression used to filter the list.
  56. * @num_fonts: The number of available fonts.
  57. *
  58. * Retrieve the list of loaded fonts.
  59. *
  60. * This procedure returns a list of the fonts that are currently
  61. * available.
  62. *
  63. * Returns: The list of font names.
  64. **/
  65. gchar **
  66. gimp_fonts_get_list (const gchar *filter,
  67. gint *num_fonts)
  68. {
  69. GimpParam *return_vals;
  70. gint nreturn_vals;
  71. gchar **font_list = NULL;
  72. gint i;
  73. return_vals = gimp_run_procedure ("gimp-fonts-get-list",
  74. &nreturn_vals,
  75. GIMP_PDB_STRING, filter,
  76. GIMP_PDB_END);
  77. *num_fonts = 0;
  78. if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  79. {
  80. *num_fonts = return_vals[1].data.d_int32;
  81. font_list = g_new (gchar *, *num_fonts);
  82. for (i = 0; i < *num_fonts; i++)
  83. font_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
  84. }
  85. gimp_destroy_params (return_vals, nreturn_vals);
  86. return font_list;
  87. }