2006-12-09 21:33:38 +00:00
/* GIMP - The GNU Image Manipulation Program
2003-07-03 00:47:26 +00:00
* Copyright ( C ) 1995 - 2003 Spencer Kimball and Peter Mattis
1999-04-10 04:54:34 +00:00
*
2009-01-17 22:28:01 +00:00
* This program is free software : you can redistribute it and / or modify
1999-04-10 04:54:34 +00:00
* it under the terms of the GNU General Public License as published by
2009-01-17 22:28:01 +00:00
* the Free Software Foundation ; either version 3 of the License , or
1999-04-10 04:54:34 +00:00
* ( 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
2018-07-11 23:27:07 +02:00
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
1999-04-10 04:54:34 +00:00
*/
2007-01-09 10:52:47 +00:00
/* NOTE: This file is auto-generated by pdbgen.pl. */
1999-04-10 04:54:34 +00:00
2000-12-29 15:22:01 +00:00
# include "config.h"
1999-04-10 04:54:34 +00:00
2022-03-28 15:13:17 +02:00
# include "stamp-pdbgen.h"
2008-10-09 20:24:04 +00:00
# include <gegl.h>
2000-12-29 15:22:01 +00:00
2012-05-03 03:36:22 +02:00
# include <gdk-pixbuf/gdk-pixbuf.h>
2004-05-06 23:26:45 +00:00
# include "libgimpbase/gimpbase.h"
2012-05-04 00:50:23 +02:00
# include "libgimpbase/gimpbase.h"
2001-08-17 14:27:31 +00:00
# include "pdb-types.h"
2000-12-29 15:22:01 +00:00
2001-07-07 22:49:01 +00:00
# include "core/gimpdrawable.h"
2001-05-09 02:32:03 +00:00
# include "core/gimpimage.h"
# include "core/gimplayer.h"
2008-02-07 17:08:54 +00:00
# include "core/gimpparamspecs.h"
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
# include "text/gimpfont.h"
2003-01-31 09:22:42 +00:00
# include "text/gimptext-compat.h"
1999-04-10 04:54:34 +00:00
2008-02-07 17:08:54 +00:00
# include "gimppdb.h"
# include "gimppdb-utils.h"
# include "gimpprocedure.h"
2008-04-04 11:15:55 +00:00
# include "internal-procs.h"
2006-10-31 19:02:56 +00:00
2006-04-04 21:11:45 +00:00
2012-05-04 00:50:23 +02:00
static GimpValueArray *
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
text_font_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-04-04 21:11:45 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2006-04-04 21:11:45 +00:00
GimpImage * image ;
GimpDrawable * drawable ;
gdouble x ;
gdouble y ;
const gchar * text ;
2019-08-15 14:04:56 +02:00
gint border ;
2006-04-04 21:11:45 +00:00
gboolean antialias ;
gdouble size ;
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
GimpFont * font ;
2006-04-04 21:11:45 +00:00
GimpLayer * text_layer = NULL ;
2019-08-29 11:25:35 +02:00
image = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
drawable = g_value_get_object ( gimp_value_array_index ( args , 1 ) ) ;
2012-05-04 00:50:23 +02:00
x = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
y = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
text = g_value_get_string ( gimp_value_array_index ( args , 4 ) ) ;
border = g_value_get_int ( gimp_value_array_index ( args , 5 ) ) ;
antialias = g_value_get_boolean ( gimp_value_array_index ( args , 6 ) ) ;
size = g_value_get_double ( gimp_value_array_index ( args , 7 ) ) ;
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
font = g_value_get_object ( gimp_value_array_index ( args , 8 ) ) ;
2006-04-04 21:11:45 +00:00
if ( success )
{
2009-08-29 09:16:35 +02:00
if ( drawable & &
2012-11-08 20:46:18 +01:00
( ! gimp_pdb_item_is_attached ( GIMP_ITEM ( drawable ) , image ,
GIMP_PDB_ITEM_CONTENT , error ) | |
2009-08-29 09:16:35 +02:00
! gimp_pdb_item_is_not_group ( GIMP_ITEM ( drawable ) , error ) ) )
2006-04-04 21:11:45 +00:00
success = FALSE ;
if ( success )
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
text_layer = text_render ( image , drawable , context ,
x , y , font , size , text ,
border , antialias ) ;
2006-04-04 21:11:45 +00:00
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-04 21:11:45 +00:00
if ( success )
2019-08-29 11:25:35 +02:00
g_value_set_object ( gimp_value_array_index ( return_vals , 1 ) , text_layer ) ;
2006-04-04 21:11:45 +00:00
return return_vals ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
text_get_extents_font_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-04-04 21:11:45 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2006-04-04 21:11:45 +00:00
const gchar * text ;
gdouble size ;
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
GimpFont * font ;
2019-08-15 14:04:56 +02:00
gint width = 0 ;
gint height = 0 ;
gint ascent = 0 ;
gint descent = 0 ;
2006-04-04 21:11:45 +00:00
2012-05-04 00:50:23 +02:00
text = g_value_get_string ( gimp_value_array_index ( args , 0 ) ) ;
size = g_value_get_double ( gimp_value_array_index ( args , 1 ) ) ;
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
font = g_value_get_object ( gimp_value_array_index ( args , 2 ) ) ;
2006-04-04 21:11:45 +00:00
if ( success )
{
2018-05-29 12:38:48 -04:00
success = text_get_extents ( gimp ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
font , size , text ,
2006-04-04 21:11:45 +00:00
& width , & height ,
& ascent , & descent ) ;
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-04 21:11:45 +00:00
if ( success )
{
2012-05-04 00:50:23 +02:00
g_value_set_int ( gimp_value_array_index ( return_vals , 1 ) , width ) ;
g_value_set_int ( gimp_value_array_index ( return_vals , 2 ) , height ) ;
g_value_set_int ( gimp_value_array_index ( return_vals , 3 ) , ascent ) ;
g_value_set_int ( gimp_value_array_index ( return_vals , 4 ) , descent ) ;
2006-04-04 21:11:45 +00:00
}
return return_vals ;
}
1999-04-10 04:54:34 +00:00
void
2006-04-26 09:13:47 +00:00
register_text_tool_procs ( GimpPDB * pdb )
1999-04-10 04:54:34 +00:00
{
2006-03-31 17:42:13 +00:00
GimpProcedure * procedure ;
2006-03-29 20:27:46 +00:00
2006-03-28 19:58:00 +00:00
/*
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
* gimp - text - font
2006-03-28 19:58:00 +00:00
*/
2025-02-25 19:34:00 +01:00
procedure = gimp_procedure_new ( text_font_invoker , FALSE ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
" gimp-text-font " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" Add text at the specified location as a floating selection or a new layer. " ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
" The x and y parameters together control the placement of the new text by specifying the upper left corner of the text bounding box. If the specified drawable parameter is valid, the text will be created as a floating selection attached to the drawable. If the drawable parameter is not valid (%NULL), the text will appear as a new layer. Finally, a border can be specified around the final rendered text. The border is measured in pixels. \n "
" The size is always in pixels. If you need to display a font in points, divide the size in points by 72.0 and multiply it by the image's vertical resolution. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Martin Edlman & Sven Neumann " ,
" Spencer Kimball & Peter Mattis " ,
" 1998- 2001 " ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-29 11:25:35 +02:00
gimp_param_spec_image ( " image " ,
" image " ,
" The image " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-29 11:25:35 +02:00
gimp_param_spec_drawable ( " drawable " ,
" drawable " ,
" The affected drawable: (%NULL for a new text layer) " ,
TRUE ,
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x " ,
" x " ,
" The x coordinate for the left of the text bounding box " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
2006-03-28 19:58:00 +00:00
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y " ,
" y " ,
" The y coordinate for the top of the text bounding box " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " text " ,
" text " ,
" The text to generate (in UTF-8 encoding) " ,
2007-04-25 14:23:05 +00:00
FALSE , FALSE , FALSE ,
2006-03-31 09:15:08 +00:00
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " border " ,
" border " ,
" The size of the border " ,
- 1 , G_MAXINT32 , - 1 ,
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " antialias " ,
" antialias " ,
2006-05-18 17:25:15 +00:00
" Antialiasing " ,
2006-03-31 09:15:08 +00:00
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " size " ,
" size " ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
" The size of text in pixels " ,
2006-03-31 09:15:08 +00:00
0 , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
gimp_param_spec_font ( " font " ,
" font " ,
" The font " ,
FALSE ,
2024-07-27 08:18:54 -04:00
NULL ,
2024-09-06 13:38:43 +02:00
FALSE ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_return_value ( procedure ,
2019-08-29 11:25:35 +02:00
gimp_param_spec_layer ( " text-layer " ,
" text layer " ,
" The new text layer or %NULL if no layer was created. " ,
TRUE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-03-28 19:58:00 +00:00
/*
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
* gimp - text - get - extents - font
2006-03-28 19:58:00 +00:00
*/
2025-02-25 19:34:00 +01:00
procedure = gimp_procedure_new ( text_get_extents_font_invoker , FALSE ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
" gimp-text-get-extents-font " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" Get extents of the bounding box for the specified text. " ,
2023-10-02 21:30:20 +02:00
" This tool returns the width and height of a bounding box for the specified text rendered with the specified font information. Ascent and descent of the glyph extents are returned as well. \n "
" The ascent is the distance from the baseline to the highest point of the character. This is positive if the glyph ascends above the baseline. The descent is the distance from the baseline to the lowest point of the character. This is positive if the glyph descends below the baseline. \n "
" The size is always in pixels. If you need to set a font in points, divide the size in points by 72.0 and multiply it by the vertical resolution of the image you are taking into account. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Martin Edlman & Sven Neumann " ,
" Spencer Kimball & Peter Mattis " ,
" 1998- 2001 " ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " text " ,
" text " ,
" The text to generate (in UTF-8 encoding) " ,
2007-04-25 14:23:05 +00:00
FALSE , FALSE , FALSE ,
2006-03-31 09:15:08 +00:00
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " size " ,
" size " ,
" The size of text in either pixels or points " ,
0 , G_MAXDOUBLE , 0 ,
2006-03-28 19:58:00 +00:00
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_argument ( procedure ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
gimp_param_spec_font ( " font " ,
" font " ,
" The name of the font " ,
FALSE ,
2024-07-27 08:18:54 -04:00
NULL ,
2024-09-06 13:38:43 +02:00
FALSE ,
Issue #9987: text related functions crash using string for font name.
- Fonctions were renamed: s/gimp_text_fontname/gimp_text_font/ and
s/gimp_text_get_extents_fontname/gimp_text_get_extents_font/
- The size_type arguments were removed. Even in 2.10, this argument was marked
as "dead" and ignored. It was only kept for API compatibility.
- The font name (string) was replaced by a GimpFont argument.
gimp_text_font() is easily tested in the Python console with:
> Gimp.text_font(Gimp.list_images()[0], None, 10, 40, "Hello World!", 1.0, True, 100, Gimp.context_get_font())
And gimp_text_get_extents_font() with:
> Gimp.text_get_extents_font("Hello World!", 100, Gimp.context_get_font())
2023-10-02 20:38:18 +02:00
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_return_value ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " width " ,
" width " ,
2023-10-02 21:30:20 +02:00
" The width of the glyph extents " ,
2019-08-15 14:04:56 +02:00
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_return_value ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " height " ,
" height " ,
2023-10-02 21:30:20 +02:00
" The height of the glyph extents " ,
2019-08-15 14:04:56 +02:00
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_return_value ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " ascent " ,
" ascent " ,
2023-10-02 21:30:20 +02:00
" The ascent of the glyph extents " ,
2019-08-15 14:04:56 +02:00
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-03-31 09:15:08 +00:00
gimp_procedure_add_return_value ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " descent " ,
" descent " ,
2023-10-02 21:30:20 +02:00
" The descent of the glyph extents " ,
2019-08-15 14:04:56 +02:00
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
1999-04-10 04:54:34 +00:00
}