gimpfonts_pdb.c 2.9 KB
Newer Older
1 2 3 4 5
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimpfonts_pdb.c
 *
6
 * This library is free software: you can redistribute it and/or
7 8
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
9
 * version 3 of the License, or (at your option) any later version.
10 11 12 13 14 15 16
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library.  If not, see
18
 * <https://www.gnu.org/licenses/>.
19 20
 */

21
/* NOTE: This file is auto-generated by pdbgen.pl */
22 23 24 25 26

#include "config.h"

#include "gimp.h"

27 28 29 30 31 32 33 34 35 36

/**
 * SECTION: gimpfonts
 * @title: gimpfonts
 * @short_description: Operations related to fonts.
 *
 * Operations related to fonts.
 **/


37 38 39
/**
 * gimp_fonts_refresh:
 *
40
 * Refresh current fonts. This function always succeeds.
41 42
 *
 * This procedure retrieves all fonts currently in the user's font path
43 44
 * and updates the font dialogs accordingly. Depending on the amount of
 * fonts on the system, this can take considerable time.
45 46
 *
 * Returns: TRUE on success.
47
 **/
48 49 50 51 52 53 54
gboolean
gimp_fonts_refresh (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

55
  return_vals = gimp_run_procedure ("gimp-fonts-refresh",
56 57
                                    &nreturn_vals,
                                    GIMP_PDB_END);
58 59 60 61 62 63 64 65 66 67

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_fonts_get_list:
68
 * @filter: An optional regular expression used to filter the list.
69 70 71 72 73 74 75
 * @num_fonts: The number of available fonts.
 *
 * Retrieve the list of loaded fonts.
 *
 * This procedure returns a list of the fonts that are currently
 * available.
 *
76 77
 * Returns: The list of font names. The returned value must be freed
 * with g_strfreev().
78
 **/
79
gchar **
80
gimp_fonts_get_list (const gchar *filter,
81
                     gint        *num_fonts)
82 83 84 85 86 87
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar **font_list = NULL;
  gint i;

88
  return_vals = gimp_run_procedure ("gimp-fonts-get-list",
89 90 91
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, filter,
                                    GIMP_PDB_END);
92 93 94 95 96 97

  *num_fonts = 0;

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    {
      *num_fonts = return_vals[1].data.d_int32;
98 99 100 101 102 103
      if (*num_fonts > 0)
        {
          font_list = g_new0 (gchar *, *num_fonts + 1);
          for (i = 0; i < *num_fonts; i++)
            font_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
        }
104 105 106 107 108 109
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return font_list;
}