[gimp] app, libgimp, pdb, plug-ins: new GimpTextLayer class in libgimp.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app, libgimp, pdb, plug-ins: new GimpTextLayer class in libgimp.
- Date: Fri, 30 Sep 2022 19:07:58 +0000 (UTC)
commit 892b62ec364cbdbd622d56a017f446051af724bc
Author: Jehan <jehan girinstud io>
Date: Fri Sep 30 16:21:47 2022 +0200
app, libgimp, pdb, plug-ins: new GimpTextLayer class in libgimp.
Now text layers are proper types, which means that the binding API will also be
nicer (e.g. `txt_layer.set_text('hello world')` in Python).
This commit also adds the param specs allowing to create plug-in procedures with
text layer parameters.
Finally it fixes the few calls in file-pdf-save (apparently the only plug-in
using specific text layer API right now) with explicit type conversion.
app/core/gimpparamspecs.c | 2 +
app/pdb/text-layer-cmds.c | 818 +++++++++++++++-------------------------
libgimp/Makefile.gi | 2 +
libgimp/gimp.def | 4 +
libgimp/gimp.h | 1 +
libgimp/gimplayer.c | 18 +-
libgimp/gimplayer.h | 20 +-
libgimp/gimpparamspecs-body.c | 80 ++++
libgimp/gimpparamspecs.h | 26 ++
libgimp/gimpplugin.c | 8 +-
libgimp/gimpprocedure-params.h | 30 ++
libgimp/gimptextlayer.c | 140 +++++++
libgimp/gimptextlayer.h | 49 +++
libgimp/gimptextlayer_pdb.c | 164 ++++----
libgimp/gimptextlayer_pdb.h | 106 +++---
libgimp/gimptypes.h | 1 +
libgimp/meson.build | 2 +
pdb/app.pl | 10 +
pdb/groups/text_layer.pdb | 519 ++++++++-----------------
pdb/pdb.pl | 12 +
plug-ins/common/file-pdf-save.c | 28 +-
21 files changed, 1013 insertions(+), 1027 deletions(-)
---
diff --git a/app/core/gimpparamspecs.c b/app/core/gimpparamspecs.c
index 3899d83664..19e0c51427 100644
--- a/app/core/gimpparamspecs.c
+++ b/app/core/gimpparamspecs.c
@@ -32,6 +32,8 @@
#include "gimpparamspecs.h"
#include "gimpselection.h"
+#include "text/gimptextlayer.h"
+
#include "vectors/gimpvectors.h"
diff --git a/app/pdb/text-layer-cmds.c b/app/pdb/text-layer-cmds.c
index 9a83bf91b7..a50592b9ee 100644
--- a/app/pdb/text-layer-cmds.c
+++ b/app/pdb/text-layer-cmds.c
@@ -37,7 +37,6 @@
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
-#include "core/gimplayer.h"
#include "core/gimpparamspecs.h"
#include "text/gimptext.h"
#include "text/gimptextlayer.h"
@@ -66,7 +65,7 @@ text_layer_new_invoker (GimpProcedure *procedure,
const gchar *fontname;
gdouble size;
GimpUnit unit;
- GimpLayer *layer = NULL;
+ GimpTextLayer *layer = NULL;
image = g_value_get_object (gimp_value_array_index (args, 0));
text = g_value_get_string (gimp_value_array_index (args, 1));
@@ -89,7 +88,7 @@ text_layer_new_invoker (GimpProcedure *procedure,
"color", &color,
NULL);
- layer = gimp_text_layer_new (image, gimp_text);
+ layer = GIMP_TEXT_LAYER (gimp_text_layer_new (image, gimp_text));
g_object_unref (gimp_text);
if (! layer)
@@ -120,23 +119,16 @@ text_layer_get_text_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gchar *text = NULL;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "text", &text,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "text", &text,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -157,7 +149,7 @@ text_layer_set_text_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
const gchar *text;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -165,17 +157,10 @@ text_layer_set_text_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "text", text,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "text", text,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -192,23 +177,16 @@ text_layer_get_markup_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gchar *markup = NULL;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "markup", &markup,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "markup", &markup,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -229,7 +207,7 @@ text_layer_set_markup_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
const gchar *markup;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -237,35 +215,28 @@ text_layer_set_markup_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ gchar *markup_cat = NULL;
+ const gchar *markup_ptr = markup;
+
+ if (strstr(markup, "<markup>") == NULL || strstr(markup, "</markup>") == NULL)
{
- gchar *markup_cat = NULL;
- const gchar *markup_ptr = markup;
-
- if (strstr(markup, "<markup>") == NULL || strstr(markup, "</markup>") == NULL)
- {
- markup_cat = g_strconcat("<markup>", markup, "</markup>", NULL);
- markup_ptr = markup_cat;
- }
-
- if (pango_parse_markup (markup_ptr, -1, 0, NULL, NULL, NULL, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer markup"),
- "markup", markup_ptr,
- NULL);
- }
- else
- {
- success = FALSE;
- }
-
- g_free(markup_cat);
+ markup_cat = g_strconcat("<markup>", markup, "</markup>", NULL);
+ markup_ptr = markup_cat;
+ }
+
+ if (pango_parse_markup (markup_ptr, -1, 0, NULL, NULL, NULL, error))
+ {
+ gimp_text_layer_set (layer,
+ _("Set text layer markup"),
+ "markup", markup_ptr,
+ NULL);
}
else
{
success = FALSE;
}
+
+ g_free(markup_cat);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -282,23 +253,16 @@ text_layer_get_font_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gchar *font = NULL;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "font", &font,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "font", &font,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -319,7 +283,7 @@ text_layer_set_font_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
const gchar *font;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -327,17 +291,10 @@ text_layer_set_font_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "font", font,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "font", font,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -354,7 +311,7 @@ text_layer_get_font_size_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble font_size = 0.0;
GimpUnit unit = GIMP_UNIT_PIXEL;
@@ -362,17 +319,10 @@ text_layer_get_font_size_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "font-size", &font_size,
- "font-size-unit", &unit,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "font-size", &font_size,
+ "font-size-unit", &unit,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -396,7 +346,7 @@ text_layer_set_font_size_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble font_size;
GimpUnit unit;
@@ -406,18 +356,11 @@ text_layer_set_font_size_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "font-size-unit", unit,
- "font-size", font_size,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "font-size-unit", unit,
+ "font-size", font_size,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -434,23 +377,16 @@ text_layer_get_antialias_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gboolean antialias = FALSE;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "antialias", &antialias,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "antialias", &antialias,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -471,7 +407,7 @@ text_layer_set_antialias_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gboolean antialias;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -479,17 +415,10 @@ text_layer_set_antialias_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "antialias", antialias,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "antialias", antialias,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -506,23 +435,16 @@ text_layer_get_hint_style_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gint style = 0;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "hint-style", &style,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "hint-style", &style,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -543,7 +465,7 @@ text_layer_set_hint_style_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gint style;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -551,17 +473,10 @@ text_layer_set_hint_style_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "hint-style", style,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "hint-style", style,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -578,23 +493,16 @@ text_layer_get_kerning_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gboolean kerning = FALSE;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "kerning", &kerning,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "kerning", &kerning,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -615,7 +523,7 @@ text_layer_set_kerning_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gboolean kerning;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -623,17 +531,10 @@ text_layer_set_kerning_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "kerning", kerning,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "kerning", kerning,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -650,23 +551,16 @@ text_layer_get_language_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gchar *language = NULL;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "language", &language,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "language", &language,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -687,7 +581,7 @@ text_layer_set_language_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
const gchar *language;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -695,17 +589,10 @@ text_layer_set_language_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "language", language,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "language", language,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -722,23 +609,16 @@ text_layer_get_base_direction_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gint direction = 0;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "base-direction", &direction,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "base-direction", &direction,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -759,7 +639,7 @@ text_layer_set_base_direction_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gint direction;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -767,17 +647,10 @@ text_layer_set_base_direction_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "base-direction", direction,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "base-direction", direction,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -794,23 +667,16 @@ text_layer_get_justification_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gint justify = 0;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "justify", &justify,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "justify", &justify,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -831,7 +697,7 @@ text_layer_set_justification_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gint justify;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -839,17 +705,10 @@ text_layer_set_justification_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "justify", justify,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "justify", justify,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -866,21 +725,14 @@ text_layer_get_color_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- color = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer))->color;
- }
- else
- {
- success = FALSE;
- }
+ color = gimp_text_layer_get_text (layer)->color;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -901,7 +753,7 @@ text_layer_set_color_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
GimpRGB color;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -909,17 +761,10 @@ text_layer_set_color_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "color", &color,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "color", &color,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -936,23 +781,16 @@ text_layer_get_indent_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble indent = 0.0;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "indent", &indent,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "indent", &indent,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -973,7 +811,7 @@ text_layer_set_indent_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble indent;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -981,17 +819,10 @@ text_layer_set_indent_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "indent", indent,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "indent", indent,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -1008,23 +839,16 @@ text_layer_get_line_spacing_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble line_spacing = 0.0;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "line-spacing", &line_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "line-spacing", &line_spacing,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -1045,7 +869,7 @@ text_layer_set_line_spacing_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble line_spacing;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -1053,17 +877,10 @@ text_layer_set_line_spacing_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "line-spacing", line_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "line-spacing", line_spacing,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -1080,23 +897,16 @@ text_layer_get_letter_spacing_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
GimpValueArray *return_vals;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble letter_spacing = 0.0;
layer = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "letter-spacing", &letter_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "letter-spacing", &letter_spacing,
+ NULL);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -1117,7 +927,7 @@ text_layer_set_letter_spacing_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble letter_spacing;
layer = g_value_get_object (gimp_value_array_index (args, 0));
@@ -1125,17 +935,10 @@ text_layer_set_letter_spacing_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "letter-spacing", letter_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "letter-spacing", letter_spacing,
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -1151,7 +954,7 @@ text_layer_resize_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- GimpLayer *layer;
+ GimpTextLayer *layer;
gdouble width;
gdouble height;
@@ -1161,29 +964,22 @@ text_layer_resize_invoker (GimpProcedure *procedure,
if (success)
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- GimpText *text = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer));
- gdouble xres, yres;
-
- gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
- &xres, &yres);
-
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "box-mode", GIMP_TEXT_BOX_FIXED,
- "box-width", gimp_pixels_to_units (width,
- text->box_unit,
- xres),
- "box-height", gimp_pixels_to_units (height,
- text->box_unit,
- yres),
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ GimpText *text = gimp_text_layer_get_text (layer);
+ gdouble xres, yres;
+
+ gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
+ &xres, &yres);
+
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "box-mode", GIMP_TEXT_BOX_FIXED,
+ "box-width", gimp_pixels_to_units (width,
+ text->box_unit,
+ xres),
+ "box-height", gimp_pixels_to_units (height,
+ text->box_unit,
+ yres),
+ NULL);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -1244,11 +1040,11 @@ register_text_layer_procs (GimpPDB *pdb)
GIMP_UNIT_PIXEL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The new text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The new text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
@@ -1267,11 +1063,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("text",
"text",
@@ -1297,11 +1093,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("text",
"text",
@@ -1327,11 +1123,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Barak Itkin",
"2010");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("markup",
"markup",
@@ -1358,11 +1154,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Ian Munsie",
"2014");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("markup",
"markup",
@@ -1388,11 +1184,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("font",
"font",
@@ -1418,11 +1214,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("font",
"font",
@@ -1448,11 +1244,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("font-size",
"font size",
@@ -1485,11 +1281,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("font-size",
"font size",
@@ -1522,11 +1318,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("antialias",
"antialias",
@@ -1551,11 +1347,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("antialias",
"antialias",
@@ -1580,11 +1376,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_enum ("style",
"style",
@@ -1610,11 +1406,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Sven Neumann",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("style",
"style",
@@ -1640,11 +1436,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("kerning",
"kerning",
@@ -1669,11 +1465,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("kerning",
"kerning",
@@ -1698,11 +1494,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("language",
"language",
@@ -1728,11 +1524,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("language",
"language",
@@ -1758,11 +1554,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_enum ("direction",
"direction",
@@ -1788,11 +1584,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("direction",
"direction",
@@ -1818,11 +1614,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_enum ("justify",
"justify",
@@ -1848,11 +1644,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("justify",
"justify",
@@ -1878,11 +1674,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_rgb ("color",
"color",
@@ -1908,11 +1704,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_rgb ("color",
"color",
@@ -1938,11 +1734,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("indent",
"indent",
@@ -1967,11 +1763,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("indent",
"indent",
@@ -1996,11 +1792,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("line-spacing",
"line spacing",
@@ -2025,11 +1821,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("line-spacing",
"line spacing",
@@ -2054,11 +1850,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer.",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("letter-spacing",
"letter spacing",
@@ -2083,11 +1879,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Marcus Heese",
"2008");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("letter-spacing",
"letter spacing",
@@ -2112,11 +1908,11 @@ register_text_layer_procs (GimpPDB *pdb)
"Barak Itkin",
"2009");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_layer ("layer",
- "layer",
- "The text layer",
- FALSE,
- GIMP_PARAM_READWRITE));
+ gimp_param_spec_text_layer ("layer",
+ "layer",
+ "The text layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("width",
"width",
diff --git a/libgimp/Makefile.gi b/libgimp/Makefile.gi
index 4d8c8f9a97..4aff54b105 100644
--- a/libgimp/Makefile.gi
+++ b/libgimp/Makefile.gi
@@ -136,6 +136,7 @@ libgimp_introspectable_headers = \
../libgimp/gimpprogress.h \
../libgimp/gimpsaveprocedure.h \
../libgimp/gimpselection.h \
+ ../libgimp/gimptextlayer.h \
../libgimp/gimpthumbnailprocedure.h \
../libgimp/gimpvectors.h
@@ -172,6 +173,7 @@ libgimp_introspectable = \
../libgimp/gimpprogress.c \
../libgimp/gimpsaveprocedure.c \
../libgimp/gimpselection.c \
+ ../libgimp/gimptextlayer.h \
../libgimp/gimpthumbnailprocedure.c \
../libgimp/gimpvectors.c
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 5875cda1bb..cd54a8213a 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -665,7 +665,9 @@ EXPORTS
gimp_param_spec_layer
gimp_param_spec_layer_mask
gimp_param_spec_selection
+ gimp_param_spec_text_layer
gimp_param_spec_vectors
+ gimp_param_text_layer_get_type
gimp_param_vectors_get_type
gimp_pattern_get_info
gimp_pattern_get_pixels
@@ -819,6 +821,7 @@ EXPORTS
gimp_text_get_extents_fontname
gimp_text_layer_get_antialias
gimp_text_layer_get_base_direction
+ gimp_text_layer_get_by_id
gimp_text_layer_get_color
gimp_text_layer_get_font
gimp_text_layer_get_font_size
@@ -831,6 +834,7 @@ EXPORTS
gimp_text_layer_get_line_spacing
gimp_text_layer_get_markup
gimp_text_layer_get_text
+ gimp_text_layer_get_type
gimp_text_layer_new
gimp_text_layer_resize
gimp_text_layer_set_antialias
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index a449c68a0a..9a873a0c19 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -62,6 +62,7 @@
#include <libgimp/gimpprogress.h>
#include <libgimp/gimpsaveprocedure.h>
#include <libgimp/gimpselection.h>
+#include <libgimp/gimptextlayer.h>
#include <libgimp/gimpthumbnailprocedure.h>
#include <libgimp/gimpvectors.h>
diff --git a/libgimp/gimplayer.c b/libgimp/gimplayer.c
index c8d3c83bfa..f26a143e5a 100644
--- a/libgimp/gimplayer.c
+++ b/libgimp/gimplayer.c
@@ -25,10 +25,8 @@
#include "gimp.h"
-struct _GimpLayer
-{
- GimpDrawable parent_instance;
-};
+static GimpLayer * gimp_layer_real_copy (GimpLayer *layer);
+
G_DEFINE_TYPE (GimpLayer, gimp_layer, GIMP_TYPE_DRAWABLE)
@@ -38,6 +36,7 @@ G_DEFINE_TYPE (GimpLayer, gimp_layer, GIMP_TYPE_DRAWABLE)
static void
gimp_layer_class_init (GimpLayerClass *klass)
{
+ klass->copy = gimp_layer_real_copy;
}
static void
@@ -134,7 +133,7 @@ gimp_layer_new (GimpImage *image,
GimpLayer *
gimp_layer_copy (GimpLayer *layer)
{
- return _gimp_layer_copy (layer, FALSE);
+ return GIMP_LAYER_GET_CLASS (layer)->copy (layer);
}
/**
@@ -300,3 +299,12 @@ gimp_layer_new_from_surface (GimpImage *image,
return layer;
}
+
+
+/* private functions */
+
+static GimpLayer *
+gimp_layer_real_copy (GimpLayer *layer)
+{
+ return _gimp_layer_copy (layer, FALSE);
+}
diff --git a/libgimp/gimplayer.h b/libgimp/gimplayer.h
index ab05827aff..0dc7c410f1 100644
--- a/libgimp/gimplayer.h
+++ b/libgimp/gimplayer.h
@@ -31,8 +31,26 @@ G_BEGIN_DECLS
#define GIMP_TYPE_LAYER (gimp_layer_get_type ())
-G_DECLARE_FINAL_TYPE (GimpLayer, gimp_layer, GIMP, LAYER, GimpDrawable)
+G_DECLARE_DERIVABLE_TYPE (GimpLayer, gimp_layer, GIMP, LAYER, GimpDrawable)
+struct _GimpLayerClass
+{
+ GimpDrawableClass parent_class;
+
+ /* virtual functions */
+ GimpLayer * (* copy) (GimpLayer *layer);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+ void (*_gimp_reserved5) (void);
+ void (*_gimp_reserved6) (void);
+ void (*_gimp_reserved7) (void);
+ void (*_gimp_reserved8) (void);
+ void (*_gimp_reserved9) (void);
+};
GimpLayer * gimp_layer_get_by_id (gint32 layer_id);
diff --git a/libgimp/gimpparamspecs-body.c b/libgimp/gimpparamspecs-body.c
index 788aa9f7c7..598108e1a7 100644
--- a/libgimp/gimpparamspecs-body.c
+++ b/libgimp/gimpparamspecs-body.c
@@ -398,6 +398,86 @@ gimp_param_spec_layer (const gchar *name,
}
+/*
+ * GIMP_TYPE_PARAM_TEXT_LAYER
+ */
+
+static void gimp_param_text_layer_class_init (GParamSpecClass *klass);
+static void gimp_param_text_layer_init (GParamSpec *pspec);
+
+GType
+gimp_param_text_layer_get_type (void)
+{
+ static GType type = 0;
+
+ if (! type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (GParamSpecClass),
+ NULL, NULL,
+ (GClassInitFunc) gimp_param_text_layer_class_init,
+ NULL, NULL,
+ sizeof (GimpParamSpecTextLayer),
+ 0,
+ (GInstanceInitFunc) gimp_param_text_layer_init
+ };
+
+ type = g_type_register_static (GIMP_TYPE_PARAM_LAYER,
+ "GimpParamTextLayer", &info, 0);
+ }
+
+ return type;
+}
+
+static void
+gimp_param_text_layer_class_init (GParamSpecClass *klass)
+{
+ klass->value_type = GIMP_TYPE_TEXT_LAYER;
+}
+
+static void
+gimp_param_text_layer_init (GParamSpec *pspec)
+{
+}
+
+/**
+ * gimp_param_spec_text_layer:
+ * @name: Canonical name of the property specified.
+ * @nick: Nick name of the property specified.
+ * @blurb: Description of the property specified.
+ * @none_ok: Whether no is a valid value.
+ * @flags: Flags for the property specified.
+ *
+ * Creates a new #GimpParamSpecTextLayer specifying a
+ * #GIMP_TYPE_TEXT_LAYER property.
+ *
+ * See g_param_spec_internal() for details on property names.
+ *
+ * Returns: (transfer full): The newly created #GimpParamSpecTextLayer.
+ *
+ * Since: 3.0
+ **/
+GParamSpec *
+gimp_param_spec_text_layer (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gboolean none_ok,
+ GParamFlags flags)
+{
+ GimpParamSpecItem *ispec;
+
+ ispec = g_param_spec_internal (GIMP_TYPE_PARAM_TEXT_LAYER,
+ name, nick, blurb, flags);
+
+ g_return_val_if_fail (ispec, NULL);
+
+ ispec->none_ok = none_ok ? TRUE : FALSE;
+
+ return G_PARAM_SPEC (ispec);
+}
+
+
/*
* GIMP_TYPE_PARAM_CHANNEL
*/
diff --git a/libgimp/gimpparamspecs.h b/libgimp/gimpparamspecs.h
index f1bba739cc..e87314034d 100644
--- a/libgimp/gimpparamspecs.h
+++ b/libgimp/gimpparamspecs.h
@@ -142,6 +142,32 @@ GParamSpec * gimp_param_spec_layer (const gchar *name,
GParamFlags flags);
+/*
+ * GIMP_TYPE_PARAM_TEXT_LAYER
+ */
+
+#define GIMP_VALUE_HOLDS_TEXT_LAYER(value) (G_TYPE_CHECK_VALUE_TYPE ((value),\
+ GIMP_TYPE_TEXT_LAYER))
+
+#define GIMP_TYPE_PARAM_TEXT_LAYER (gimp_param_text_layer_get_type ())
+#define GIMP_PARAM_SPEC_TEXT_LAYER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec),
GIMP_TYPE_PARAM_TEXT_LAYER, GimpParamSpecTextLayer))
+#define GIMP_IS_PARAM_SPEC_TEXT_LAYER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec),
GIMP_TYPE_PARAM_TEXT_LAYER))
+
+typedef struct _GimpParamSpecTextLayer GimpParamSpecTextLayer;
+
+struct _GimpParamSpecTextLayer
+{
+ GimpParamSpecLayer parent_instance;
+};
+
+GType gimp_param_text_layer_get_type (void) G_GNUC_CONST;
+
+GParamSpec * gimp_param_spec_text_layer (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gboolean none_ok,
+ GParamFlags flags);
+
/*
* GIMP_TYPE_PARAM_CHANNEL
*/
diff --git a/libgimp/gimpplugin.c b/libgimp/gimpplugin.c
index 08baa91837..41f7833aba 100644
--- a/libgimp/gimpplugin.c
+++ b/libgimp/gimpplugin.c
@@ -1516,7 +1516,13 @@ _gimp_plug_in_get_item (GimpPlugIn *plug_in,
if (! item)
{
- if (gimp_item_id_is_layer (item_id))
+ if (gimp_item_id_is_text_layer (item_id))
+ {
+ item = g_object_new (GIMP_TYPE_TEXT_LAYER,
+ "id", item_id,
+ NULL);
+ }
+ else if (gimp_item_id_is_layer (item_id))
{
item = g_object_new (GIMP_TYPE_LAYER,
"id", item_id,
diff --git a/libgimp/gimpprocedure-params.h b/libgimp/gimpprocedure-params.h
index 246bc9e089..91df9e46c1 100644
--- a/libgimp/gimpprocedure-params.h
+++ b/libgimp/gimpprocedure-params.h
@@ -676,6 +676,36 @@ G_BEGIN_DECLS
g_value_set_object (gimp_value_array_index (args, n), value)
+/* text layer */
+
+#define GIMP_PROC_ARG_TEXT_LAYER(procedure, name, nick, blurb, none_ok, flags) \
+ gimp_procedure_add_argument (procedure,\
+ gimp_param_spec_text_layer (name, nick, blurb,\
+ none_ok,\
+ flags))
+
+#define GIMP_PROC_AUX_ARG_TEXT_LAYER(procedure, name, nick, blurb, none_ok, flags) \
+ gimp_procedure_add_aux_argument (procedure,\
+ gimp_param_spec_text_layer (name, nick, blurb,\
+ none_ok,\
+ flags))
+
+#define GIMP_PROC_VAL_TEXT_LAYER(procedure, name, nick, blurb, none_ok, flags) \
+ gimp_procedure_add_return_value (procedure,\
+ gimp_param_spec_text_layer (name, nick, blurb,\
+ none_ok,\
+ flags))
+
+#define GIMP_VALUES_GET_TEXT_LAYER(args, n) \
+ g_value_get_object (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_GET_TEXT_LAYER_ID(args, n) \
+ gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
+#define GIMP_VALUES_SET_TEXT_LAYER(args, n, value) \
+ g_value_set_object (gimp_value_array_index (args, n), value)
+
+
/* channel */
#define GIMP_PROC_ARG_CHANNEL(procedure, name, nick, blurb, none_ok, flags) \
diff --git a/libgimp/gimptextlayer.c b/libgimp/gimptextlayer.c
new file mode 100644
index 0000000000..26946cee0c
--- /dev/null
+++ b/libgimp/gimptextlayer.c
@@ -0,0 +1,140 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimptextlayer.c
+ * Copyright (C) 2022 Jehan
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+struct _GimpTextLayer
+{
+ GimpLayer parent_instance;
+};
+
+
+static GimpLayer * gimp_text_layer_copy (GimpLayer *layer);
+
+
+G_DEFINE_TYPE (GimpTextLayer, gimp_text_layer, GIMP_TYPE_LAYER)
+
+#define parent_class gimp_text_layer_parent_class
+
+
+static void
+gimp_text_layer_class_init (GimpTextLayerClass *klass)
+{
+ GimpLayerClass *layer_class = GIMP_LAYER_CLASS (klass);
+
+ layer_class->copy = gimp_text_layer_copy;
+}
+
+static void
+gimp_text_layer_init (GimpTextLayer *layer)
+{
+}
+
+
+/* Public API. */
+
+/**
+ * gimp_text_layer_get_by_id:
+ * @layer_id: The layer id.
+ *
+ * Returns a #GimpTextLayer representing @layer_id. This function calls
+ * gimp_item_get_by_id() and returns the item if it is layer or %NULL
+ * otherwise.
+ *
+ * Returns: (nullable) (transfer none): a #GimpTextLayer for @layer_id or
+ * %NULL if @layer_id does not represent a valid layer. The
+ * object belongs to libgimp and you must not modify or unref
+ * it.
+ *
+ * Since: 3.0
+ **/
+GimpTextLayer *
+gimp_text_layer_get_by_id (gint32 layer_id)
+{
+ GimpItem *item = gimp_item_get_by_id (layer_id);
+
+ if (GIMP_IS_TEXT_LAYER (item))
+ return (GimpTextLayer *) item;
+
+ return NULL;
+}
+
+/**
+ * gimp_text_layer_new:
+ * @image: The image to which to add the layer.
+ * @text: The text to generate (in UTF-8 encoding).
+ * @fontname: The name of the font.
+ * @size: The size of text in either pixels or points.
+ * @unit: The units of specified size.
+ *
+ * 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_insert_layer() command. Other
+ * attributes such as layer mask modes, and offsets should be set with explicit
+ * procedure calls.
+ *
+ * Returns: (transfer none): The newly created text layer.
+ * The object belongs to libgimp and you should not free it.
+ *
+ * Since: 3.0
+ */
+GimpTextLayer *
+gimp_text_layer_new (GimpImage *image,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit)
+{
+ return _gimp_text_layer_new (image, text, fontname, size, unit);
+}
+
+
+/* private functions */
+
+static GimpLayer *
+gimp_text_layer_copy (GimpLayer *layer)
+{
+ GimpTextLayer *new_layer;
+ gchar *text;
+ gchar *fontname;
+ gdouble size;
+ GimpUnit unit;
+
+ g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), NULL);
+
+ text = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer));
+ fontname = gimp_text_layer_get_font (GIMP_TEXT_LAYER (layer));
+ size = gimp_text_layer_get_font_size (GIMP_TEXT_LAYER (layer), &unit);
+ new_layer = gimp_text_layer_new (gimp_item_get_image (GIMP_ITEM (layer)),
+ text, fontname, size, unit);
+ g_free (text);
+ g_free (fontname);
+
+ return GIMP_LAYER (new_layer);
+}
diff --git a/libgimp/gimptextlayer.h b/libgimp/gimptextlayer.h
new file mode 100644
index 0000000000..2f25050952
--- /dev/null
+++ b/libgimp/gimptextlayer.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimptextlayer.h
+ * Copyright (C) 2022 Jehan
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_TEXT_LAYER_H__
+#define __GIMP_TEXT_LAYER_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_TEXT_LAYER (gimp_text_layer_get_type ())
+G_DECLARE_FINAL_TYPE (GimpTextLayer, gimp_text_layer, GIMP, TEXT_LAYER, GimpLayer)
+
+
+GimpTextLayer * gimp_text_layer_get_by_id (gint32 layer_id);
+
+GimpTextLayer * gimp_text_layer_new (GimpImage *image,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_TEXT_LAYER_H__ */
diff --git a/libgimp/gimptextlayer_pdb.c b/libgimp/gimptextlayer_pdb.c
index 9e50b8c426..e4c9a84daf 100644
--- a/libgimp/gimptextlayer_pdb.c
+++ b/libgimp/gimptextlayer_pdb.c
@@ -37,7 +37,7 @@
/**
- * gimp_text_layer_new:
+ * _gimp_text_layer_new:
* @image: The image.
* @text: The text to generate (in UTF-8 encoding).
* @fontname: The name of the font.
@@ -57,16 +57,16 @@
*
* Since: 2.6
**/
-GimpLayer *
-gimp_text_layer_new (GimpImage *image,
- const gchar *text,
- const gchar *fontname,
- gdouble size,
- GimpUnit unit)
+GimpTextLayer *
+_gimp_text_layer_new (GimpImage *image,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit)
{
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpLayer *layer = NULL;
+ GimpTextLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE, image,
@@ -82,7 +82,7 @@ gimp_text_layer_new (GimpImage *image,
gimp_value_array_unref (args);
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
- layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
+ layer = GIMP_VALUES_GET_TEXT_LAYER (return_vals, 1);
gimp_value_array_unref (return_vals);
@@ -103,14 +103,14 @@ gimp_text_layer_new (GimpImage *image,
* Since: 2.6
**/
gchar *
-gimp_text_layer_get_text (GimpLayer *layer)
+gimp_text_layer_get_text (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *text = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -140,15 +140,15 @@ gimp_text_layer_get_text (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_text (GimpLayer *layer,
- const gchar *text)
+gimp_text_layer_set_text (GimpTextLayer *layer,
+ const gchar *text)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_STRING, text,
G_TYPE_NONE);
@@ -182,14 +182,14 @@ gimp_text_layer_set_text (GimpLayer *layer,
* Since: 2.8
**/
gchar *
-gimp_text_layer_get_markup (GimpLayer *layer)
+gimp_text_layer_get_markup (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *markup = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -224,15 +224,15 @@ gimp_text_layer_get_markup (GimpLayer *layer)
* Since: 3.0
**/
gboolean
-gimp_text_layer_set_markup (GimpLayer *layer,
- const gchar *markup)
+gimp_text_layer_set_markup (GimpTextLayer *layer,
+ const gchar *markup)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_STRING, markup,
G_TYPE_NONE);
@@ -263,14 +263,14 @@ gimp_text_layer_set_markup (GimpLayer *layer,
* Since: 2.6
**/
gchar *
-gimp_text_layer_get_font (GimpLayer *layer)
+gimp_text_layer_get_font (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *font = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -300,15 +300,15 @@ gimp_text_layer_get_font (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_font (GimpLayer *layer,
- const gchar *font)
+gimp_text_layer_set_font (GimpTextLayer *layer,
+ const gchar *font)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_STRING, font,
G_TYPE_NONE);
@@ -340,15 +340,15 @@ gimp_text_layer_set_font (GimpLayer *layer,
* Since: 2.6
**/
gdouble
-gimp_text_layer_get_font_size (GimpLayer *layer,
- GimpUnit *unit)
+gimp_text_layer_get_font_size (GimpTextLayer *layer,
+ GimpUnit *unit)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gdouble font_size = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -383,16 +383,16 @@ gimp_text_layer_get_font_size (GimpLayer *layer,
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_font_size (GimpLayer *layer,
- gdouble font_size,
- GimpUnit unit)
+gimp_text_layer_set_font_size (GimpTextLayer *layer,
+ gdouble font_size,
+ GimpUnit unit)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_DOUBLE, font_size,
GIMP_TYPE_UNIT, unit,
G_TYPE_NONE);
@@ -423,14 +423,14 @@ gimp_text_layer_set_font_size (GimpLayer *layer,
* Since: 2.6
**/
gboolean
-gimp_text_layer_get_antialias (GimpLayer *layer)
+gimp_text_layer_get_antialias (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean antialias = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -461,15 +461,15 @@ gimp_text_layer_get_antialias (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_antialias (GimpLayer *layer,
- gboolean antialias)
+gimp_text_layer_set_antialias (GimpTextLayer *layer,
+ gboolean antialias)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_BOOLEAN, antialias,
G_TYPE_NONE);
@@ -500,14 +500,14 @@ gimp_text_layer_set_antialias (GimpLayer *layer,
* Since: 2.8
**/
GimpTextHintStyle
-gimp_text_layer_get_hint_style (GimpLayer *layer)
+gimp_text_layer_get_hint_style (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
GimpTextHintStyle style = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -539,7 +539,7 @@ gimp_text_layer_get_hint_style (GimpLayer *layer)
* Since: 2.8
**/
gboolean
-gimp_text_layer_set_hint_style (GimpLayer *layer,
+gimp_text_layer_set_hint_style (GimpTextLayer *layer,
GimpTextHintStyle style)
{
GimpValueArray *args;
@@ -547,7 +547,7 @@ gimp_text_layer_set_hint_style (GimpLayer *layer,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
GIMP_TYPE_TEXT_HINT_STYLE, style,
G_TYPE_NONE);
@@ -577,14 +577,14 @@ gimp_text_layer_set_hint_style (GimpLayer *layer,
* Since: 2.6
**/
gboolean
-gimp_text_layer_get_kerning (GimpLayer *layer)
+gimp_text_layer_get_kerning (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean kerning = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -614,15 +614,15 @@ gimp_text_layer_get_kerning (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_kerning (GimpLayer *layer,
- gboolean kerning)
+gimp_text_layer_set_kerning (GimpTextLayer *layer,
+ gboolean kerning)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_BOOLEAN, kerning,
G_TYPE_NONE);
@@ -653,14 +653,14 @@ gimp_text_layer_set_kerning (GimpLayer *layer,
* Since: 2.6
**/
gchar *
-gimp_text_layer_get_language (GimpLayer *layer)
+gimp_text_layer_get_language (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *language = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -691,15 +691,15 @@ gimp_text_layer_get_language (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_language (GimpLayer *layer,
- const gchar *language)
+gimp_text_layer_set_language (GimpTextLayer *layer,
+ const gchar *language)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_STRING, language,
G_TYPE_NONE);
@@ -729,14 +729,14 @@ gimp_text_layer_set_language (GimpLayer *layer,
* Since: 2.6
**/
GimpTextDirection
-gimp_text_layer_get_base_direction (GimpLayer *layer)
+gimp_text_layer_get_base_direction (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
GimpTextDirection direction = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -767,7 +767,7 @@ gimp_text_layer_get_base_direction (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_base_direction (GimpLayer *layer,
+gimp_text_layer_set_base_direction (GimpTextLayer *layer,
GimpTextDirection direction)
{
GimpValueArray *args;
@@ -775,7 +775,7 @@ gimp_text_layer_set_base_direction (GimpLayer *layer,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
GIMP_TYPE_TEXT_DIRECTION, direction,
G_TYPE_NONE);
@@ -805,14 +805,14 @@ gimp_text_layer_set_base_direction (GimpLayer *layer,
* Since: 2.6
**/
GimpTextJustification
-gimp_text_layer_get_justification (GimpLayer *layer)
+gimp_text_layer_get_justification (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
GimpTextJustification justify = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -843,7 +843,7 @@ gimp_text_layer_get_justification (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_justification (GimpLayer *layer,
+gimp_text_layer_set_justification (GimpTextLayer *layer,
GimpTextJustification justify)
{
GimpValueArray *args;
@@ -851,7 +851,7 @@ gimp_text_layer_set_justification (GimpLayer *layer,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
GIMP_TYPE_TEXT_JUSTIFICATION, justify,
G_TYPE_NONE);
@@ -881,15 +881,15 @@ gimp_text_layer_set_justification (GimpLayer *layer,
* Since: 2.6
**/
gboolean
-gimp_text_layer_get_color (GimpLayer *layer,
- GimpRGB *color)
+gimp_text_layer_get_color (GimpTextLayer *layer,
+ GimpRGB *color)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -921,7 +921,7 @@ gimp_text_layer_get_color (GimpLayer *layer,
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_color (GimpLayer *layer,
+gimp_text_layer_set_color (GimpTextLayer *layer,
const GimpRGB *color)
{
GimpValueArray *args;
@@ -929,7 +929,7 @@ gimp_text_layer_set_color (GimpLayer *layer,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
GIMP_TYPE_RGB, color,
G_TYPE_NONE);
@@ -959,14 +959,14 @@ gimp_text_layer_set_color (GimpLayer *layer,
* Since: 2.6
**/
gdouble
-gimp_text_layer_get_indent (GimpLayer *layer)
+gimp_text_layer_get_indent (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gdouble indent = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -997,15 +997,15 @@ gimp_text_layer_get_indent (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_indent (GimpLayer *layer,
- gdouble indent)
+gimp_text_layer_set_indent (GimpTextLayer *layer,
+ gdouble indent)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_DOUBLE, indent,
G_TYPE_NONE);
@@ -1035,14 +1035,14 @@ gimp_text_layer_set_indent (GimpLayer *layer,
* Since: 2.6
**/
gdouble
-gimp_text_layer_get_line_spacing (GimpLayer *layer)
+gimp_text_layer_get_line_spacing (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gdouble line_spacing = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -1073,15 +1073,15 @@ gimp_text_layer_get_line_spacing (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_line_spacing (GimpLayer *layer,
- gdouble line_spacing)
+gimp_text_layer_set_line_spacing (GimpTextLayer *layer,
+ gdouble line_spacing)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_DOUBLE, line_spacing,
G_TYPE_NONE);
@@ -1111,14 +1111,14 @@ gimp_text_layer_set_line_spacing (GimpLayer *layer,
* Since: 2.6
**/
gdouble
-gimp_text_layer_get_letter_spacing (GimpLayer *layer)
+gimp_text_layer_get_letter_spacing (GimpTextLayer *layer)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gdouble letter_spacing = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -1149,15 +1149,15 @@ gimp_text_layer_get_letter_spacing (GimpLayer *layer)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_letter_spacing (GimpLayer *layer,
- gdouble letter_spacing)
+gimp_text_layer_set_letter_spacing (GimpTextLayer *layer,
+ gdouble letter_spacing)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_DOUBLE, letter_spacing,
G_TYPE_NONE);
@@ -1190,16 +1190,16 @@ gimp_text_layer_set_letter_spacing (GimpLayer *layer,
* Since: 2.8
**/
gboolean
-gimp_text_layer_resize (GimpLayer *layer,
- gdouble width,
- gdouble height)
+gimp_text_layer_resize (GimpTextLayer *layer,
+ gdouble width,
+ gdouble height)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER, layer,
+ GIMP_TYPE_TEXT_LAYER, layer,
G_TYPE_DOUBLE, width,
G_TYPE_DOUBLE, height,
G_TYPE_NONE);
diff --git a/libgimp/gimptextlayer_pdb.h b/libgimp/gimptextlayer_pdb.h
index 14785c26e9..c41ef8a7b0 100644
--- a/libgimp/gimptextlayer_pdb.h
+++ b/libgimp/gimptextlayer_pdb.h
@@ -32,59 +32,59 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-GimpLayer* gimp_text_layer_new (GimpImage *image,
- const gchar *text,
- const gchar *fontname,
- gdouble size,
- GimpUnit unit);
-gchar* gimp_text_layer_get_text (GimpLayer *layer);
-gboolean gimp_text_layer_set_text (GimpLayer *layer,
- const gchar *text);
-gchar* gimp_text_layer_get_markup (GimpLayer *layer);
-gboolean gimp_text_layer_set_markup (GimpLayer *layer,
- const gchar *markup);
-gchar* gimp_text_layer_get_font (GimpLayer *layer);
-gboolean gimp_text_layer_set_font (GimpLayer *layer,
- const gchar *font);
-gdouble gimp_text_layer_get_font_size (GimpLayer *layer,
- GimpUnit *unit);
-gboolean gimp_text_layer_set_font_size (GimpLayer *layer,
- gdouble font_size,
- GimpUnit unit);
-gboolean gimp_text_layer_get_antialias (GimpLayer *layer);
-gboolean gimp_text_layer_set_antialias (GimpLayer *layer,
- gboolean antialias);
-GimpTextHintStyle gimp_text_layer_get_hint_style (GimpLayer *layer);
-gboolean gimp_text_layer_set_hint_style (GimpLayer *layer,
- GimpTextHintStyle style);
-gboolean gimp_text_layer_get_kerning (GimpLayer *layer);
-gboolean gimp_text_layer_set_kerning (GimpLayer *layer,
- gboolean kerning);
-gchar* gimp_text_layer_get_language (GimpLayer *layer);
-gboolean gimp_text_layer_set_language (GimpLayer *layer,
- const gchar *language);
-GimpTextDirection gimp_text_layer_get_base_direction (GimpLayer *layer);
-gboolean gimp_text_layer_set_base_direction (GimpLayer *layer,
- GimpTextDirection direction);
-GimpTextJustification gimp_text_layer_get_justification (GimpLayer *layer);
-gboolean gimp_text_layer_set_justification (GimpLayer *layer,
- GimpTextJustification justify);
-gboolean gimp_text_layer_get_color (GimpLayer *layer,
- GimpRGB *color);
-gboolean gimp_text_layer_set_color (GimpLayer *layer,
- const GimpRGB *color);
-gdouble gimp_text_layer_get_indent (GimpLayer *layer);
-gboolean gimp_text_layer_set_indent (GimpLayer *layer,
- gdouble indent);
-gdouble gimp_text_layer_get_line_spacing (GimpLayer *layer);
-gboolean gimp_text_layer_set_line_spacing (GimpLayer *layer,
- gdouble line_spacing);
-gdouble gimp_text_layer_get_letter_spacing (GimpLayer *layer);
-gboolean gimp_text_layer_set_letter_spacing (GimpLayer *layer,
- gdouble letter_spacing);
-gboolean gimp_text_layer_resize (GimpLayer *layer,
- gdouble width,
- gdouble height);
+G_GNUC_INTERNAL GimpTextLayer* _gimp_text_layer_new (GimpImage *image,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit);
+gchar* gimp_text_layer_get_text (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_text (GimpTextLayer *layer,
+ const gchar *text);
+gchar* gimp_text_layer_get_markup (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_markup (GimpTextLayer *layer,
+ const gchar *markup);
+gchar* gimp_text_layer_get_font (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_font (GimpTextLayer *layer,
+ const gchar *font);
+gdouble gimp_text_layer_get_font_size (GimpTextLayer *layer,
+ GimpUnit *unit);
+gboolean gimp_text_layer_set_font_size (GimpTextLayer *layer,
+ gdouble font_size,
+ GimpUnit unit);
+gboolean gimp_text_layer_get_antialias (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_antialias (GimpTextLayer *layer,
+ gboolean antialias);
+GimpTextHintStyle gimp_text_layer_get_hint_style (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_hint_style (GimpTextLayer *layer,
+ GimpTextHintStyle style);
+gboolean gimp_text_layer_get_kerning (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_kerning (GimpTextLayer *layer,
+ gboolean kerning);
+gchar* gimp_text_layer_get_language (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_language (GimpTextLayer *layer,
+ const gchar *language);
+GimpTextDirection gimp_text_layer_get_base_direction (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_base_direction (GimpTextLayer *layer,
+ GimpTextDirection direction);
+GimpTextJustification gimp_text_layer_get_justification (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_justification (GimpTextLayer *layer,
+ GimpTextJustification justify);
+gboolean gimp_text_layer_get_color (GimpTextLayer *layer,
+ GimpRGB *color);
+gboolean gimp_text_layer_set_color (GimpTextLayer *layer,
+ const GimpRGB *color);
+gdouble gimp_text_layer_get_indent (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_indent (GimpTextLayer *layer,
+ gdouble indent);
+gdouble gimp_text_layer_get_line_spacing (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_line_spacing (GimpTextLayer *layer,
+ gdouble line_spacing);
+gdouble gimp_text_layer_get_letter_spacing (GimpTextLayer *layer);
+gboolean gimp_text_layer_set_letter_spacing (GimpTextLayer *layer,
+ gdouble letter_spacing);
+gboolean gimp_text_layer_resize (GimpTextLayer *layer,
+ gdouble width,
+ gdouble height);
G_END_DECLS
diff --git a/libgimp/gimptypes.h b/libgimp/gimptypes.h
index ad5b06523e..a6b8fbea4f 100644
--- a/libgimp/gimptypes.h
+++ b/libgimp/gimptypes.h
@@ -40,6 +40,7 @@ typedef struct _GimpLayer GimpLayer;
typedef struct _GimpChannel GimpChannel;
typedef struct _GimpLayerMask GimpLayerMask;
typedef struct _GimpSelection GimpSelection;
+typedef struct _GimpTextLayer GimpTextLayer;
typedef struct _GimpVectors GimpVectors;
typedef struct _GimpDisplay GimpDisplay;
diff --git a/libgimp/meson.build b/libgimp/meson.build
index ca5fbff262..82a91e42b9 100644
--- a/libgimp/meson.build
+++ b/libgimp/meson.build
@@ -191,6 +191,7 @@ libgimp_sources_introspectable = [
'gimpprogress.c',
'gimpsaveprocedure.c',
'gimpselection.c',
+ 'gimptextlayer.c',
'gimpthumbnailprocedure.c',
'gimpvectors.c',
gimpenums,
@@ -246,6 +247,7 @@ libgimp_headers_introspectable = [
'gimpprogress.h',
'gimpsaveprocedure.h',
'gimpselection.h',
+ 'gimptextlayer.h',
'gimpthumbnailprocedure.h',
'gimpvectors.h',
pdb_wrappers_headers,
diff --git a/pdb/app.pl b/pdb/app.pl
index d1d4428782..3a6296afc3 100644
--- a/pdb/app.pl
+++ b/pdb/app.pl
@@ -257,6 +257,16 @@ gimp_param_spec_drawable ("$name",
"$blurb",
$none_ok,
$flags)
+CODE
+ }
+ elsif ($pdbtype eq 'text_layer') {
+ $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
+ $pspec = <<CODE;
+gimp_param_spec_text_layer ("$name",
+ "$nick",
+ "$blurb",
+ $none_ok,
+ $flags)
CODE
}
elsif ($pdbtype eq 'layer') {
diff --git a/pdb/groups/text_layer.pdb b/pdb/groups/text_layer.pdb
index 47b85da5c8..37209315d7 100644
--- a/pdb/groups/text_layer.pdb
+++ b/pdb/groups/text_layer.pdb
@@ -31,6 +31,8 @@ HELP
&marcus_pdb_misc('2008', '2.6');
+ $lib_private = 1;
+
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
@@ -45,7 +47,7 @@ HELP
);
@outargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The new text layer.' }
);
@@ -65,7 +67,7 @@ HELP
"color", &color,
NULL);
- layer = gimp_text_layer_new (image, gimp_text);
+ layer = GIMP_TEXT_LAYER (gimp_text_layer_new (image, gimp_text));
g_object_unref (gimp_text);
if (! layer)
@@ -90,7 +92,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' }
);
@@ -102,16 +104,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "text", &text,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "text", &text,
+ NULL);
}
CODE
);
@@ -127,7 +122,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'text', type => 'string',
desc => 'The new text to set' }
@@ -136,17 +131,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "text", text,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "text", text,
+ NULL);
}
CODE
);
@@ -164,7 +152,7 @@ HELP
barak_pdb_misc('2010', '2.8');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' }
);
@@ -176,16 +164,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "markup", &markup,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "markup", &markup,
+ NULL);
}
CODE
);
@@ -210,7 +191,7 @@ HELP
$since = '3.0';
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'markup', type => 'string',
desc => 'The new markup to set' }
@@ -219,35 +200,28 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ gchar *markup_cat = NULL;
+ const gchar *markup_ptr = markup;
+
+ if (strstr(markup, "<markup>") == NULL || strstr(markup, "</markup>") == NULL)
+ {
+ markup_cat = g_strconcat("<markup>", markup, "</markup>", NULL);
+ markup_ptr = markup_cat;
+ }
+
+ if (pango_parse_markup (markup_ptr, -1, 0, NULL, NULL, NULL, error))
{
- gchar *markup_cat = NULL;
- const gchar *markup_ptr = markup;
-
- if (strstr(markup, "<markup>") == NULL || strstr(markup, "</markup>") == NULL)
- {
- markup_cat = g_strconcat("<markup>", markup, "</markup>", NULL);
- markup_ptr = markup_cat;
- }
-
- if (pango_parse_markup (markup_ptr, -1, 0, NULL, NULL, NULL, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer markup"),
- "markup", markup_ptr,
- NULL);
- }
- else
- {
- success = FALSE;
- }
-
- g_free(markup_cat);
+ gimp_text_layer_set (layer,
+ _("Set text layer markup"),
+ "markup", markup_ptr,
+ NULL);
}
else
{
success = FALSE;
}
+
+ g_free(markup_cat);
}
CODE
);
@@ -263,7 +237,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' }
);
@@ -275,16 +249,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "font", &font,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "font", &font,
+ NULL);
}
CODE
);
@@ -300,7 +267,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'font', type => 'string',
desc => 'The new font to use' }
@@ -309,17 +276,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "font", font,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "font", font,
+ NULL);
}
CODE
);
@@ -337,7 +297,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' }
);
@@ -351,17 +311,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "font-size", &font_size,
- "font-size-unit", &unit,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "font-size", &font_size,
+ "font-size-unit", &unit,
+ NULL);
}
CODE
);
@@ -378,7 +331,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'font_size', type => '0.0 <= float <= 8192.0',
desc => 'The font size' },
@@ -389,18 +342,11 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "font-size-unit", unit,
- "font-size", font_size,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "font-size-unit", unit,
+ "font-size", font_size,
+ NULL);
}
CODE
);
@@ -416,7 +362,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' }
);
@@ -428,16 +374,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "antialias", &antialias,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "antialias", &antialias,
+ NULL);
}
CODE
);
@@ -453,7 +392,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'antialias', type => 'boolean',
desc => 'Enable/disable antialiasing of the text' }
@@ -462,17 +401,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "antialias", antialias,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "antialias", antialias,
+ NULL);
}
CODE
);
@@ -490,7 +422,7 @@ HELP
&marcus_pdb_misc('2008', '2.8');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' }
);
@@ -502,16 +434,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "hint-style", &style,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "hint-style", &style,
+ NULL);
}
CODE
);
@@ -529,7 +454,7 @@ HELP
&neo_pdb_misc('2008', '2.8');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'style', type => 'enum GimpTextHintStyle',
desc => 'The new hint style' }
@@ -538,17 +463,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "hint-style", style,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "hint-style", style,
+ NULL);
}
CODE
);
@@ -564,7 +482,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' }
);
@@ -576,16 +494,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "kerning", &kerning,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "kerning", &kerning,
+ NULL);
}
CODE
);
@@ -601,7 +512,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'kerning', type => 'boolean',
desc => 'Enable/disable kerning in the text' }
@@ -610,17 +521,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "kerning", kerning,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "kerning", kerning,
+ NULL);
}
CODE
);
@@ -637,7 +541,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer.' }
);
@@ -649,16 +553,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "language", &language,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "language", &language,
+ NULL);
}
CODE
);
@@ -675,7 +572,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'language', type => 'string',
desc => 'The new language to use for the text layer' }
@@ -684,17 +581,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "language", language,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "language", language,
+ NULL);
}
CODE
);
@@ -711,7 +601,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer.' }
);
@@ -723,16 +613,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "base-direction", &direction,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "base-direction", &direction,
+ NULL);
}
CODE
);
@@ -749,7 +632,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'direction', type => 'enum GimpTextDirection',
desc => 'The base direction of the text.' }
@@ -758,17 +641,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "base-direction", direction,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "base-direction", direction,
+ NULL);
}
CODE
);
@@ -785,7 +661,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer.' }
);
@@ -797,16 +673,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "justify", &justify,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "justify", &justify,
+ NULL);
}
CODE
);
@@ -823,7 +692,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'justify', type => 'enum GimpTextJustification',
desc => 'The justification for your text.' }
@@ -832,17 +701,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "justify", justify,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "justify", justify,
+ NULL);
}
CODE
);
@@ -858,7 +720,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer.' }
);
@@ -870,14 +732,7 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- color = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer))->color;
- }
- else
- {
- success = FALSE;
- }
+ color = gimp_text_layer_get_text (layer)->color;
}
CODE
);
@@ -893,7 +748,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'color', type => 'color',
desc => 'The color to use for the text' }
@@ -902,17 +757,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "color", &color,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "color", &color,
+ NULL);
}
CODE
);
@@ -928,7 +776,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer.' }
);
@@ -940,16 +788,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "indent", &indent,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "indent", &indent,
+ NULL);
}
CODE
);
@@ -965,7 +806,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'indent', type => '-8192.0 <= float <= 8192.0',
desc => 'The indentation for the first line.' }
@@ -974,17 +815,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "indent", indent,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "indent", indent,
+ NULL);
}
CODE
);
@@ -1000,7 +834,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer.' }
);
@@ -1012,16 +846,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "line-spacing", &line_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "line-spacing", &line_spacing,
+ NULL);
}
CODE
);
@@ -1037,7 +864,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'line_spacing', type => '-8192.0 <= float <= 8192.0',
desc => 'The additional line spacing to use.' }
@@ -1046,17 +873,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "line-spacing", line_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "line-spacing", line_spacing,
+ NULL);
}
CODE
);
@@ -1073,7 +893,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer.' }
);
@@ -1085,16 +905,9 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, 0, error))
- {
- g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
- "letter-spacing", &letter_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ g_object_get (gimp_text_layer_get_text (layer),
+ "letter-spacing", &letter_spacing,
+ NULL);
}
CODE
);
@@ -1111,7 +924,7 @@ HELP
&marcus_pdb_misc('2008', '2.6');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'letter_spacing', type => '-8192.0 <= float <= 8192.0',
desc => 'The additional letter spacing to use.' }
@@ -1120,17 +933,10 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "letter-spacing", letter_spacing,
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "letter-spacing", letter_spacing,
+ NULL);
}
CODE
);
@@ -1148,7 +954,7 @@ HELP
barak_pdb_misc('2009', '2.8');
@inargs = (
- { name => 'layer', type => 'layer',
+ { name => 'layer', type => 'text_layer',
desc => 'The text layer' },
{ name => 'width', type => '0.0 <= float <= GIMP_MAX_IMAGE_SIZE',
desc => 'The new box width in pixels' },
@@ -1159,29 +965,22 @@ HELP
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
- {
- GimpText *text = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer));
- gdouble xres, yres;
-
- gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
- &xres, &yres);
-
- gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
- _("Set text layer attribute"),
- "box-mode", GIMP_TEXT_BOX_FIXED,
- "box-width", gimp_pixels_to_units (width,
- text->box_unit,
- xres),
- "box-height", gimp_pixels_to_units (height,
- text->box_unit,
- yres),
- NULL);
- }
- else
- {
- success = FALSE;
- }
+ GimpText *text = gimp_text_layer_get_text (layer);
+ gdouble xres, yres;
+
+ gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
+ &xres, &yres);
+
+ gimp_text_layer_set (layer,
+ _("Set text layer attribute"),
+ "box-mode", GIMP_TEXT_BOX_FIXED,
+ "box-width", gimp_pixels_to_units (width,
+ text->box_unit,
+ xres),
+ "box-height", gimp_pixels_to_units (height,
+ text->box_unit,
+ yres),
+ NULL);
}
CODE
);
diff --git a/pdb/pdb.pl b/pdb/pdb.pl
index 49ca705902..af8dc1b9fe 100644
--- a/pdb/pdb.pl
+++ b/pdb/pdb.pl
@@ -248,6 +248,18 @@ package Gimp::CodeGen::pdb;
take_value_func => 'g_value_set_object ($value, $var)',
headers => [ qw("core/gimplayer.h") ] },
+ text_layer => { name => 'TEXT_LAYER',
+ gtype => 'GIMP_TYPE_TEXT_LAYER',
+ type => 'GimpTextLayer *',
+ const_type => 'GimpTextLayer *',
+ init_value => 'NULL',
+ out_annotate => '(transfer none)',
+ get_value_func => '$var = g_value_get_object ($value)',
+ dup_value_func => '$var = GIMP_VALUES_GET_TEXT_LAYER ($value)',
+ set_value_func => 'g_value_set_object ($value, $var)',
+ take_value_func => 'g_value_set_object ($value, $var)',
+ headers => [ qw("text/gimptextlayer.h") ] },
+
channel => { name => 'CHANNEL',
gtype => 'GIMP_TYPE_CHANNEL',
type => 'GimpChannel *',
diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c
index 2f562ed70f..19626d1681 100644
--- a/plug-ins/common/file-pdf-save.c
+++ b/plug-ins/common/file-pdf-save.c
@@ -648,7 +648,7 @@ get_missing_fonts (GList *layers)
fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
context = pango_font_map_create_context (fontmap);
- font_family = gimp_text_layer_get_font (layer);
+ font_family = gimp_text_layer_get_font (GIMP_TEXT_LAYER (layer));
font_description = pango_font_description_from_string (font_family);
font = pango_font_map_load_font (fontmap, context, font_description);
@@ -1583,8 +1583,8 @@ drawText (GimpLayer *layer,
gdouble y_res)
{
GimpImageType type = gimp_drawable_type (GIMP_DRAWABLE (layer));
- gchar *text = gimp_text_layer_get_text (layer);
- gchar *markup = gimp_text_layer_get_markup (layer);
+ gchar *text = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer));
+ gchar *markup = gimp_text_layer_get_markup (GIMP_TEXT_LAYER (layer));
gchar *font_family;
gchar *language;
cairo_font_options_t *options;
@@ -1622,7 +1622,7 @@ drawText (GimpLayer *layer,
/* When dealing with a gray/indexed image, the viewed color of the text layer
* can be different than the one kept in the memory */
if (type == GIMP_RGBA_IMAGE)
- gimp_text_layer_get_color (layer, &color);
+ gimp_text_layer_get_color (GIMP_TEXT_LAYER (layer), &color);
else
gimp_image_pick_color (gimp_item_get_image (GIMP_ITEM (layer)), 1,
(const GimpItem**) &layer, x, y, FALSE, FALSE, 0,
@@ -1631,7 +1631,7 @@ drawText (GimpLayer *layer,
cairo_set_source_rgba (cr, color.r, color.g, color.b, opacity);
/* Hinting */
- hinting = gimp_text_layer_get_hint_style (layer);
+ hinting = gimp_text_layer_get_hint_style (GIMP_TEXT_LAYER (layer));
switch (hinting)
{
case GIMP_TEXT_HINT_STYLE_NONE:
@@ -1652,7 +1652,7 @@ drawText (GimpLayer *layer,
}
/* Antialiasing */
- if (gimp_text_layer_get_antialias (layer))
+ if (gimp_text_layer_get_antialias (GIMP_TEXT_LAYER (layer)))
cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_DEFAULT);
else
cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_NONE);
@@ -1670,13 +1670,13 @@ drawText (GimpLayer *layer,
pango_cairo_context_set_font_options (context, options);
/* Language */
- language = gimp_text_layer_get_language (layer);
+ language = gimp_text_layer_get_language (GIMP_TEXT_LAYER (layer));
if (language)
pango_context_set_language (context,
pango_language_from_string(language));
/* Text Direction */
- dir = gimp_text_layer_get_base_direction (layer);
+ dir = gimp_text_layer_get_base_direction (GIMP_TEXT_LAYER (layer));
switch (dir)
{
@@ -1724,7 +1724,7 @@ drawText (GimpLayer *layer,
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
/* Font */
- font_family = gimp_text_layer_get_font (layer);
+ font_family = gimp_text_layer_get_font (GIMP_TEXT_LAYER (layer));
/* We need to find a way to convert GIMP's returned font name to a
* normal Pango name... Hopefully GIMP 2.8 with Pango will fix it.
@@ -1732,7 +1732,7 @@ drawText (GimpLayer *layer,
font_description = pango_font_description_from_string (font_family);
/* Font Size */
- size = gimp_text_layer_get_font_size (layer, &unit);
+ size = gimp_text_layer_get_font_size (GIMP_TEXT_LAYER (layer), &unit);
size = gimp_units_to_pixels (size, unit, y_res);
pango_font_description_set_absolute_size (font_description, size * PANGO_SCALE);
@@ -1750,7 +1750,7 @@ drawText (GimpLayer *layer,
/* Justification, and Alignment */
justify = FALSE;
- j = gimp_text_layer_get_justification (layer);
+ j = gimp_text_layer_get_justification (GIMP_TEXT_LAYER (layer));
align = PANGO_ALIGN_LEFT;
switch (j)
{
@@ -1772,15 +1772,15 @@ drawText (GimpLayer *layer,
pango_layout_set_justify (layout, justify);
/* Indentation */
- indent = gimp_text_layer_get_indent (layer);
+ indent = gimp_text_layer_get_indent (GIMP_TEXT_LAYER (layer));
pango_layout_set_indent (layout, (int)(PANGO_SCALE * indent));
/* Line Spacing */
- line_spacing = gimp_text_layer_get_line_spacing (layer);
+ line_spacing = gimp_text_layer_get_line_spacing (GIMP_TEXT_LAYER (layer));
pango_layout_set_spacing (layout, (int)(PANGO_SCALE * line_spacing));
/* Letter Spacing */
- letter_spacing = gimp_text_layer_get_letter_spacing (layer);
+ letter_spacing = gimp_text_layer_get_letter_spacing (GIMP_TEXT_LAYER (layer));
letter_spacing_at = pango_attr_letter_spacing_new ((int)(PANGO_SCALE * letter_spacing));
pango_attr_list_insert (attr_list, letter_spacing_at);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]