added a utf8 option for string input parameters, and validate them.

2003-07-29  Manish Singh  <yosh@gimp.org>

        * tools/pdbgen/app.pl: added a utf8 option for string input
        parameters, and validate them.

        * tools/pdbgen/pdb/text_tool.pdb: make the text parameter use it.
        Partially addresses #79897. Also remove references to XLFD in the
        doc text.

        * app/pdb/text_tool_cmds.c: regenerated

        * configure.in: Really bump the version number
This commit is contained in:
Manish Singh 2003-07-30 00:43:56 +00:00 committed by Manish Singh
parent f716f07e2f
commit 440c717948
5 changed files with 57 additions and 28 deletions

View file

@ -1,3 +1,16 @@
2003-07-29 Manish Singh <yosh@gimp.org>
* tools/pdbgen/app.pl: added a utf8 option for string input
parameters, and validate them.
* tools/pdbgen/pdb/text_tool.pdb: make the text parameter use it.
Partially addresses #79897. Also remove references to XLFD in the
doc text.
* app/pdb/text_tool_cmds.c: regenerated
* configure.in: Really bump the version number
2003-07-29 Dave Neary <bolsh@gimp.org>
* plug-ins/common/edge.c: Added several new edge detection

View file

@ -81,7 +81,7 @@ text_fontname_invoker (Gimp *gimp,
y = args[3].value.pdb_float;
text = (gchar *) args[4].value.pdb_pointer;
if (text == NULL)
if (text == NULL && !g_utf8_validate (text, -1, NULL))
success = FALSE;
border = args[5].value.pdb_int;
@ -172,7 +172,7 @@ static ProcArg text_fontname_inargs[] =
{
GIMP_PDB_STRING,
"fontname",
"The fontname (conforming to the X Logical Font Description Conventions)"
"The name of the font"
}
};
@ -218,7 +218,7 @@ text_get_extents_fontname_invoker (Gimp *gimp,
gchar *real_fontname;
text = (gchar *) args[0].value.pdb_pointer;
if (text == NULL)
if (text == NULL && !g_utf8_validate (text, -1, NULL))
success = FALSE;
size = args[1].value.pdb_float;
@ -277,7 +277,7 @@ static ProcArg text_get_extents_fontname_inargs[] =
{
GIMP_PDB_STRING,
"fontname",
"The fontname (conforming to the X Logical Font Description Conventions)"
"The name of the font"
}
};
@ -358,7 +358,7 @@ text_invoker (Gimp *gimp,
y = args[3].value.pdb_float;
text = (gchar *) args[4].value.pdb_pointer;
if (text == NULL)
if (text == NULL && !g_utf8_validate (text, -1, NULL))
success = FALSE;
border = args[5].value.pdb_int;
@ -477,42 +477,42 @@ static ProcArg text_inargs[] =
{
GIMP_PDB_STRING,
"foundry",
"The font foundry, \"*\" for any"
"The font foundry"
},
{
GIMP_PDB_STRING,
"family",
"The font family, \"*\" for any"
"The font family"
},
{
GIMP_PDB_STRING,
"weight",
"The font weight, \"*\" for any"
"The font weight"
},
{
GIMP_PDB_STRING,
"slant",
"The font slant, \"*\" for any"
"The font slant"
},
{
GIMP_PDB_STRING,
"set_width",
"The font set-width, \"*\" for any"
"The font set-width"
},
{
GIMP_PDB_STRING,
"spacing",
"The font spacing, \"*\" for any"
"The font spacing"
},
{
GIMP_PDB_STRING,
"registry",
"The font registry, \"*\" for any"
"The font registry"
},
{
GIMP_PDB_STRING,
"encoding",
"The font encoding, \"*\" for any"
"The font encoding"
}
};
@ -566,7 +566,7 @@ text_get_extents_invoker (Gimp *gimp,
gchar *real_fontname;
text = (gchar *) args[0].value.pdb_pointer;
if (text == NULL)
if (text == NULL && !g_utf8_validate (text, -1, NULL))
success = FALSE;
size = args[1].value.pdb_float;
@ -653,42 +653,42 @@ static ProcArg text_get_extents_inargs[] =
{
GIMP_PDB_STRING,
"foundry",
"The font foundry, \"*\" for any"
"The font foundry"
},
{
GIMP_PDB_STRING,
"family",
"The font family, \"*\" for any"
"The font family"
},
{
GIMP_PDB_STRING,
"weight",
"The font weight, \"*\" for any"
"The font weight"
},
{
GIMP_PDB_STRING,
"slant",
"The font slant, \"*\" for any"
"The font slant"
},
{
GIMP_PDB_STRING,
"set_width",
"The font set-width, \"*\" for any"
"The font set-width"
},
{
GIMP_PDB_STRING,
"spacing",
"The font spacing, \"*\" for any"
"The font spacing"
},
{
GIMP_PDB_STRING,
"registry",
"The font registry, \"*\" for any"
"The font registry"
},
{
GIMP_PDB_STRING,
"encoding",
"The font encoding, \"*\" for any"
"The font encoding"
}
};

View file

@ -32,7 +32,7 @@ GIMPPRINT_REQUIRED_VERSION=4.2.0
#
GIMP_MAJOR_VERSION=1
GIMP_MINOR_VERSION=3
GIMP_MICRO_VERSION=17
GIMP_MICRO_VERSION=18
GIMP_INTERFACE_AGE=0
GIMP_BINARY_AGE=0
GIMP_VERSION=$GIMP_MAJOR_VERSION.$GIMP_MINOR_VERSION.$GIMP_MICRO_VERSION

View file

@ -253,7 +253,23 @@ sub marshal_inargs {
$result .= ' ? TRUE : FALSE' if $pdbtype eq 'boolean';
$result .= ";\n";
if ($pdbtype eq 'string' || $pdbtype eq 'parasite') {
if ($pdbtype eq 'string') {
my ($reverse, $test);
if ($_->{utf8}) {
$reverse = sub { ${$_[0]} =~ s/!//;
${$_[0]} =~ s/==/!=/ };
$test = "$var == NULL && " .
"!g_utf8_validate ($var, -1, NULL)"
}
else {
$reverse = sub { ${$_[0]} =~ s/==/!=/ };
$test = "$var == NULL";
}
$result .= &make_arg_test($_, $reverse, $test);
}
elsif ($pdbtype eq 'parasite') {
$result .= &make_arg_test($_, sub { ${$_[0]} =~ s/==/!=/ },
"$var == NULL");
}

View file

@ -28,14 +28,14 @@ sub pdb_misc {
sub text_arg () {{
name => 'text',
type => 'string',
desc => 'The text to generate'
desc => 'The text to generate',
utf8 => 1
}}
sub fontname_arg () {{
name => 'fontname',
type => 'string',
desc => 'The fontname (conforming to the X Logical Font Description
Conventions)'
desc => 'The name of the font'
}}
sub size_args () {(
@ -68,7 +68,7 @@ sub font_prop_args {
foreach (@props) {
(my $desc = $_) =~ s/_/-/g;
push @result, { name => $_, type => 'string',
desc => qq/The font $desc, "*" for any/ }
desc => qq/The font $desc/ }
}
@result;
}