gimptextlayer_pdb.c 27.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 30 31 32 33 34 35 36

/**
 * SECTION: gimptextlayer
 * @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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
gint32
gimp_text_layer_new (gint32       image_ID,
                     const gchar *text,
                     const gchar *fontname,
                     gdouble      size,
                     GimpUnit     unit)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 layer_ID = -1;

  return_vals = gimp_run_procedure ("gimp-text-layer-new",
                                    &nreturn_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_STRING, text,
                                    GIMP_PDB_STRING, fontname,
                                    GIMP_PDB_FLOAT, size,
                                    GIMP_PDB_INT32, unit,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    layer_ID = return_vals[1].data.d_layer;

  gimp_destroy_params (return_vals, nreturn_vals);

  return layer_ID;
}

/**
87
 * gimp_text_layer_get_text:
88 89
 * @layer_ID: The text layer.
 *
90
 * Get the text from a text layer as string.
91
 *
92
 * This procedure returns the text from a text layer as a string.
93
 *
94
 * Returns: The text from the specified text layer.
95
 *
96
 * Since: 2.6
97
 **/
98 99
gchar *
gimp_text_layer_get_text (gint32 layer_ID)
100 101 102
{
  GimpParam *return_vals;
  gint nreturn_vals;
103
  gchar *text = NULL;
104

105
  return_vals = gimp_run_procedure ("gimp-text-layer-get-text",
106 107 108 109
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

110 111
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    text = g_strdup (return_vals[1].data.d_string);
112 113 114

  gimp_destroy_params (return_vals, nreturn_vals);

115
  return text;
116 117 118
}

/**
119
 * gimp_text_layer_set_text:
120
 * @layer_ID: The text layer.
121
 * @text: The new text to set.
122
 *
123
 * Set the text of a text layer.
124
 *
125
 * This procedure changes the text of a text layer.
126 127 128
 *
 * Returns: TRUE on success.
 *
129
 * Since: 2.6
130
 **/
131
gboolean
132 133
gimp_text_layer_set_text (gint32       layer_ID,
                          const gchar *text)
134 135 136 137 138
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

139
  return_vals = gimp_run_procedure ("gimp-text-layer-set-text",
140 141
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
142
                                    GIMP_PDB_STRING, text,
143 144 145 146 147 148 149 150 151
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

152 153 154 155 156 157 158 159
/**
 * 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
160
 * https://www.pango.org/ for more information about Pango and its
161 162 163
 * markup. Note: Setting the markup of a text layer using Pango's
 * markup is not supported for now.
 *
164 165
 * Returns: The markup which represents the style of the specified text
 * layer.
166
 *
167
 * Since: 2.8
168
 **/
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
gchar *
gimp_text_layer_get_markup (gint32 layer_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *markup = NULL;

  return_vals = gimp_run_procedure ("gimp-text-layer-get-markup",
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    markup = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return markup;
}

189
/**
190
 * gimp_text_layer_get_font:
191 192
 * @layer_ID: The text layer.
 *
193
 * Get the font from a text layer as string.
194
 *
195
 * This procedure returns the name of the font from a text layer.
196
 *
197
 * Returns: The font which is used in the specified text layer.
198
 *
199
 * Since: 2.6
200
 **/
201 202
gchar *
gimp_text_layer_get_font (gint32 layer_ID)
203 204 205
{
  GimpParam *return_vals;
  gint nreturn_vals;
206
  gchar *font = NULL;
207

208
  return_vals = gimp_run_procedure ("gimp-text-layer-get-font",
209 210 211 212
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

213 214
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    font = g_strdup (return_vals[1].data.d_string);
215 216 217

  gimp_destroy_params (return_vals, nreturn_vals);

218
  return font;
219 220 221
}

/**
222
 * gimp_text_layer_set_font:
223
 * @layer_ID: The text layer.
224
 * @font: The new font to use.
225
 *
226
 * Set the font of a text layer.
227
 *
228
 * This procedure modifies the font used in the specified text layer.
229 230 231
 *
 * Returns: TRUE on success.
 *
232
 * Since: 2.6
233
 **/
234
gboolean
235 236
gimp_text_layer_set_font (gint32       layer_ID,
                          const gchar *font)
237 238 239 240 241
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

242
  return_vals = gimp_run_procedure ("gimp-text-layer-set-font",
243 244
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
245
                                    GIMP_PDB_STRING, font,
246 247 248 249 250 251 252 253 254 255
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
256
 * gimp_text_layer_get_font_size:
257
 * @layer_ID: The text layer.
258
 * @unit: The unit used for the font size.
259
 *
260
 * Get the font size from a text layer.
261
 *
262 263 264
 * 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.
265
 *
266
 * Returns: The font size.
267
 *
268
 * Since: 2.6
269
 **/
270 271 272
gdouble
gimp_text_layer_get_font_size (gint32    layer_ID,
                               GimpUnit *unit)
273 274 275
{
  GimpParam *return_vals;
  gint nreturn_vals;
276
  gdouble font_size = 0.0;
277

278
  return_vals = gimp_run_procedure ("gimp-text-layer-get-font-size",
279 280 281 282
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

283 284 285 286 287
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    {
      font_size = return_vals[1].data.d_float;
      *unit = return_vals[2].data.d_unit;
    }
288 289 290

  gimp_destroy_params (return_vals, nreturn_vals);

291
  return font_size;
292 293 294
}

/**
295
 * gimp_text_layer_set_font_size:
296
 * @layer_ID: The text layer.
297 298
 * @font_size: The font size.
 * @unit: The unit to use for the font size.
299
 *
300
 * Set the font size.
301
 *
302 303
 * This procedure changes the font size of a text layer. The size of
 * your font will be a double 'font-size' of 'unit' units.
304 305 306
 *
 * Returns: TRUE on success.
 *
307
 * Since: 2.6
308
 **/
309
gboolean
310 311 312
gimp_text_layer_set_font_size (gint32   layer_ID,
                               gdouble  font_size,
                               GimpUnit unit)
313 314 315 316 317
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

318
  return_vals = gimp_run_procedure ("gimp-text-layer-set-font-size",
319 320
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
321 322
                                    GIMP_PDB_FLOAT, font_size,
                                    GIMP_PDB_INT32, unit,
323 324 325 326 327 328 329 330 331 332
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
333
 * gimp_text_layer_get_antialias:
334 335
 * @layer_ID: The text layer.
 *
336
 * Check if antialiasing is used in the text layer.
337
 *
338 339
 * This procedure checks if antialiasing is enabled in the specified
 * text layer.
340
 *
341 342
 * Returns: A flag which is true if antialiasing is used for rendering
 * the font in the text layer.
343
 *
344
 * Since: 2.6
345
 **/
346
gboolean
347
gimp_text_layer_get_antialias (gint32 layer_ID)
348 349 350
{
  GimpParam *return_vals;
  gint nreturn_vals;
351
  gboolean antialias = FALSE;
352

353
  return_vals = gimp_run_procedure ("gimp-text-layer-get-antialias",
354 355 356 357
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

358
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
359
    antialias = return_vals[1].data.d_int32;
360 361 362

  gimp_destroy_params (return_vals, nreturn_vals);

363
  return antialias;
364 365 366
}

/**
367
 * gimp_text_layer_set_antialias:
368
 * @layer_ID: The text layer.
369
 * @antialias: Enable/disable antialiasing of the text.
370
 *
371
 * Enable/disable anti-aliasing in a text layer.
372
 *
373 374
 * This procedure enables or disables anti-aliasing of the text in a
 * text layer.
375 376 377
 *
 * Returns: TRUE on success.
 *
378
 * Since: 2.6
379
 **/
380
gboolean
381 382
gimp_text_layer_set_antialias (gint32   layer_ID,
                               gboolean antialias)
383 384 385 386 387
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

388
  return_vals = gimp_run_procedure ("gimp-text-layer-set-antialias",
389 390
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
391
                                    GIMP_PDB_INT32, antialias,
392 393 394 395 396 397 398 399 400 401
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
402
 * gimp_text_layer_get_hint_style:
403 404
 * @layer_ID: The text layer.
 *
405
 * Get information about hinting in the specified text layer.
406
 *
407 408 409
 * 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.
410
 *
411
 * Returns: The hint style used for font outlines.
412
 *
413
 * Since: 2.8
414
 **/
415 416
GimpTextHintStyle
gimp_text_layer_get_hint_style (gint32 layer_ID)
417 418 419
{
  GimpParam *return_vals;
  gint nreturn_vals;
420
  GimpTextHintStyle style = 0;
421

422
  return_vals = gimp_run_procedure ("gimp-text-layer-get-hint-style",
423 424 425 426
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

427
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
428
    style = return_vals[1].data.d_int32;
429 430 431

  gimp_destroy_params (return_vals, nreturn_vals);

432
  return style;
433 434 435
}

/**
436
 * gimp_text_layer_set_hint_style:
437
 * @layer_ID: The text layer.
438
 * @style: The new hint style.
439
 *
440
 * Control how font outlines are hinted in a text layer.
441
 *
442 443 444
 * 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.
445 446 447
 *
 * Returns: TRUE on success.
 *
448
 * Since: 2.8
449
 **/
450
gboolean
451 452
gimp_text_layer_set_hint_style (gint32            layer_ID,
                                GimpTextHintStyle style)
453 454 455 456 457
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

458
  return_vals = gimp_run_procedure ("gimp-text-layer-set-hint-style",
459 460
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
461
                                    GIMP_PDB_INT32, style,
462 463 464 465 466 467 468 469 470 471
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
472
 * gimp_text_layer_get_kerning:
473 474
 * @layer_ID: The text layer.
 *
475
 * Check if kerning is used in the text layer.
476
 *
477
 * This procedure checks if kerning is enabled in the specified text
478 479
 * layer.
 *
480
 * Returns: A flag which is true if kerning is used in the text layer.
481
 *
482
 * Since: 2.6
483
 **/
484
gboolean
485
gimp_text_layer_get_kerning (gint32 layer_ID)
486 487 488
{
  GimpParam *return_vals;
  gint nreturn_vals;
489
  gboolean kerning = FALSE;
490

491
  return_vals = gimp_run_procedure ("gimp-text-layer-get-kerning",
492 493 494 495
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

496 497
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    kerning = return_vals[1].data.d_int32;
498 499 500

  gimp_destroy_params (return_vals, nreturn_vals);

501
  return kerning;
502 503 504
}

/**
505
 * gimp_text_layer_set_kerning:
506
 * @layer_ID: The text layer.
507
 * @kerning: Enable/disable kerning in the text.
508
 *
509
 * Enable/disable kerning in a text layer.
510
 *
511
 * This procedure enables or disables kerning in a text layer.
512 513 514
 *
 * Returns: TRUE on success.
 *
515
 * Since: 2.6
516
 **/
517
gboolean
518 519
gimp_text_layer_set_kerning (gint32   layer_ID,
                             gboolean kerning)
520 521 522 523 524
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

525
  return_vals = gimp_run_procedure ("gimp-text-layer-set-kerning",
526 527
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
528
                                    GIMP_PDB_INT32, kerning,
529 530 531 532 533 534 535 536 537 538
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
539
 * gimp_text_layer_get_language:
540 541
 * @layer_ID: The text layer.
 *
542
 * Get the language used in the text layer.
543
 *
544 545
 * This procedure returns the language string which is set for the text
 * in the text layer.
546
 *
547
 * Returns: The language used in the text layer.
548
 *
549
 * Since: 2.6
550
 **/
551 552
gchar *
gimp_text_layer_get_language (gint32 layer_ID)
553 554 555
{
  GimpParam *return_vals;
  gint nreturn_vals;
556
  gchar *language = NULL;
557

558
  return_vals = gimp_run_procedure ("gimp-text-layer-get-language",
559 560 561 562
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

563 564
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    language = g_strdup (return_vals[1].data.d_string);
565 566 567

  gimp_destroy_params (return_vals, nreturn_vals);

568
  return language;
569 570 571
}

/**
572
 * gimp_text_layer_set_language:
573
 * @layer_ID: The text layer.
574
 * @language: The new language to use for the text layer.
575
 *
576
 * Set the language of the text layer.
577
 *
578 579
 * 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.
580
 *
581
 * Returns: TRUE on success.
582
 *
583
 * Since: 2.6
584
 **/
585 586 587
gboolean
gimp_text_layer_set_language (gint32       layer_ID,
                              const gchar *language)
588 589 590
{
  GimpParam *return_vals;
  gint nreturn_vals;
591
  gboolean success = TRUE;
592

593
  return_vals = gimp_run_procedure ("gimp-text-layer-set-language",
594 595
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
596
                                    GIMP_PDB_STRING, language,
597 598
                                    GIMP_PDB_END);

599
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
600 601 602

  gimp_destroy_params (return_vals, nreturn_vals);

603
  return success;
604 605 606
}

/**
607
 * gimp_text_layer_get_base_direction:
608 609
 * @layer_ID: The text layer.
 *
610
 * Get the base direction used for rendering the text layer.
611
 *
612 613
 * This procedure returns the base direction used for rendering the
 * text in the text layer
614
 *
615
 * Returns: The based direction used for the text layer.
616
 *
617
 * Since: 2.6
618
 **/
619 620
GimpTextDirection
gimp_text_layer_get_base_direction (gint32 layer_ID)
621 622 623
{
  GimpParam *return_vals;
  gint nreturn_vals;
624
  GimpTextDirection direction = 0;
625

626
  return_vals = gimp_run_procedure ("gimp-text-layer-get-base-direction",
627 628 629 630 631
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
632
    direction = return_vals[1].data.d_int32;
633 634 635

  gimp_destroy_params (return_vals, nreturn_vals);

636
  return direction;
637 638 639
}

/**
640
 * gimp_text_layer_set_base_direction:
641
 * @layer_ID: The text layer.
642
 * @direction: The base direction of the text.
643
 *
644
 * Set the base direction in the text layer.
645
 *
646 647
 * This procedure sets the base direction used in applying the Unicode
 * bidirectional algorithm when rendering the text.
648
 *
649
 * Returns: TRUE on success.
650
 *
651
 * Since: 2.6
652
 **/
653 654 655
gboolean
gimp_text_layer_set_base_direction (gint32            layer_ID,
                                    GimpTextDirection direction)
656 657 658
{
  GimpParam *return_vals;
  gint nreturn_vals;
659
  gboolean success = TRUE;
660

661
  return_vals = gimp_run_procedure ("gimp-text-layer-set-base-direction",
662 663
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
664
                                    GIMP_PDB_INT32, direction,
665 666
                                    GIMP_PDB_END);

667
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
668 669 670

  gimp_destroy_params (return_vals, nreturn_vals);

671
  return success;
672 673 674
}

/**
675
 * gimp_text_layer_get_justification:
676 677
 * @layer_ID: The text layer.
 *
678
 * Get the text justification information of the text layer.
679
 *
680 681
 * This procedure returns the alignment of the lines in the text layer
 * relative to each other.
682
 *
683
 * Returns: The justification used in the text layer.
684
 *
685
 * Since: 2.6
686
 **/
687 688
GimpTextJustification
gimp_text_layer_get_justification (gint32 layer_ID)
689 690 691
{
  GimpParam *return_vals;
  gint nreturn_vals;
692
  GimpTextJustification justify = 0;
693

694
  return_vals = gimp_run_procedure ("gimp-text-layer-get-justification",
695 696 697 698 699
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
700
    justify = return_vals[1].data.d_int32;
701 702 703

  gimp_destroy_params (return_vals, nreturn_vals);

704
  return justify;
705 706 707
}

/**
708
 * gimp_text_layer_set_justification:
709
 * @layer_ID: The text layer.
710
 * @justify: The justification for your text.
711
 *
712
 * Set the justification of the text in a text layer.
713
 *
714 715
 * This procedure sets the alignment of the lines in the text layer
 * relative to each other.
716
 *
717
 * Returns: TRUE on success.
718
 *
719
 * Since: 2.6
720
 **/
721
gboolean
722 723
gimp_text_layer_set_justification (gint32                layer_ID,
                                   GimpTextJustification justify)
724 725 726
{
  GimpParam *return_vals;
  gint nreturn_vals;
727
  gboolean success = TRUE;
728

729
  return_vals = gimp_run_procedure ("gimp-text-layer-set-justification",
730 731
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
732
                                    GIMP_PDB_INT32, justify,
733 734
                                    GIMP_PDB_END);

735
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
736 737 738

  gimp_destroy_params (return_vals, nreturn_vals);

739
  return success;
740 741 742
}

/**
743
 * gimp_text_layer_get_color:
744
 * @layer_ID: The text layer.
745
 * @color: The color of the text.
746
 *
747
 * Get the color of the text in a text layer.
748
 *
749
 * This procedure returns the color of the text in a text layer.
750
 *
751
 * Returns: TRUE on success.
752
 *
753
 * Since: 2.6
754
 **/
755
gboolean
756 757
gimp_text_layer_get_color (gint32   layer_ID,
                           GimpRGB *color)
758 759 760
{
  GimpParam *return_vals;
  gint nreturn_vals;
761
  gboolean success = TRUE;
762

763
  return_vals = gimp_run_procedure ("gimp-text-layer-get-color",
764 765 766 767
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

768 769 770 771
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    *color = return_vals[1].data.d_color;
772 773 774

  gimp_destroy_params (return_vals, nreturn_vals);

775
  return success;
776 777 778
}

/**
779
 * gimp_text_layer_set_color:
780
 * @layer_ID: The text layer.
781
 * @color: The color to use for the text.
782
 *
783
 * Set the color of the text in the text layer.
784
 *
785
 * This procedure sets the text color in the text layer 'layer'.
786
 *
787
 * Returns: TRUE on success.
788
 *
789
 * Since: 2.6
790
 **/
791 792 793
gboolean
gimp_text_layer_set_color (gint32         layer_ID,
                           const GimpRGB *color)
794 795 796
{
  GimpParam *return_vals;
  gint nreturn_vals;
797
  gboolean success = TRUE;
798

799
  return_vals = gimp_run_procedure ("gimp-text-layer-set-color",
800 801
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
802
                                    GIMP_PDB_COLOR, color,
803 804
                                    GIMP_PDB_END);

805
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
806 807 808

  gimp_destroy_params (return_vals, nreturn_vals);

809
  return success;
810 811 812
}

/**
813
 * gimp_text_layer_get_indent:
814 815
 * @layer_ID: The text layer.
 *
816
 * Get the line indentation of text layer.
817
 *
818 819
 * This procedure returns the indentation of the first line in a text
 * layer.
820
 *
821
 * Returns: The indentation value of the first line.
822
 *
823
 * Since: 2.6
824
 **/
825 826
gdouble
gimp_text_layer_get_indent (gint32 layer_ID)
827 828 829
{
  GimpParam *return_vals;
  gint nreturn_vals;
830
  gdouble indent = 0.0;
831

832
  return_vals = gimp_run_procedure ("gimp-text-layer-get-indent",
833 834 835 836 837
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
838
    indent = return_vals[1].data.d_float;
839 840 841

  gimp_destroy_params (return_vals, nreturn_vals);

842
  return indent;
843 844 845
}

/**
846
 * gimp_text_layer_set_indent:
847
 * @layer_ID: The text layer.
848
 * @indent: The indentation for the first line.
849
 *
850
 * Set the indentation of the first line in a text layer.
851
 *
852 853
 * This procedure sets the indentation of the first line in the text
 * layer.
854
 *
855
 * Returns: TRUE on success.
856
 *
857
 * Since: 2.6
858
 **/
859 860 861
gboolean
gimp_text_layer_set_indent (gint32  layer_ID,
                            gdouble indent)
862 863 864
{
  GimpParam *return_vals;
  gint nreturn_vals;
865
  gboolean success = TRUE;
866

867
  return_vals = gimp_run_procedure ("gimp-text-layer-set-indent",
868 869
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
870
                                    GIMP_PDB_FLOAT, indent,
871 872
                                    GIMP_PDB_END);

873
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
874 875 876

  gimp_destroy_params (return_vals, nreturn_vals);

877
  return success;
878 879 880
}

/**
881
 * gimp_text_layer_get_line_spacing:
882 883
 * @layer_ID: The text layer.
 *
884
 * Get the spacing between lines of text.
885
 *
886 887
 * This procedure returns the line-spacing between lines of text in a
 * text layer.
888
 *
889
 * Returns: The line-spacing value.
890
 *
891
 * Since: 2.6
892
 **/
893 894
gdouble
gimp_text_layer_get_line_spacing (gint32 layer_ID)
895 896 897
{
  GimpParam *return_vals;
  gint nreturn_vals;
898
  gdouble line_spacing = 0.0;
899

900
  return_vals = gimp_run_procedure ("gimp-text-layer-get-line-spacing",
901 902 903 904
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

905 906
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    line_spacing = return_vals[1].data.d_float;
907 908 909

  gimp_destroy_params (return_vals, nreturn_vals);

910
  return line_spacing;
911 912 913
}

/**
914
 * gimp_text_layer_set_line_spacing:
915
 * @layer_ID: The text layer.
916
 * @line_spacing: The additional line spacing to use.
917
 *
918
 * Adjust the line spacing in a text layer.
919
 *
920
 * This procedure sets the additional spacing used between lines a text
921 922
 * layer.
 *
923
 * Returns: TRUE on success.
924
 *
925
 * Since: 2.6
926
 **/
927 928 929
gboolean
gimp_text_layer_set_line_spacing (gint32  layer_ID,
                                  gdouble line_spacing)
930 931 932
{
  GimpParam *return_vals;
  gint nreturn_vals;
933
  gboolean success = TRUE;
934

935
  return_vals = gimp_run_procedure ("gimp-text-layer-set-line-spacing",
936 937
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
938
                                    GIMP_PDB_FLOAT, line_spacing,
939 940
                                    GIMP_PDB_END);

941
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
942 943 944

  gimp_destroy_params (return_vals, nreturn_vals);

945
  return success;
946 947 948
}

/**
949
 * gimp_text_layer_get_letter_spacing:
950 951
 * @layer_ID: The text layer.
 *
952
 * Get the letter spacing used in a text layer.
953
 *
954
 * This procedure returns the additional spacing between the single
955
 * glyphs in a text layer.
956
 *
957
 * Returns: The letter-spacing value.
958
 *
959
 * Since: 2.6
960
 **/
961
gdouble
962
gimp_text_layer_get_letter_spacing (gint32 layer_ID)
963 964 965
{
  GimpParam *return_vals;
  gint nreturn_vals;
966
  gdouble letter_spacing = 0.0;
967

968
  return_vals = gimp_run_procedure ("gimp-text-layer-get-letter-spacing",
969 970 971 972 973
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
974
    letter_spacing = return_vals[1].data.d_float;
975 976 977

  gimp_destroy_params (return_vals, nreturn_vals);

978
  return letter_spacing;
979 980 981
}

/**
982
 * gimp_text_layer_set_letter_spacing:
983
 * @layer_ID: The text layer.
984
 * @letter_spacing: The additional letter spacing to use.
985
 *
986
 * Adjust the letter spacing in a text layer.
987
 *
988 989
 * This procedure sets the additional spacing between the single glyphs
 * in a text layer.
990
 *
991
 * Returns: TRUE on success.
992
 *
993
 * Since: 2.6
994
 **/
995 996 997
gboolean
gimp_text_layer_set_letter_spacing (gint32  layer_ID,
                                    gdouble letter_spacing)
998 999 1000
{
  GimpParam *return_vals;
  gint nreturn_vals;
1001
  gboolean success = TRUE;
1002

1003
  return_vals = gimp_run_procedure ("gimp-text-layer-set-letter-spacing",
1004 1005
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
1006
                                    GIMP_PDB_FLOAT, letter_spacing,
1007 1008
                                    GIMP_PDB_END);

1009
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1010 1011 1012

  gimp_destroy_params (return_vals, nreturn_vals);

1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
  return success;
}

/**
 * gimp_text_layer_resize:
 * @layer_ID: The text layer.
 * @width: The new box width in pixels.
 * @height: The new box height in pixels.
 *
 * Resize the box of a text layer.
 *
 * This procedure changes the width and height of a text layer while
 * keeping it as a text layer and not converting it to a bitmap like
 * gimp_layer_resize() would do.
 *
 * Returns: TRUE on success.
 *
1030
 * Since: 2.8
1031
 **/
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
gboolean
gimp_text_layer_resize (gint32  layer_ID,
                        gdouble width,
                        gdouble height)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-text-layer-resize",
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_FLOAT, width,
                                    GIMP_PDB_FLOAT, height,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

1052
  return success;
1053
}