Commit 53cfed36 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

let gimp_text() and gimp_text_fontname() succeed but return -1 if no layer

2004-12-15  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/text_tool.pdb: let gimp_text() and
	gimp_text_fontname() succeed but return -1 if no layer was created.
	Fixes bug #161272.

	* app/pdb/text_tool_cmds.c
	* libgimp/gimptexttool_pdb.c: regenerated.
parent 37226e50
2004-12-15 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/text_tool.pdb: let gimp_text() and
gimp_text_fontname() succeed but return -1 if no layer was created.
Fixes bug #161272.
* app/pdb/text_tool_cmds.c
* libgimp/gimptexttool_pdb.c: regenerated.
2004-12-15 Michael Natterer <mitch@gimp.org> 2004-12-15 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.[ch]: added utility function * app/core/gimpdrawable-preview.[ch]: added utility function
......
...@@ -111,8 +111,6 @@ text_fontname_invoker (Gimp *gimp, ...@@ -111,8 +111,6 @@ text_fontname_invoker (Gimp *gimp,
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }
...@@ -121,7 +119,7 @@ text_fontname_invoker (Gimp *gimp, ...@@ -121,7 +119,7 @@ text_fontname_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&text_fontname_proc, success); return_args = procedural_db_return_args (&text_fontname_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (text_layer)); return_args[1].value.pdb_int = text_layer ? gimp_item_get_ID (GIMP_ITEM (text_layer)) : -1;
return return_args; return return_args;
} }
...@@ -185,7 +183,7 @@ static ProcArg text_fontname_outargs[] = ...@@ -185,7 +183,7 @@ static ProcArg text_fontname_outargs[] =
{ {
GIMP_PDB_LAYER, GIMP_PDB_LAYER,
"text_layer", "text_layer",
"The new text layer" "The new text layer or -1 if no layer was created."
} }
}; };
...@@ -428,8 +426,6 @@ text_invoker (Gimp *gimp, ...@@ -428,8 +426,6 @@ text_invoker (Gimp *gimp,
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }
...@@ -438,7 +434,7 @@ text_invoker (Gimp *gimp, ...@@ -438,7 +434,7 @@ text_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&text_proc, success); return_args = procedural_db_return_args (&text_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (text_layer)); return_args[1].value.pdb_int = text_layer ? gimp_item_get_ID (GIMP_ITEM (text_layer)) : -1;
return return_args; return return_args;
} }
...@@ -537,7 +533,7 @@ static ProcArg text_outargs[] = ...@@ -537,7 +533,7 @@ static ProcArg text_outargs[] =
{ {
GIMP_PDB_LAYER, GIMP_PDB_LAYER,
"text_layer", "text_layer",
"The new text layer" "The new text layer or -1 if no layer was created."
} }
}; };
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
* Finally, a border can be specified around the final rendered text. * Finally, a border can be specified around the final rendered text.
* The border is measured in pixels. * The border is measured in pixels.
* *
* Returns: The new text layer. * Returns: The new text layer or -1 if no layer was created.
*/ */
gint32 gint32
gimp_text_fontname (gint32 image_ID, gimp_text_fontname (gint32 image_ID,
...@@ -175,7 +175,7 @@ gimp_text_get_extents_fontname (const gchar *text, ...@@ -175,7 +175,7 @@ gimp_text_get_extents_fontname (const gchar *text,
* *
* This procedure is deprecated! Use gimp_text_fontname() instead. * This procedure is deprecated! Use gimp_text_fontname() instead.
* *
* Returns: The new text layer. * Returns: The new text layer or -1 if no layer was created.
*/ */
gint32 gint32
gimp_text (gint32 image_ID, gimp_text (gint32 image_ID,
......
...@@ -75,7 +75,8 @@ sub font_prop_args { ...@@ -75,7 +75,8 @@ sub font_prop_args {
sub render_outargs { sub render_outargs {
@outargs = ( @outargs = (
{ name => 'text_layer', type => 'layer', { name => 'text_layer', type => 'layer',
desc => 'The new text layer', init => 1 } desc => 'The new text layer or -1 if no layer was created.',
init => 1, return_fail => -1 }
); );
} }
...@@ -128,8 +129,6 @@ HELP ...@@ -128,8 +129,6 @@ HELP
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }
...@@ -199,8 +198,6 @@ sub text { ...@@ -199,8 +198,6 @@ sub text {
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment