Gimp.TextLayer¶
- Subclasses:
None
Methods¶
- Inherited:
Gimp.Layer (37), Gimp.Drawable (55), Gimp.Item (55), GObject.Object (37)
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gimp.TextLayer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Functions for querying and manipulating text layers.
- classmethod get_by_id(layer_id)¶
- Parameters:
layer_id (
int
) – The layer id.- Returns:
a
Gimp.TextLayer
for layer_id orNone
if layer_id does not represent a valid layer. The object belongs to libgimp and you must not modify or unref it.- Return type:
Returns a
Gimp.TextLayer
representing layer_id. This function callsGimp.Item.get_by_id
() and returns the item if it is layer orNone
otherwise.New in version 3.0.
- classmethod new(image, text, font, size, unit)¶
- Parameters:
image (
Gimp.Image
) – The image.text (
str
) – The text to generate (in UTF-8 encoding).font (
Gimp.Font
) – The font to write the text with.size (
float
) – The size of text in either pixels or points.unit (
Gimp.Unit
) – The units of specified size.
- Returns:
The new text layer. The object belongs to libgimp and you should not free it.
- Return type:
Creates a new text 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 font, 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 [method`Image`.insert_layer] method.
The arguments are kept as simple as necessary for the basic case. All text attributes, however, can be modified with the appropriate
gimp_text_layer_set_*()
procedures.New in version 2.6.
- get_antialias()¶
- Returns:
A flag which is true if antialiasing is used for rendering the font in the text layer.
- Return type:
Check if antialiasing is used in the text layer.
This procedure checks if antialiasing is enabled in the specified text layer.
New in version 2.6.
- get_base_direction()¶
- Returns:
The based direction used for the text layer.
- Return type:
Get the base direction used for rendering the text layer.
This procedure returns the base direction used for rendering the text in the text layer
New in version 2.6.
- get_color()¶
- Returns:
The color of the text.
- Return type:
Get the color of the text in a text layer.
This procedure returns the color of the text in a text layer.
New in version 2.6.
- get_font()¶
- Returns:
The font which is used in the specified text layer.
- Return type:
Get the font from a text layer as string.
This procedure returns the font from a text layer.
New in version 2.6.
- get_font_size()¶
- Returns:
The font size.
- unit:
The unit used for the font size.
- Return type:
Get the font size from a text layer.
This procedure returns the size of the font which is used in a text layer. You will receive the size as a double ‘font-size’ in ‘unit’ units.
New in version 2.6.
- get_hint_style()¶
- Returns:
The hint style used for font outlines.
- Return type:
Get information about hinting in the specified text layer.
This procedure provides information about the hinting that is being used in a text layer. Hinting can be optimized for fidelity or contrast or it can be turned entirely off.
New in version 2.8.
- get_indent()¶
- Returns:
The indentation value of the first line.
- Return type:
Get the line indentation of text layer.
This procedure returns the indentation of the first line in a text layer.
New in version 2.6.
- get_justification()¶
- Returns:
The justification used in the text layer.
- Return type:
Get the text justification information of the text layer.
This procedure returns the alignment of the lines in the text layer relative to each other.
New in version 2.6.
- get_kerning()¶
- Returns:
A flag which is true if kerning is used in the text layer.
- Return type:
Check if kerning is used in the text layer.
This procedure checks if kerning is enabled in the specified text layer.
New in version 2.6.
- get_language()¶
- Returns:
The language used in the text layer. The returned value must be freed with
GLib.free
().- Return type:
Get the language used in the text layer.
This procedure returns the language string which is set for the text in the text layer.
New in version 2.6.
- get_letter_spacing()¶
- Returns:
The letter-spacing value.
- Return type:
Get the letter spacing used in a text layer.
This procedure returns the additional spacing between the single glyphs in a text layer.
New in version 2.6.
- get_line_spacing()¶
- Returns:
The line-spacing value.
- Return type:
Get the spacing between lines of text.
This procedure returns the line-spacing between lines of text in a text layer.
New in version 2.6.
- get_markup()¶
- Returns:
The markup which represents the style of the specified text layer. The returned value must be freed with
GLib.free
().- Return type:
Get the markup from a text layer as string.
This procedure returns the markup of the styles from a text layer. The markup will be in the form of Pango’s markup - See https://www.pango.org/ for more information about Pango and its markup.
New in version 2.8.
- get_text()¶
- Returns:
The text from the specified text layer. The returned value must be freed with
GLib.free
().- Return type:
Get the text from a text layer as string.
This procedure returns the text from a text layer as a string.
New in version 2.6.
- resize(width, height)¶
- Parameters:
- Returns:
True
on success.- Return type:
Resize the box of a text layer.
This procedure changes the width and height of a text layer while keeping it as a text layer and not converting it to a bitmap like
Gimp.Layer.resize
() would do.New in version 2.8.
- set_antialias(antialias)¶
- Parameters:
antialias (
bool
) – Enable/disable antialiasing of the text.- Returns:
True
on success.- Return type:
Enable/disable anti-aliasing in a text layer.
This procedure enables or disables anti-aliasing of the text in a text layer.
New in version 2.6.
- set_base_direction(direction)¶
- Parameters:
direction (
Gimp.TextDirection
) – The base direction of the text.- Returns:
True
on success.- Return type:
Set the base direction in the text layer.
This procedure sets the base direction used in applying the Unicode bidirectional algorithm when rendering the text.
New in version 2.6.
- set_color(color)¶
- Parameters:
color (
Gegl.Color
) – The color to use for the text.- Returns:
True
on success.- Return type:
Set the color of the text in the text layer.
This procedure sets the text color in the text layer ‘layer’.
New in version 2.6.
- set_font(font)¶
-
Set the font of a text layer.
This procedure modifies the font used in the specified text layer.
New in version 2.6.
- set_font_size(font_size, unit)¶
- Parameters:
- Returns:
True
on success.- Return type:
Set the font size.
This procedure changes the font size of a text layer. The size of your font will be a double ‘font-size’ of ‘unit’ units.
New in version 2.6.
- set_hint_style(style)¶
- Parameters:
style (
Gimp.TextHintStyle
) – The new hint style.- Returns:
True
on success.- Return type:
Control how font outlines are hinted in a text layer.
This procedure sets the hint style for font outlines in a text layer. This controls whether to fit font outlines to the pixel grid, and if so, whether to optimize for fidelity or contrast.
New in version 2.8.
- set_indent(indent)¶
- Parameters:
indent (
float
) – The indentation for the first line.- Returns:
True
on success.- Return type:
Set the indentation of the first line in a text layer.
This procedure sets the indentation of the first line in the text layer.
New in version 2.6.
- set_justification(justify)¶
- Parameters:
justify (
Gimp.TextJustification
) – The justification for your text.- Returns:
True
on success.- Return type:
Set the justification of the text in a text layer.
This procedure sets the alignment of the lines in the text layer relative to each other.
New in version 2.6.
- set_kerning(kerning)¶
- Parameters:
kerning (
bool
) – Enable/disable kerning in the text.- Returns:
True
on success.- Return type:
Enable/disable kerning in a text layer.
This procedure enables or disables kerning in a text layer.
New in version 2.6.
- set_language(language)¶
- Parameters:
language (
str
) – The new language to use for the text layer.- Returns:
True
on success.- Return type:
Set the language of the text layer.
This procedure sets the language of the text in text layer. For some scripts the language has an influence of how the text is rendered.
New in version 2.6.
- set_letter_spacing(letter_spacing)¶
- Parameters:
letter_spacing (
float
) – The additional letter spacing to use.- Returns:
True
on success.- Return type:
Adjust the letter spacing in a text layer.
This procedure sets the additional spacing between the single glyphs in a text layer.
New in version 2.6.
- set_line_spacing(line_spacing)¶
- Parameters:
line_spacing (
float
) – The additional line spacing to use.- Returns:
True
on success.- Return type:
Adjust the line spacing in a text layer.
This procedure sets the additional spacing used between lines a text layer.
New in version 2.6.
- set_markup(markup)¶
-
Set the markup for a text layer from a string.
This procedure sets the markup of the styles for a text layer. The markup should be in the form of Pango’s markup - See https://docs.gtk.org/Pango/pango_markup.html for a reference. Note that GIMP’s text tool does not support all of Pango markup. Any unsupported markup will still be applied to your text layer, yet would be dropped as soon as you edit text with the tool.
New in version 3.0.