gimptextlayer_pdb.c 41 KB
Newer Older
1 2 3 4 5
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimptextlayer_pdb.c
 *
6
 * This library is free software: you can redistribute it and/or
7 8
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
9
 * version 3 of the License, or (at your option) any later version.
10 11 12 13 14 15 16
 *
 * 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
17
 * License along with this library.  If not, see
18
 * <https://www.gnu.org/licenses/>.
19 20 21 22 23 24 25 26
 */

/* NOTE: This file is auto-generated by pdbgen.pl */

#include "config.h"

#include "gimp.h"

27 28

/**
29
 * SECTION: gimptextlayer
30 31 32 33 34 35 36
 * @title: gimptextlayer
 * @short_description: Functions for querying and manipulating text layers.
 *
 * Functions for querying and manipulating text layers.
 **/


37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
/**
 * gimp_text_layer_new:
 * @image_ID: The image.
 * @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.
 *
 * Creates a new text layer.
 *
 * This procedure creates a new text layer. The arguments are kept as
 * simple as necessary for the normal case. All text attributes,
 * however, can be modified with the appropriate
 * gimp_text_layer_set_*() procedures. The new layer still needs to be
 * added to the image, as this is not automatic. Add the new layer
52
 * using gimp_image_insert_layer().
53 54 55
 *
 * Returns: The new text layer.
 *
56
 * Since: 2.6
57
 **/
58 59 60 61 62 63 64
gint32
gimp_text_layer_new (gint32       image_ID,
                     const gchar *text,
                     const gchar *fontname,
                     gdouble      size,
                     GimpUnit     unit)
{
65
  GimpPDB        *pdb = gimp_get_pdb ();
66 67
  GimpValueArray *args;
  GimpValueArray *return_vals;
68 69
  gint32 layer_ID = -1;

70 71 72 73 74 75 76 77 78 79 80
  args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
                                          G_TYPE_STRING,
                                          G_TYPE_STRING,
                                          G_TYPE_DOUBLE,
                                          GIMP_TYPE_UNIT,
                                          G_TYPE_NONE);
  gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
  g_value_set_string (gimp_value_array_index (args, 1), text);
  g_value_set_string (gimp_value_array_index (args, 2), fontname);
  g_value_set_double (gimp_value_array_index (args, 3), size);
  g_value_set_int (gimp_value_array_index (args, 4), unit);
81

82 83 84 85 86
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-new",
                                                args);
  else
87 88
    return_vals = gimp_run_procedure_array ("gimp-text-layer-new",
                                            args);
89
  gimp_value_array_unref (args);
90

91 92 93 94
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));

  gimp_value_array_unref (return_vals);
95 96 97 98 99

  return layer_ID;
}

/**
100
 * gimp_text_layer_get_text:
101 102
 * @layer_ID: The text layer.
 *
103
 * Get the text from a text layer as string.
104
 *
105
 * This procedure returns the text from a text layer as a string.
106
 *
107
 * Returns: (transfer full): The text from the specified text layer.
108
 *          The returned value must be freed with g_free().
109
 *
110
 * Since: 2.6
111
 **/
112 113
gchar *
gimp_text_layer_get_text (gint32 layer_ID)
114
{
115
  GimpPDB        *pdb = gimp_get_pdb ();
116 117
  GimpValueArray *args;
  GimpValueArray *return_vals;
118
  gchar *text = NULL;
119

120 121 122 123
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);

124 125 126 127 128
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-text",
                                                args);
  else
129 130
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-text",
                                            args);
131
  gimp_value_array_unref (args);
132

133 134
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    text = g_value_dup_string (gimp_value_array_index (return_vals, 1));
135

136
  gimp_value_array_unref (return_vals);
137

138
  return text;
139 140 141
}

/**
142
 * gimp_text_layer_set_text:
143
 * @layer_ID: The text layer.
144
 * @text: The new text to set.
145
 *
146
 * Set the text of a text layer.
147
 *
148
 * This procedure changes the text of a text layer.
149 150 151
 *
 * Returns: TRUE on success.
 *
152
 * Since: 2.6
153
 **/
154
gboolean
155 156
gimp_text_layer_set_text (gint32       layer_ID,
                          const gchar *text)
157
{
158
  GimpPDB        *pdb = gimp_get_pdb ();
159 160
  GimpValueArray *args;
  GimpValueArray *return_vals;
161 162
  gboolean success = TRUE;

163 164 165 166 167
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_STRING,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_string (gimp_value_array_index (args, 1), text);
168

169 170 171 172 173
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-text",
                                                args);
  else
174 175
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-text",
                                            args);
176
  gimp_value_array_unref (args);
177

178 179 180
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;

  gimp_value_array_unref (return_vals);
181 182 183 184

  return success;
}

185 186 187 188 189 190 191 192
/**
 * gimp_text_layer_get_markup:
 * @layer_ID: The text layer.
 *
 * Get the markup from a text layer as string.
 *
 * This procedure returns the markup of the styles from a text layer.
 * The markup will be in the form of Pango's markup - See
193
 * https://www.pango.org/ for more information about Pango and its
194 195 196
 * markup. Note: Setting the markup of a text layer using Pango's
 * markup is not supported for now.
 *
197 198 199
 * Returns: (transfer full):
 *          The markup which represents the style of the specified text layer.
 *          The returned value must be freed with g_free().
200
 *
201
 * Since: 2.8
202
 **/
203 204 205
gchar *
gimp_text_layer_get_markup (gint32 layer_ID)
{
206
  GimpPDB        *pdb = gimp_get_pdb ();
207 208
  GimpValueArray *args;
  GimpValueArray *return_vals;
209 210
  gchar *markup = NULL;

211 212 213 214
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);

215 216 217 218 219
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-markup",
                                                args);
  else
220 221
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-markup",
                                            args);
222
  gimp_value_array_unref (args);
223

224 225
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    markup = g_value_dup_string (gimp_value_array_index (return_vals, 1));
226

227
  gimp_value_array_unref (return_vals);
228 229 230 231

  return markup;
}

232
/**
233
 * gimp_text_layer_get_font:
234 235
 * @layer_ID: The text layer.
 *
236
 * Get the font from a text layer as string.
237
 *
238
 * This procedure returns the name of the font from a text layer.
239
 *
240 241 242
 * Returns: (transfer full):
 *          The font which is used in the specified text layer.
 *          The returned value must be freed with g_free().
243
 *
244
 * Since: 2.6
245
 **/
246 247
gchar *
gimp_text_layer_get_font (gint32 layer_ID)
248
{
249
  GimpPDB        *pdb = gimp_get_pdb ();
250 251
  GimpValueArray *args;
  GimpValueArray *return_vals;
252
  gchar *font = NULL;
253

254 255 256
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
257

258 259 260 261 262
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-font",
                                                args);
  else
263 264
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font",
                                            args);
265
  gimp_value_array_unref (args);
266

267 268 269 270
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    font = g_value_dup_string (gimp_value_array_index (return_vals, 1));

  gimp_value_array_unref (return_vals);
271

272
  return font;
273 274 275
}

/**
276
 * gimp_text_layer_set_font:
277
 * @layer_ID: The text layer.
278
 * @font: The new font to use.
279
 *
280
 * Set the font of a text layer.
281
 *
282
 * This procedure modifies the font used in the specified text layer.
283 284 285
 *
 * Returns: TRUE on success.
 *
286
 * Since: 2.6
287
 **/
288
gboolean
289 290
gimp_text_layer_set_font (gint32       layer_ID,
                          const gchar *font)
291
{
292
  GimpPDB        *pdb = gimp_get_pdb ();
293 294
  GimpValueArray *args;
  GimpValueArray *return_vals;
295 296
  gboolean success = TRUE;

297 298 299 300 301 302
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_STRING,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_string (gimp_value_array_index (args, 1), font);

303 304 305 306 307
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-font",
                                                args);
  else
308 309
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font",
                                            args);
310
  gimp_value_array_unref (args);
311

312
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
313

314
  gimp_value_array_unref (return_vals);
315 316 317 318 319

  return success;
}

/**
320
 * gimp_text_layer_get_font_size:
321
 * @layer_ID: The text layer.
322
 * @unit: (out) (transfer none): The unit used for the font size.
323
 *
324
 * Get the font size from a text layer.
325
 *
326 327 328
 * This procedure returns the size of the font which is used in a text
 * layer. You will receive the size as a float 'font-size' in 'unit'
 * units.
329
 *
330
 * Returns: The font size.
331
 *
332
 * Since: 2.6
333
 **/
334 335 336
gdouble
gimp_text_layer_get_font_size (gint32    layer_ID,
                               GimpUnit *unit)
337
{
338
  GimpPDB        *pdb = gimp_get_pdb ();
339 340
  GimpValueArray *args;
  GimpValueArray *return_vals;
341
  gdouble font_size = 0.0;
342

343 344 345
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
346

347 348 349 350 351
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-font-size",
                                                args);
  else
352 353
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font-size",
                                            args);
354 355 356
  gimp_value_array_unref (args);

  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
357
    {
358 359
      font_size = g_value_get_double (gimp_value_array_index (return_vals, 1));
      *unit = g_value_get_int (gimp_value_array_index (return_vals, 2));
360
    }
361

362
  gimp_value_array_unref (return_vals);
363

364
  return font_size;
365 366 367
}

/**
368
 * gimp_text_layer_set_font_size:
369
 * @layer_ID: The text layer.
370 371
 * @font_size: The font size.
 * @unit: The unit to use for the font size.
372
 *
373
 * Set the font size.
374
 *
375 376
 * This procedure changes the font size of a text layer. The size of
 * your font will be a double 'font-size' of 'unit' units.
377 378 379
 *
 * Returns: TRUE on success.
 *
380
 * Since: 2.6
381
 **/
382
gboolean
383 384 385
gimp_text_layer_set_font_size (gint32   layer_ID,
                               gdouble  font_size,
                               GimpUnit unit)
386
{
387
  GimpPDB        *pdb = gimp_get_pdb ();
388 389
  GimpValueArray *args;
  GimpValueArray *return_vals;
390 391
  gboolean success = TRUE;

392 393 394 395 396 397 398 399
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_DOUBLE,
                                          GIMP_TYPE_UNIT,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_double (gimp_value_array_index (args, 1), font_size);
  g_value_set_int (gimp_value_array_index (args, 2), unit);

400 401 402 403 404
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-font-size",
                                                args);
  else
405 406
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font-size",
                                            args);
407
  gimp_value_array_unref (args);
408

409
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
410

411
  gimp_value_array_unref (return_vals);
412 413 414 415 416

  return success;
}

/**
417
 * gimp_text_layer_get_antialias:
418 419
 * @layer_ID: The text layer.
 *
420
 * Check if antialiasing is used in the text layer.
421
 *
422 423
 * This procedure checks if antialiasing is enabled in the specified
 * text layer.
424
 *
425
 * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
426
 *
427
 * Since: 2.6
428
 **/
429
gboolean
430
gimp_text_layer_get_antialias (gint32 layer_ID)
431
{
432
  GimpPDB        *pdb = gimp_get_pdb ();
433 434
  GimpValueArray *args;
  GimpValueArray *return_vals;
435
  gboolean antialias = FALSE;
436

437 438 439
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
440

441 442 443 444 445
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-antialias",
                                                args);
  else
446 447
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-antialias",
                                            args);
448
  gimp_value_array_unref (args);
449

450 451 452 453
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    antialias = g_value_get_boolean (gimp_value_array_index (return_vals, 1));

  gimp_value_array_unref (return_vals);
454

455
  return antialias;
456 457 458
}

/**
459
 * gimp_text_layer_set_antialias:
460
 * @layer_ID: The text layer.
461
 * @antialias: Enable/disable antialiasing of the text.
462
 *
463
 * Enable/disable anti-aliasing in a text layer.
464
 *
465 466
 * This procedure enables or disables anti-aliasing of the text in a
 * text layer.
467 468 469
 *
 * Returns: TRUE on success.
 *
470
 * Since: 2.6
471
 **/
472
gboolean
473 474
gimp_text_layer_set_antialias (gint32   layer_ID,
                               gboolean antialias)
475
{
476
  GimpPDB        *pdb = gimp_get_pdb ();
477 478
  GimpValueArray *args;
  GimpValueArray *return_vals;
479 480
  gboolean success = TRUE;

481 482 483 484 485 486
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_BOOLEAN,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_boolean (gimp_value_array_index (args, 1), antialias);

487 488 489 490 491
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-antialias",
                                                args);
  else
492 493
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-antialias",
                                            args);
494
  gimp_value_array_unref (args);
495

496
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
497

498
  gimp_value_array_unref (return_vals);
499 500 501 502 503

  return success;
}

/**
504
 * gimp_text_layer_get_hint_style:
505 506
 * @layer_ID: The text layer.
 *
507
 * Get information about hinting in the specified text layer.
508
 *
509 510 511
 * This procedure provides information about the hinting that is being
 * used in a text layer. Hinting can be optimized for fidelity or
 * contrast or it can be turned entirely off.
512
 *
513
 * Returns: The hint style used for font outlines.
514
 *
515
 * Since: 2.8
516
 **/
517 518
GimpTextHintStyle
gimp_text_layer_get_hint_style (gint32 layer_ID)
519
{
520
  GimpPDB        *pdb = gimp_get_pdb ();
521 522
  GimpValueArray *args;
  GimpValueArray *return_vals;
523
  GimpTextHintStyle style = 0;
524

525 526 527
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
528

529 530 531 532 533
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-hint-style",
                                                args);
  else
534 535
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-hint-style",
                                            args);
536
  gimp_value_array_unref (args);
537

538 539 540 541
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    style = g_value_get_enum (gimp_value_array_index (return_vals, 1));

  gimp_value_array_unref (return_vals);
542

543
  return style;
544 545 546
}

/**
547
 * gimp_text_layer_set_hint_style:
548
 * @layer_ID: The text layer.
549
 * @style: The new hint style.
550
 *
551
 * Control how font outlines are hinted in a text layer.
552
 *
553 554 555
 * This procedure sets the hint style for font outlines in a text
 * layer. This controls whether to fit font outlines to the pixel grid,
 * and if so, whether to optimize for fidelity or contrast.
556 557 558
 *
 * Returns: TRUE on success.
 *
559
 * Since: 2.8
560
 **/
561
gboolean
562 563
gimp_text_layer_set_hint_style (gint32            layer_ID,
                                GimpTextHintStyle style)
564
{
565
  GimpPDB        *pdb = gimp_get_pdb ();
566 567
  GimpValueArray *args;
  GimpValueArray *return_vals;
568 569
  gboolean success = TRUE;

570
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
571
                                          GIMP_TYPE_TEXT_HINT_STYLE,
572 573 574 575
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_enum (gimp_value_array_index (args, 1), style);

576 577 578 579 580
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-hint-style",
                                                args);
  else
581 582
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-hint-style",
                                            args);
583
  gimp_value_array_unref (args);
584

585
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
586

587
  gimp_value_array_unref (return_vals);
588 589 590 591 592

  return success;
}

/**
593
 * gimp_text_layer_get_kerning:
594 595
 * @layer_ID: The text layer.
 *
596
 * Check if kerning is used in the text layer.
597
 *
598
 * This procedure checks if kerning is enabled in the specified text
599 600
 * layer.
 *
601
 * Returns: A flag which is true if kerning is used in the text layer.
602
 *
603
 * Since: 2.6
604
 **/
605
gboolean
606
gimp_text_layer_get_kerning (gint32 layer_ID)
607
{
608
  GimpPDB        *pdb = gimp_get_pdb ();
609 610
  GimpValueArray *args;
  GimpValueArray *return_vals;
611
  gboolean kerning = FALSE;
612

613 614 615
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
616

617 618 619 620 621
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-kerning",
                                                args);
  else
622 623
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-kerning",
                                            args);
624
  gimp_value_array_unref (args);
625

626 627 628 629
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    kerning = g_value_get_boolean (gimp_value_array_index (return_vals, 1));

  gimp_value_array_unref (return_vals);
630

631
  return kerning;
632 633 634
}

/**
635
 * gimp_text_layer_set_kerning:
636
 * @layer_ID: The text layer.
637
 * @kerning: Enable/disable kerning in the text.
638
 *
639
 * Enable/disable kerning in a text layer.
640
 *
641
 * This procedure enables or disables kerning in a text layer.
642 643 644
 *
 * Returns: TRUE on success.
 *
645
 * Since: 2.6
646
 **/
647
gboolean
648 649
gimp_text_layer_set_kerning (gint32   layer_ID,
                             gboolean kerning)
650
{
651
  GimpPDB        *pdb = gimp_get_pdb ();
652 653
  GimpValueArray *args;
  GimpValueArray *return_vals;
654 655
  gboolean success = TRUE;

656 657 658 659 660 661
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_BOOLEAN,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_boolean (gimp_value_array_index (args, 1), kerning);

662 663 664 665 666
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-kerning",
                                                args);
  else
667 668
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-kerning",
                                            args);
669
  gimp_value_array_unref (args);
670

671
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
672

673
  gimp_value_array_unref (return_vals);
674 675 676 677 678

  return success;
}

/**
679
 * gimp_text_layer_get_language:
680 681
 * @layer_ID: The text layer.
 *
682
 * Get the language used in the text layer.
683
 *
684 685
 * This procedure returns the language string which is set for the text
 * in the text layer.
686
 *
687
 * Returns: (transfer full): The language used in the text layer.
688
 *          The returned value must be freed with g_free().
689
 *
690
 * Since: 2.6
691
 **/
692 693
gchar *
gimp_text_layer_get_language (gint32 layer_ID)
694
{
695
  GimpPDB        *pdb = gimp_get_pdb ();
696 697
  GimpValueArray *args;
  GimpValueArray *return_vals;
698
  gchar *language = NULL;
699

700 701 702 703
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);

704 705 706 707 708
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-language",
                                                args);
  else
709 710
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-language",
                                            args);
711
  gimp_value_array_unref (args);
712

713 714
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    language = g_value_dup_string (gimp_value_array_index (return_vals, 1));
715

716
  gimp_value_array_unref (return_vals);
717

718
  return language;
719 720 721
}

/**
722
 * gimp_text_layer_set_language:
723
 * @layer_ID: The text layer.
724
 * @language: The new language to use for the text layer.
725
 *
726
 * Set the language of the text layer.
727
 *
728 729
 * This procedure sets the language of the text in text layer. For some
 * scripts the language has an influence of how the text is rendered.
730
 *
731
 * Returns: TRUE on success.
732
 *
733
 * Since: 2.6
734
 **/
735 736 737
gboolean
gimp_text_layer_set_language (gint32       layer_ID,
                              const gchar *language)
738
{
739
  GimpPDB        *pdb = gimp_get_pdb ();
740 741
  GimpValueArray *args;
  GimpValueArray *return_vals;
742
  gboolean success = TRUE;
743

744 745 746 747 748
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_STRING,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_string (gimp_value_array_index (args, 1), language);
749

750 751 752 753 754
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-language",
                                                args);
  else
755 756
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-language",
                                            args);
757
  gimp_value_array_unref (args);
758

759 760 761
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;

  gimp_value_array_unref (return_vals);
762

763
  return success;
764 765 766
}

/**
767
 * gimp_text_layer_get_base_direction:
768 769
 * @layer_ID: The text layer.
 *
770
 * Get the base direction used for rendering the text layer.
771
 *
772 773
 * This procedure returns the base direction used for rendering the
 * text in the text layer
774
 *
775
 * Returns: The based direction used for the text layer.
776
 *
777
 * Since: 2.6
778
 **/
779 780
GimpTextDirection
gimp_text_layer_get_base_direction (gint32 layer_ID)
781
{
782
  GimpPDB        *pdb = gimp_get_pdb ();
783 784
  GimpValueArray *args;
  GimpValueArray *return_vals;
785
  GimpTextDirection direction = 0;
786

787 788 789 790
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);

791 792 793 794 795
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-base-direction",
                                                args);
  else
796 797
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-base-direction",
                                            args);
798
  gimp_value_array_unref (args);
799

800 801
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    direction = g_value_get_enum (gimp_value_array_index (return_vals, 1));
802

803
  gimp_value_array_unref (return_vals);
804

805
  return direction;
806 807 808
}

/**
809
 * gimp_text_layer_set_base_direction:
810
 * @layer_ID: The text layer.
811
 * @direction: The base direction of the text.
812
 *
813
 * Set the base direction in the text layer.
814
 *
815 816
 * This procedure sets the base direction used in applying the Unicode
 * bidirectional algorithm when rendering the text.
817
 *
818
 * Returns: TRUE on success.
819
 *
820
 * Since: 2.6
821
 **/
822 823 824
gboolean
gimp_text_layer_set_base_direction (gint32            layer_ID,
                                    GimpTextDirection direction)
825
{
826
  GimpPDB        *pdb = gimp_get_pdb ();
827 828
  GimpValueArray *args;
  GimpValueArray *return_vals;
829
  gboolean success = TRUE;
830

831
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
832
                                          GIMP_TYPE_TEXT_DIRECTION,
833 834 835
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);
  g_value_set_enum (gimp_value_array_index (args, 1), direction);
836

837 838 839 840 841
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-base-direction",
                                                args);
  else
842 843
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-base-direction",
                                            args);
844
  gimp_value_array_unref (args);
845

846 847 848
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;

  gimp_value_array_unref (return_vals);
849

850
  return success;
851 852 853
}

/**
854
 * gimp_text_layer_get_justification:
855 856
 * @layer_ID: The text layer.
 *
857
 * Get the text justification information of the text layer.
858
 *
859 860
 * This procedure returns the alignment of the lines in the text layer
 * relative to each other.
861
 *
862
 * Returns: The justification used in the text layer.
863
 *
864
 * Since: 2.6
865
 **/
866 867
GimpTextJustification
gimp_text_layer_get_justification (gint32 layer_ID)
868
{
869
  GimpPDB        *pdb = gimp_get_pdb ();
870 871
  GimpValueArray *args;
  GimpValueArray *return_vals;
872
  GimpTextJustification justify = 0;
873

874 875 876 877
  args = gimp_value_array_new_from_types (GIMP_TYPE_LAYER_ID,
                                          G_TYPE_NONE);
  gimp_value_set_layer_id (gimp_value_array_index (args, 0), layer_ID);

878 879 880 881 882
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-justification",
                                                args);
  else
883 884
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-justification",
                                            args);
885
  gimp_value_array_unref (args);
886

887 888
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    justify = g_value_get_enum (gimp_value_array_index (return_vals, 1));
889

890
  gimp_value_array_unref (return_vals);
891

892
  return justify;
893 894 895
}

/**
896
 * gimp_text_layer_set_justification:
897
 * @layer_ID: The text layer.
898
 * @justify: The justification for your text.
899
 *