gimptextlayer_pdb.c 78.8 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
/**
 * gimp_text_layer_new:
39
 * @image: The image.
40 41 42 43 44 45 46 47 48 49 50 51
 * @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
 * Returns: (transfer full): The new text layer.
55
 *
56
 * Since: 2.6
57
 **/
58
GimpLayer *
59
gimp_text_layer_new (GimpImage   *image,
60 61 62 63 64
                     const gchar *text,
                     const gchar *fontname,
                     gdouble      size,
                     GimpUnit     unit)
{
65
  GimpPDB        *pdb = gimp_get_pdb ();
66 67
  GimpValueArray *args;
  GimpValueArray *return_vals;
68
  GimpLayer *layer = NULL;
69

70
  args = gimp_value_array_new_from_types (NULL,
71
                                          GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
72 73 74 75
                                          G_TYPE_STRING, text,
                                          G_TYPE_STRING, fontname,
                                          G_TYPE_DOUBLE, size,
                                          GIMP_TYPE_UNIT, unit,
76
                                          G_TYPE_NONE);
77 78 79 80 81 82 83 84 85 86 87

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-new",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-new",
                                            args);
  gimp_value_array_unref (args);

  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
88
    layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
89 90 91

  gimp_value_array_unref (return_vals);

92
  return layer;
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
}

/**
 * _gimp_text_layer_new: (skip)
 * @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
 * using gimp_image_insert_layer().
 *
 * Returns: The new text layer.
 *
 * Since: 2.6
 **/
gint32
_gimp_text_layer_new (gint32       image_ID,
                      const gchar *text,
                      const gchar *fontname,
                      gdouble      size,
                      GimpUnit     unit)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gint32 layer_ID = -1;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_IMAGE_ID, image_ID,
                                          G_TYPE_STRING, text,
                                          G_TYPE_STRING, fontname,
                                          G_TYPE_DOUBLE, size,
                                          GIMP_TYPE_UNIT, unit,
                                          G_TYPE_NONE);
135

136 137 138 139 140
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-new",
                                                args);
  else
141 142
    return_vals = gimp_run_procedure_array ("gimp-text-layer-new",
                                            args);
143
  gimp_value_array_unref (args);
144

145 146 147 148
  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);
149 150 151 152 153

  return layer_ID;
}

/**
154
 * gimp_text_layer_get_text:
155
 * @layer: The text layer.
156
 *
157
 * Get the text from a text layer as string.
158
 *
159
 * This procedure returns the text from a text layer as a string.
160
 *
161
 * Returns: (transfer full): The text from the specified text layer.
162
 *          The returned value must be freed with g_free().
163
 *
164
 * Since: 2.6
165
 **/
166
gchar *
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
gimp_text_layer_get_text (GimpLayer *layer)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gchar *text = NULL;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-text",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-text",
                                            args);
  gimp_value_array_unref (args);

  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));

  gimp_value_array_unref (return_vals);

  return text;
}

/**
 * _gimp_text_layer_get_text: (skip)
 * @layer_ID: The text layer.
 *
 * Get the text from a text layer as string.
 *
 * This procedure returns the text from a text layer as a string.
 *
 * Returns: The text from the specified text layer.
 *          The returned value must be freed with g_free().
 *
 * Since: 2.6
 **/
gchar *
_gimp_text_layer_get_text (gint32 layer_ID)
210
{
211
  GimpPDB        *pdb = gimp_get_pdb ();
212 213
  GimpValueArray *args;
  GimpValueArray *return_vals;
214
  gchar *text = NULL;
215

216 217
  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
218 219
                                          G_TYPE_NONE);

220 221 222 223 224
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-text",
                                                args);
  else
225 226
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-text",
                                            args);
227
  gimp_value_array_unref (args);
228

229 230
  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));
231

232
  gimp_value_array_unref (return_vals);
233

234
  return text;
235 236 237
}

/**
238
 * gimp_text_layer_set_text:
239
 * @layer: The text layer.
240
 * @text: The new text to set.
241
 *
242
 * Set the text of a text layer.
243
 *
244
 * This procedure changes the text of a text layer.
245 246 247
 *
 * Returns: TRUE on success.
 *
248
 * Since: 2.6
249
 **/
250
gboolean
251
gimp_text_layer_set_text (GimpLayer   *layer,
252
                          const gchar *text)
253
{
254
  GimpPDB        *pdb = gimp_get_pdb ();
255 256
  GimpValueArray *args;
  GimpValueArray *return_vals;
257 258
  gboolean success = TRUE;

259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_STRING, text,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-text",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-text",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * _gimp_text_layer_set_text: (skip)
 * @layer_ID: The text layer.
 * @text: The new text to set.
 *
 * Set the text of a text layer.
 *
 * This procedure changes the text of a text layer.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_set_text (gint32       layer_ID,
                           const gchar *text)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

302 303 304
  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_STRING, text,
305
                                          G_TYPE_NONE);
306

307 308 309 310 311
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-text",
                                                args);
  else
312 313
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-text",
                                            args);
314
  gimp_value_array_unref (args);
315

316 317 318
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;

  gimp_value_array_unref (return_vals);
319 320 321 322

  return success;
}

323 324
/**
 * gimp_text_layer_get_markup:
325
 * @layer: The text layer.
326 327 328 329 330
 *
 * 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
331
 * https://www.pango.org/ for more information about Pango and its
332 333 334
 * markup. Note: Setting the markup of a text layer using Pango's
 * markup is not supported for now.
 *
335 336 337
 * Returns: (transfer full):
 *          The markup which represents the style of the specified text layer.
 *          The returned value must be freed with g_free().
338
 *
339
 * Since: 2.8
340
 **/
341
gchar *
342
gimp_text_layer_get_markup (GimpLayer *layer)
343
{
344
  GimpPDB        *pdb = gimp_get_pdb ();
345 346
  GimpValueArray *args;
  GimpValueArray *return_vals;
347 348
  gchar *markup = NULL;

349
  args = gimp_value_array_new_from_types (NULL,
350
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
351 352
                                          G_TYPE_NONE);

353 354 355 356 357
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-markup",
                                                args);
  else
358 359
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-markup",
                                            args);
360
  gimp_value_array_unref (args);
361

362 363
  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));
364

365
  gimp_value_array_unref (return_vals);
366 367 368 369

  return markup;
}

370
/**
371
 * _gimp_text_layer_get_markup: (skip)
372 373
 * @layer_ID: The text layer.
 *
374
 * Get the markup from a text layer as string.
375
 *
376 377 378 379 380
 * This procedure returns the markup of the styles from a text layer.
 * The markup will be in the form of Pango's markup - See
 * https://www.pango.org/ for more information about Pango and its
 * markup. Note: Setting the markup of a text layer using Pango's
 * markup is not supported for now.
381
 *
382
 * Returns: The markup which represents the style of the specified text layer.
383
 *          The returned value must be freed with g_free().
384
 *
385
 * Since: 2.8
386
 **/
387
gchar *
388
_gimp_text_layer_get_markup (gint32 layer_ID)
389
{
390
  GimpPDB        *pdb = gimp_get_pdb ();
391 392
  GimpValueArray *args;
  GimpValueArray *return_vals;
393
  gchar *markup = NULL;
394

395 396
  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
397
                                          G_TYPE_NONE);
398

399 400
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
401
                                                "gimp-text-layer-get-markup",
402 403
                                                args);
  else
404
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-markup",
405
                                            args);
406
  gimp_value_array_unref (args);
407

408
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
409
    markup = g_value_dup_string (gimp_value_array_index (return_vals, 1));
410 411

  gimp_value_array_unref (return_vals);
412

413
  return markup;
414 415 416
}

/**
417 418
 * gimp_text_layer_get_font:
 * @layer: The text layer.
419
 *
420
 * Get the font from a text layer as string.
421
 *
422
 * This procedure returns the name of the font from a text layer.
423
 *
424 425 426
 * Returns: (transfer full):
 *          The font which is used in the specified text layer.
 *          The returned value must be freed with g_free().
427
 *
428
 * Since: 2.6
429
 **/
430 431
gchar *
gimp_text_layer_get_font (GimpLayer *layer)
432
{
433
  GimpPDB        *pdb = gimp_get_pdb ();
434 435
  GimpValueArray *args;
  GimpValueArray *return_vals;
436
  gchar *font = NULL;
437

438
  args = gimp_value_array_new_from_types (NULL,
439
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
440 441
                                          G_TYPE_NONE);

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

451 452
  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));
453

454
  gimp_value_array_unref (return_vals);
455

456
  return font;
457 458 459
}

/**
460
 * _gimp_text_layer_get_font: (skip)
461 462
 * @layer_ID: The text layer.
 *
463
 * Get the font from a text layer as string.
464
 *
465
 * This procedure returns the name of the font from a text layer.
466
 *
467 468
 * Returns: The font which is used in the specified text layer.
 *          The returned value must be freed with g_free().
469
 *
470
 * Since: 2.6
471
 **/
472 473
gchar *
_gimp_text_layer_get_font (gint32 layer_ID)
474
{
475
  GimpPDB        *pdb = gimp_get_pdb ();
476 477
  GimpValueArray *args;
  GimpValueArray *return_vals;
478
  gchar *font = NULL;
479

480 481
  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
482
                                          G_TYPE_NONE);
483

484 485
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
486
                                                "gimp-text-layer-get-font",
487 488
                                                args);
  else
489
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font",
490
                                            args);
491 492 493
  gimp_value_array_unref (args);

  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
494
    font = g_value_dup_string (gimp_value_array_index (return_vals, 1));
495

496
  gimp_value_array_unref (return_vals);
497

498
  return font;
499 500 501
}

/**
502 503 504
 * gimp_text_layer_set_font:
 * @layer: The text layer.
 * @font: The new font to use.
505
 *
506
 * Set the font of a text layer.
507
 *
508
 * This procedure modifies the font used in the specified text layer.
509 510 511
 *
 * Returns: TRUE on success.
 *
512
 * Since: 2.6
513
 **/
514
gboolean
515 516
gimp_text_layer_set_font (GimpLayer   *layer,
                          const gchar *font)
517
{
518
  GimpPDB        *pdb = gimp_get_pdb ();
519 520
  GimpValueArray *args;
  GimpValueArray *return_vals;
521 522
  gboolean success = TRUE;

523
  args = gimp_value_array_new_from_types (NULL,
524 525
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_STRING, font,
526 527
                                          G_TYPE_NONE);

528 529
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
530
                                                "gimp-text-layer-set-font",
531 532
                                                args);
  else
533
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font",
534
                                            args);
535
  gimp_value_array_unref (args);
536

537
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
538

539
  gimp_value_array_unref (return_vals);
540 541 542 543 544

  return success;
}

/**
545
 * _gimp_text_layer_set_font: (skip)
546
 * @layer_ID: The text layer.
547
 * @font: The new font to use.
548
 *
549
 * Set the font of a text layer.
550
 *
551
 * This procedure modifies the font used in the specified text layer.
552
 *
553
 * Returns: TRUE on success.
554
 *
555
 * Since: 2.6
556
 **/
557
gboolean
558 559
_gimp_text_layer_set_font (gint32       layer_ID,
                           const gchar *font)
560
{
561
  GimpPDB        *pdb = gimp_get_pdb ();
562 563
  GimpValueArray *args;
  GimpValueArray *return_vals;
564
  gboolean success = TRUE;
565

566 567
  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
568
                                          G_TYPE_STRING, font,
569
                                          G_TYPE_NONE);
570

571 572
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
573
                                                "gimp-text-layer-set-font",
574 575
                                                args);
  else
576
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font",
577
                                            args);
578
  gimp_value_array_unref (args);
579

580
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
581 582

  gimp_value_array_unref (return_vals);
583

584
  return success;
585 586 587
}

/**
588 589 590
 * gimp_text_layer_get_font_size:
 * @layer: The text layer.
 * @unit: (out) (transfer none): The unit used for the font size.
591
 *
592
 * Get the font size from a text layer.
593
 *
594 595 596
 * 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.
597
 *
598
 * Returns: The font size.
599
 *
600
 * Since: 2.6
601
 **/
602 603 604
gdouble
gimp_text_layer_get_font_size (GimpLayer *layer,
                               GimpUnit  *unit)
605
{
606
  GimpPDB        *pdb = gimp_get_pdb ();
607 608
  GimpValueArray *args;
  GimpValueArray *return_vals;
609
  gdouble font_size = 0.0;
610

611
  args = gimp_value_array_new_from_types (NULL,
612
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
613 614
                                          G_TYPE_NONE);

615 616
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
617
                                                "gimp-text-layer-get-font-size",
618 619
                                                args);
  else
620
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font-size",
621
                                            args);
622
  gimp_value_array_unref (args);
623

624 625 626 627 628
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    {
      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));
    }
629

630
  gimp_value_array_unref (return_vals);
631

632
  return font_size;
633 634 635
}

/**
636
 * _gimp_text_layer_get_font_size: (skip)
637
 * @layer_ID: The text layer.
638
 * @unit: (out): The unit used for the font size.
639
 *
640
 * Get the font size from a text layer.
641
 *
642 643 644
 * 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.
645
 *
646
 * Returns: The font size.
647
 *
648
 * Since: 2.6
649
 **/
650 651 652
gdouble
_gimp_text_layer_get_font_size (gint32    layer_ID,
                                GimpUnit *unit)
653
{
654
  GimpPDB        *pdb = gimp_get_pdb ();
655 656
  GimpValueArray *args;
  GimpValueArray *return_vals;
657
  gdouble font_size = 0.0;
658

659 660
  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
661
                                          G_TYPE_NONE);
662

663 664
  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
665
                                                "gimp-text-layer-get-font-size",
666 667
                                                args);
  else
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font-size",
                                            args);
  gimp_value_array_unref (args);

  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
    {
      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));
    }

  gimp_value_array_unref (return_vals);

  return font_size;
}

/**
 * gimp_text_layer_set_font_size:
 * @layer: The text layer.
 * @font_size: The font size.
 * @unit: The unit to use for the font size.
 *
 * Set the font size.
 *
 * This procedure changes the font size of a text layer. The size of
 * your font will be a double 'font-size' of 'unit' units.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
gimp_text_layer_set_font_size (GimpLayer *layer,
                               gdouble    font_size,
                               GimpUnit   unit)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_DOUBLE, font_size,
                                          GIMP_TYPE_UNIT, unit,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-font-size",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font-size",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * _gimp_text_layer_set_font_size: (skip)
 * @layer_ID: The text layer.
 * @font_size: The font size.
 * @unit: The unit to use for the font size.
 *
 * Set the font size.
 *
 * This procedure changes the font size of a text layer. The size of
 * your font will be a double 'font-size' of 'unit' units.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_set_font_size (gint32   layer_ID,
                                gdouble  font_size,
                                GimpUnit unit)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_DOUBLE, font_size,
                                          GIMP_TYPE_UNIT, unit,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-font-size",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font-size",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * gimp_text_layer_get_antialias:
 * @layer: The text layer.
 *
 * Check if antialiasing is used in the text layer.
 *
 * This procedure checks if antialiasing is enabled in the specified
 * text layer.
 *
 * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
 *
 * Since: 2.6
 **/
gboolean
gimp_text_layer_get_antialias (GimpLayer *layer)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean antialias = FALSE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-antialias",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-antialias",
                                            args);
  gimp_value_array_unref (args);

  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);

  return antialias;
}

/**
 * _gimp_text_layer_get_antialias: (skip)
 * @layer_ID: The text layer.
 *
 * Check if antialiasing is used in the text layer.
 *
 * This procedure checks if antialiasing is enabled in the specified
 * text layer.
 *
 * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_get_antialias (gint32 layer_ID)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean antialias = FALSE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-antialias",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-antialias",
                                            args);
  gimp_value_array_unref (args);

  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);

  return antialias;
}

/**
 * gimp_text_layer_set_antialias:
 * @layer: The text layer.
 * @antialias: Enable/disable antialiasing of the text.
 *
 * Enable/disable anti-aliasing in a text layer.
 *
 * This procedure enables or disables anti-aliasing of the text in a
 * text layer.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
gimp_text_layer_set_antialias (GimpLayer *layer,
                               gboolean   antialias)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_BOOLEAN, antialias,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-antialias",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-antialias",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * _gimp_text_layer_set_antialias: (skip)
 * @layer_ID: The text layer.
 * @antialias: Enable/disable antialiasing of the text.
 *
 * Enable/disable anti-aliasing in a text layer.
 *
 * This procedure enables or disables anti-aliasing of the text in a
 * text layer.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_set_antialias (gint32   layer_ID,
                                gboolean antialias)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_BOOLEAN, antialias,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-antialias",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-antialias",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * gimp_text_layer_get_hint_style:
 * @layer: The text layer.
 *
 * Get information about hinting in the specified text layer.
 *
 * This procedure provides information about the hinting that is being
 * used in a text layer. Hinting can be optimized for fidelity or
 * contrast or it can be turned entirely off.
 *
 * Returns: The hint style used for font outlines.
 *
 * Since: 2.8
 **/
GimpTextHintStyle
gimp_text_layer_get_hint_style (GimpLayer *layer)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  GimpTextHintStyle style = 0;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-hint-style",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-hint-style",
981
                                            args);
982
  gimp_value_array_unref (args);
983

984 985 986 987
  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);
988

989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680
  return style;
}

/**
 * _gimp_text_layer_get_hint_style: (skip)
 * @layer_ID: The text layer.
 *
 * Get information about hinting in the specified text layer.
 *
 * This procedure provides information about the hinting that is being
 * used in a text layer. Hinting can be optimized for fidelity or
 * contrast or it can be turned entirely off.
 *
 * Returns: The hint style used for font outlines.
 *
 * Since: 2.8
 **/
GimpTextHintStyle
_gimp_text_layer_get_hint_style (gint32 layer_ID)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  GimpTextHintStyle style = 0;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-hint-style",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-hint-style",
                                            args);
  gimp_value_array_unref (args);

  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);

  return style;
}

/**
 * gimp_text_layer_set_hint_style:
 * @layer: The text layer.
 * @style: The new hint style.
 *
 * Control how font outlines are hinted in a text layer.
 *
 * This procedure sets the hint style for font outlines in a text
 * layer. This controls whether to fit font outlines to the pixel grid,
 * and if so, whether to optimize for fidelity or contrast.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_text_layer_set_hint_style (GimpLayer         *layer,
                                GimpTextHintStyle  style)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          GIMP_TYPE_TEXT_HINT_STYLE, style,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-hint-style",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-hint-style",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * _gimp_text_layer_set_hint_style: (skip)
 * @layer_ID: The text layer.
 * @style: The new hint style.
 *
 * Control how font outlines are hinted in a text layer.
 *
 * This procedure sets the hint style for font outlines in a text
 * layer. This controls whether to fit font outlines to the pixel grid,
 * and if so, whether to optimize for fidelity or contrast.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
_gimp_text_layer_set_hint_style (gint32            layer_ID,
                                 GimpTextHintStyle style)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          GIMP_TYPE_TEXT_HINT_STYLE, style,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-hint-style",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-hint-style",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * gimp_text_layer_get_kerning:
 * @layer: The text layer.
 *
 * Check if kerning is used in the text layer.
 *
 * This procedure checks if kerning is enabled in the specified text
 * layer.
 *
 * Returns: A flag which is true if kerning is used in the text layer.
 *
 * Since: 2.6
 **/
gboolean
gimp_text_layer_get_kerning (GimpLayer *layer)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean kerning = FALSE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-kerning",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-kerning",
                                            args);
  gimp_value_array_unref (args);

  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);

  return kerning;
}

/**
 * _gimp_text_layer_get_kerning: (skip)
 * @layer_ID: The text layer.
 *
 * Check if kerning is used in the text layer.
 *
 * This procedure checks if kerning is enabled in the specified text
 * layer.
 *
 * Returns: A flag which is true if kerning is used in the text layer.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_get_kerning (gint32 layer_ID)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean kerning = FALSE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-kerning",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-kerning",
                                            args);
  gimp_value_array_unref (args);

  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);

  return kerning;
}

/**
 * gimp_text_layer_set_kerning:
 * @layer: The text layer.
 * @kerning: Enable/disable kerning in the text.
 *
 * Enable/disable kerning in a text layer.
 *
 * This procedure enables or disables kerning in a text layer.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
gimp_text_layer_set_kerning (GimpLayer *layer,
                             gboolean   kerning)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_BOOLEAN, kerning,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-kerning",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-kerning",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * _gimp_text_layer_set_kerning: (skip)
 * @layer_ID: The text layer.
 * @kerning: Enable/disable kerning in the text.
 *
 * Enable/disable kerning in a text layer.
 *
 * This procedure enables or disables kerning in a text layer.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_set_kerning (gint32   layer_ID,
                              gboolean kerning)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_BOOLEAN, kerning,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-kerning",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-kerning",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * gimp_text_layer_get_language:
 * @layer: The text layer.
 *
 * Get the language used in the text layer.
 *
 * This procedure returns the language string which is set for the text
 * in the text layer.
 *
 * Returns: (transfer full): The language used in the text layer.
 *          The returned value must be freed with g_free().
 *
 * Since: 2.6
 **/
gchar *
gimp_text_layer_get_language (GimpLayer *layer)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gchar *language = NULL;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-language",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-language",
                                            args);
  gimp_value_array_unref (args);

  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));

  gimp_value_array_unref (return_vals);

  return language;
}

/**
 * _gimp_text_layer_get_language: (skip)
 * @layer_ID: The text layer.
 *
 * Get the language used in the text layer.
 *
 * This procedure returns the language string which is set for the text
 * in the text layer.
 *
 * Returns: The language used in the text layer.
 *          The returned value must be freed with g_free().
 *
 * Since: 2.6
 **/
gchar *
_gimp_text_layer_get_language (gint32 layer_ID)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gchar *language = NULL;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-language",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-language",
                                            args);
  gimp_value_array_unref (args);

  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));

  gimp_value_array_unref (return_vals);

  return language;
}

/**
 * gimp_text_layer_set_language:
 * @layer: The text layer.
 * @language: The new language to use for the text layer.
 *
 * Set the language of the text layer.
 *
 * This procedure sets the language of the text in text layer. For some
 * scripts the language has an influence of how the text is rendered.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
gimp_text_layer_set_language (GimpLayer   *layer,
                              const gchar *language)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_STRING, language,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-language",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-language",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * _gimp_text_layer_set_language: (skip)
 * @layer_ID: The text layer.
 * @language: The new language to use for the text layer.
 *
 * Set the language of the text layer.
 *
 * This procedure sets the language of the text in text layer. For some
 * scripts the language has an influence of how the text is rendered.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_set_language (gint32       layer_ID,
                               const gchar *language)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_STRING, language,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-language",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-language",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * gimp_text_layer_get_base_direction:
 * @layer: The text layer.
 *
 * Get the base direction used for rendering the text layer.
 *
 * This procedure returns the base direction used for rendering the
 * text in the text layer
 *
 * Returns: The based direction used for the text layer.
 *
 * Since: 2.6
 **/
GimpTextDirection
gimp_text_layer_get_base_direction (GimpLayer *layer)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  GimpTextDirection direction = 0;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-base-direction",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-base-direction",
                                            args);
  gimp_value_array_unref (args);

  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));

  gimp_value_array_unref (return_vals);

  return direction;
}

/**
 * _gimp_text_layer_get_base_direction: (skip)
 * @layer_ID: The text layer.
 *
 * Get the base direction used for rendering the text layer.
 *
 * This procedure returns the base direction used for rendering the
 * text in the text layer
 *
 * Returns: The based direction used for the text layer.
 *
 * Since: 2.6
 **/
GimpTextDirection
_gimp_text_layer_get_base_direction (gint32 layer_ID)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  GimpTextDirection direction = 0;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-base-direction",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-base-direction",
                                            args);
  gimp_value_array_unref (args);

  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));

  gimp_value_array_unref (return_vals);

  return direction;
}

/**
 * gimp_text_layer_set_base_direction:
 * @layer: The text layer.
 * @direction: The base direction of the text.
 *
 * Set the base direction in the text layer.
 *
 * This procedure sets the base direction used in applying the Unicode
 * bidirectional algorithm when rendering the text.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
gimp_text_layer_set_base_direction (GimpLayer         *layer,
                                    GimpTextDirection  direction)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          GIMP_TYPE_TEXT_DIRECTION, direction,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-base-direction",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-base-direction",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * _gimp_text_layer_set_base_direction: (skip)
 * @layer_ID: The text layer.
 * @direction: The base direction of the text.
 *
 * Set the base direction in the text layer.
 *
 * This procedure sets the base direction used in applying the Unicode
 * bidirectional algorithm when rendering the text.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
_gimp_text_layer_set_base_direction (gint32            layer_ID,
                                     GimpTextDirection direction)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, layer_ID,
                                          GIMP_TYPE_TEXT_DIRECTION, direction,
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-set-base-direction",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-set-base-direction",
                                            args);
  gimp_value_array_unref (args);

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

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * gimp_text_layer_get_justification:
 * @layer: The text layer.
 *
 * Get the text justification information of the text layer.
 *
 * This procedure returns the alignment of the lines in the text layer
 * relative to each other.
 *
 * Returns: The justification used in the text layer.
 *
 * Since: 2.6
 **/
GimpTextJustification
gimp_text_layer_get_justification (GimpLayer *layer)
{
  GimpPDB        *pdb = gimp_get_pdb ();
  GimpValueArray *args;
  GimpValueArray *return_vals;
  GimpTextJustification justify = 0;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
                                          G_TYPE_NONE);

  if (pdb)
    return_vals = gimp_pdb_run_procedure_array (pdb,
                                                "gimp-text-layer-get-justification",
                                                args);
  else
    return_vals = gimp_run_procedure_array ("gimp-text-layer-get-justification",
                                            args);
  gimp_value_array_unref (args);

  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));

  gimp_value_array_unref (return_vals);

  return justify;
1681 1682 1683
}

/**
1684
 * _gimp_text_layer_get_justification: (skip)
1685 1686
 * @layer_ID: The text layer.
 *
1687
 * Get the text justification information of the text layer.
1688
 *
1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733
 * This procedure returns the alignment of the lines in the text layer
 * relative to each other.
 *
 * Returns: The justification used in the text layer.
 *
 * Since: 2.6
 **/
GimpTextJustification
_gimp_text_layer_get_justification (gint32 layer_ID)
{
  GimpPDB        *pdb = gimp_get_pdb ();