2003-09-04 20:02:31 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpfonts_pdb.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2003-09-04 20:02:31 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2003-09-04 20:02:31 +08:00
|
|
|
*
|
|
|
|
* 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
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2003-09-04 20:02:31 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2003-09-04 20:02:31 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpfonts
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimpfonts
|
|
|
|
* @short_description: Operations related to fonts.
|
|
|
|
*
|
|
|
|
* Operations related to fonts.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2003-09-04 20:02:31 +08:00
|
|
|
/**
|
|
|
|
* gimp_fonts_refresh:
|
|
|
|
*
|
2003-12-08 19:58:45 +08:00
|
|
|
* Refresh current fonts. This function always succeeds.
|
2003-09-04 20:02:31 +08:00
|
|
|
*
|
|
|
|
* This procedure retrieves all fonts currently in the user's font path
|
2016-04-18 04:06:00 +08:00
|
|
|
* and updates the font dialogs accordingly. Depending on the amount of
|
|
|
|
* fonts on the system, this can take considerable time.
|
2003-09-04 20:02:31 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-09-04 20:02:31 +08:00
|
|
|
gboolean
|
|
|
|
gimp_fonts_refresh (void)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-09-04 20:02:31 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_NONE);
|
2003-09-04 20:02:31 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-fonts-refresh",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2003-09-04 20:02:31 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2003-09-04 20:02:31 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_fonts_get_list:
|
2003-09-05 01:04:36 +08:00
|
|
|
* @filter: An optional regular expression used to filter the list.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_fonts: (out): The number of available fonts.
|
2003-09-04 20:02:31 +08:00
|
|
|
*
|
|
|
|
* Retrieve the list of loaded fonts.
|
|
|
|
*
|
|
|
|
* This procedure returns a list of the fonts that are currently
|
|
|
|
* available.
|
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (array length=num_fonts) (element-type gchar*) (transfer full):
|
|
|
|
* The list of font names.
|
|
|
|
* The returned value must be freed with g_strfreev().
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-09-04 20:02:31 +08:00
|
|
|
gchar **
|
2003-09-05 01:04:36 +08:00
|
|
|
gimp_fonts_get_list (const gchar *filter,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *num_fonts)
|
2003-09-04 20:02:31 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-09-04 20:02:31 +08:00
|
|
|
gchar **font_list = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, filter,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-fonts-get-list",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2003-09-04 20:02:31 +08:00
|
|
|
|
|
|
|
*num_fonts = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2003-09-04 20:02:31 +08:00
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*num_fonts = GIMP_VALUES_GET_INT (return_vals, 1);
|
|
|
|
font_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
|
2003-09-04 20:02:31 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-09-04 20:02:31 +08:00
|
|
|
|
|
|
|
return font_list;
|
|
|
|
}
|