gimptexttool

## gimptexttool gimptexttool — Functions for controlling the text tool. |

## Synopsis

    gint32              gimp_text_fontname                  (gint32 image_ID,
                                                             gint32 drawable_ID,
                                                             gdouble x,
                                                             gdouble y,
                                                             const gchar *text,
                                                             gint border,
                                                             gboolean antialias,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *fontname);
    gboolean            gimp_text_get_extents_fontname      (const gchar *text,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *fontname,
                                                             gint *width,
                                                             gint *height,
                                                             gint *ascent,
                                                             gint *descent);
    gint32              gimp_text                           (gint32 image_ID,
                                                             gint32 drawable_ID,
                                                             gdouble x,
                                                             gdouble y,
                                                             const gchar *text,
                                                             gint border,
                                                             gboolean antialias,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *foundry,
                                                             const gchar *family,
                                                             const gchar *weight,
                                                             const gchar *slant,
                                                             const gchar *set_width,
                                                             const gchar *spacing,
                                                             const gchar *registry,
                                                             const gchar *encoding);
    gboolean            gimp_text_get_extents               (const gchar *text,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *foundry,
                                                             const gchar *family,
                                                             const gchar *weight,
                                                             const gchar *slant,
                                                             const gchar *set_width,
                                                             const gchar *spacing,
                                                             const gchar *registry,
                                                             const gchar *encoding,
                                                             gint *width,
                                                             gint *height,
                                                             gint *ascent,
                                                             gint *descent);

## Description

Functions for controlling the text tool.

## Details

### gimp_text_fontname ()

    gint32              gimp_text_fontname                  (gint32 image_ID,
                                                             gint32 drawable_ID,
                                                             gdouble x,
                                                             gdouble y,
                                                             const gchar *text,
                                                             gint border,
                                                             gboolean antialias,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *fontname);

Add text at the specified location as a floating selection or a new layer.

This tool requires a fontname matching an installed PangoFT2 font. You can specify the fontsize in units of pixels or points, and the appropriate metric is specified using the size_type argument. 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 (-1), 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. Parameter size-type is not used and is currently ignored. 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.

`image_ID` : | The image.
`drawable_ID` : | The affected drawable: (-1 for a new text layer).
`x` : | The x coordinate for the left of the text bounding box.
`y` : | The y coordinate for the top of the text bounding box.
`text` : | The text to generate (in UTF-8 encoding).
`border` : | The size of the border.
`antialias` : | Antialiasing.
`size` : | The size of text in either pixels or points.
`size_type` : | The units of specified size.
`fontname` : | The name of the font.
Returns : | The new text layer or -1 if no layer was created.

### gimp_text_get_extents_fontname ()

    gboolean            gimp_text_get_extents_fontname      (const gchar *text,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *fontname,
                                                             gint *width,
                                                             gint *height,
                                                             gint *ascent,
                                                             gint *descent);

Get extents of the bounding box for the specified text.

This tool returns the width and height of a bounding box for the specified text string with the specified font information. Ascent and descent for the specified font are returned as well. Parameter size-type is not used and is currently ignored. If you need to display 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.

`text` : | The text to generate (in UTF-8 encoding).
`size` : | The size of text in either pixels or points.
`size_type` : | The units of specified size.
`fontname` : | The name of the font.
`width` : | The width of the specified font.
`height` : | The height of the specified font.
`ascent` : | The ascent of the specified font.
`descent` : | The descent of the specified font.
Returns : | TRUE on success.

### gimp_text ()

    gint32              gimp_text                           (gint32 image_ID,
                                                             gint32 drawable_ID,
                                                             gdouble x,
                                                             gdouble y,
                                                             const gchar *text,
                                                             gint border,
                                                             gboolean antialias,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *foundry,
                                                             const gchar *family,
                                                             const gchar *weight,
                                                             const gchar *slant,
                                                             const gchar *set_width,
                                                             const gchar *spacing,
                                                             const gchar *registry,
                                                             const gchar *encoding);

### Warning

`gimp_text` is deprecated and should not be used in newly-written code.

This procedure is deprecated! Use `gimp_text_fontname()` instead.

`image_ID` : | The image.
`drawable_ID` : | The affected drawable: (-1 for a new text layer).
`x` : | The x coordinate for the left of the text bounding box.
`y` : | The y coordinate for the top of the text bounding box.
`text` : | The text to generate (in UTF-8 encoding).
`border` : | The size of the border.
`antialias` : | Antialiasing.
`size` : | The size of text in either pixels or points.
`size_type` : | The units of specified size.
`foundry` : | The font foundry.
`family` : | The font family.
`weight` : | The font weight.
`slant` : | The font slant.
`set_width` : | The font set-width.
`spacing` : | The font spacing.
`registry` : | The font registry.
`encoding` : | The font encoding.
Returns : | The new text layer or -1 if no layer was created.

### gimp_text_get_extents ()

    gboolean            gimp_text_get_extents               (const gchar *text,
                                                             gdouble size,
                                                             GimpSizeType size_type,
                                                             const gchar *foundry,
                                                             const gchar *family,
                                                             const gchar *weight,
                                                             const gchar *slant,
                                                             const gchar *set_width,
                                                             const gchar *spacing,
                                                             const gchar *registry,
                                                             const gchar *encoding,
                                                             gint *width,
                                                             gint *height,
                                                             gint *ascent,
                                                             gint *descent);

### Warning

`gimp_text_get_extents` is deprecated and should not be used in newly-written code.

This procedure is deprecated! Use `gimp_text_get_extents_fontname()` instead.

`text` : | The text to generate (in UTF-8 encoding).
`size` : | The size of text in either pixels or points.
`size_type` : | The units of specified size.
`foundry` : | The font foundry.
`family` : | The font family.
`weight` : | The font weight.
`slant` : | The font slant.
`set_width` : | The font set-width.
`spacing` : | The font spacing.
`registry` : | The font registry.
`encoding` : | The font encoding.
`width` : | The width of the specified font.
`height` : | The height of the specified font.
`ascent` : | The ascent of the specified font.
`descent` : | The descent of the specified font.
Returns : | TRUE on success.