# Gimp.TextLayer.new

    function new(image: Gimp.Image, text: String, font: Gimp.Font, size: Number(gdouble), unit: Gimp.Unit): Gimp.TextLayer {
        // Gjs wrapper for gimp_text_layer_new()
    }

Create a new layer.

This procedure creates a new text layer displaying the specified text. By default the width and height of the layer will be determined by the text contents, the @fontname, size and unit.

The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the Gimp.Image.prototype.insert_layer command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls.

Since 3.0

image

  The image to which to add the layer.

text

  The text to generate (in UTF-8 encoding).

font

  The name of the font.

size

  The size of text in either pixels or points.

unit

  The units of specified size.

Returns

  The newly created text layer. The object belongs to libgimp and you should not free it.