# PIKA - Photo and Image Kooker Application
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# "Perlized" from C source by Manish Singh
# The invoke code is compiled on the app side.
# The invoke code must assign to each result var
sub fonts_get_by_name {
$blurb = "Returns the fonts with the given name.";
$help = "Returns the fonts with the given name. There may be more than one.";
&jehan_pdb_misc('2023', '3.0');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The name of the font' }
);
@outargs = (
{ name => 'fonts', type => 'fontarray', non_empty => 0,
desc => 'The fonts with the given name',
array => { name => 'num_fonts',
desc => 'The number of fonts with the given name' } }
);
%invoke = (
code => <<'CODE'
{
GList *list;
list = pika_pdb_get_resources (pika, PIKA_TYPE_FONT, name, PIKA_PDB_DATA_ACCESS_READ, error);
if (list == NULL)
success = FALSE;
num_fonts = g_list_length (list);
if (num_fonts > 0)
{
gint i = 0;
fonts = g_new (PikaFont *, num_fonts);
for (GList *iter = list; i < num_fonts; i++, iter = g_list_next (iter))
fonts[i] = g_object_ref (iter->data);
}
g_list_free (list);
}
CODE
);
}
sub font_get_by_name {
$blurb = "Returns a font with the given name.";
$help = < 'name', type => 'string', non_empty => 1,
desc => 'The name of the font' }
);
@outargs = (
{ name => 'font', type => 'font', non_empty => 1,
desc => 'The font' }
);
%invoke = (
code => <<'CODE'
{
font = PIKA_FONT (pika_pdb_get_resource (pika, PIKA_TYPE_FONT, name, PIKA_PDB_DATA_ACCESS_READ, error));
if (! font)
success = FALSE;
}
CODE
);
}
@headers = qw("core/pika.h"
"pikapdb-utils.h");
@procs = qw(font_get_by_name fonts_get_by_name);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Font';
$doc_title = 'pikafont';
$doc_short_desc = 'Installable object used by text tools.';
$doc_long_desc = 'Installable object used by text tools.';
1;