diff --git a/ChangeLog b/ChangeLog index 6793271de9..cd04ac5311 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-12-15 Sven Neumann + + * 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 * app/core/gimpdrawable-preview.[ch]: added utility function diff --git a/app/pdb/text_tool_cmds.c b/app/pdb/text_tool_cmds.c index f9028b2c3b..6e6bdae32d 100644 --- a/app/pdb/text_tool_cmds.c +++ b/app/pdb/text_tool_cmds.c @@ -111,8 +111,6 @@ text_fontname_invoker (Gimp *gimp, text_layer = text_render (gimage, drawable, context, x, y, real_fontname, text, border, antialias); - if (text_layer == NULL) - success = FALSE; g_free (real_fontname); } @@ -121,7 +119,7 @@ text_fontname_invoker (Gimp *gimp, return_args = procedural_db_return_args (&text_fontname_proc, 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; } @@ -185,7 +183,7 @@ static ProcArg text_fontname_outargs[] = { GIMP_PDB_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, text_layer = text_render (gimage, drawable, context, x, y, real_fontname, text, border, antialias); - if (text_layer == NULL) - success = FALSE; g_free (real_fontname); } @@ -438,7 +434,7 @@ text_invoker (Gimp *gimp, return_args = procedural_db_return_args (&text_proc, 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; } @@ -537,7 +533,7 @@ static ProcArg text_outargs[] = { GIMP_PDB_LAYER, "text_layer", - "The new text layer" + "The new text layer or -1 if no layer was created." } }; diff --git a/libgimp/gimptexttool_pdb.c b/libgimp/gimptexttool_pdb.c index 4ea0d6b83d..749effdfa9 100644 --- a/libgimp/gimptexttool_pdb.c +++ b/libgimp/gimptexttool_pdb.c @@ -52,7 +52,7 @@ * Finally, a border can be specified around the final rendered text. * The border is measured in pixels. * - * Returns: The new text layer. + * Returns: The new text layer or -1 if no layer was created. */ gint32 gimp_text_fontname (gint32 image_ID, @@ -175,7 +175,7 @@ gimp_text_get_extents_fontname (const gchar *text, * * 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 gimp_text (gint32 image_ID, diff --git a/tools/pdbgen/pdb/text_tool.pdb b/tools/pdbgen/pdb/text_tool.pdb index b8b8cee4c7..e6f2f51a2d 100644 --- a/tools/pdbgen/pdb/text_tool.pdb +++ b/tools/pdbgen/pdb/text_tool.pdb @@ -75,7 +75,8 @@ sub font_prop_args { sub render_outargs { @outargs = ( { 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 text_layer = text_render (gimage, drawable, context, x, y, real_fontname, text, border, antialias); - if (text_layer == NULL) - success = FALSE; g_free (real_fontname); } @@ -199,8 +198,6 @@ sub text { text_layer = text_render (gimage, drawable, context, x, y, real_fontname, text, border, antialias); - if (text_layer == NULL) - success = FALSE; g_free (real_fontname); }