gimpfonts_pdb.c 3 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
 * SECTION: gimpfonts
30 31 32 33 34 35 36
 * @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
gboolean
gimp_fonts_refresh (void)
{
51 52
  GimpValueArray *args;
  GimpValueArray *return_vals;
53 54
  gboolean success = TRUE;

55
  args = gimp_value_array_new_from_types (G_TYPE_NONE);
56

57 58 59
  return_vals = gimp_run_procedure_with_array ("gimp-fonts-refresh",
                                               args);
  gimp_value_array_unref (args);
60

61 62 63
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;

  gimp_value_array_unref (return_vals);
64 65 66 67 68 69

  return success;
}

/**
 * gimp_fonts_get_list:
70
 * @filter: An optional regular expression used to filter the list.
71 72 73 74 75 76 77
 * @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.
 *
Mukund Sivaraman's avatar
Mukund Sivaraman committed
78 79
 * Returns: The list of font names. The returned value must be freed
 * with g_strfreev().
80
 **/
81
gchar **
82
gimp_fonts_get_list (const gchar *filter,
83
                     gint        *num_fonts)
84
{
85 86
  GimpValueArray *args;
  GimpValueArray *return_vals;
87 88
  gchar **font_list = NULL;

89 90 91 92 93 94 95
  args = gimp_value_array_new_from_types (G_TYPE_STRING,
                                          G_TYPE_NONE);
  g_value_set_string (gimp_value_array_index (args, 0), filter);

  return_vals = gimp_run_procedure_with_array ("gimp-fonts-get-list",
                                               args);
  gimp_value_array_unref (args);
96 97 98

  *num_fonts = 0;

99
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
100
    {
101 102
      *num_fonts = g_value_get_int (gimp_value_array_index (return_vals, 1));
      font_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
103 104
    }

105
  gimp_value_array_unref (return_vals);
106 107 108

  return font_list;
}