gimptextlayer_pdb.c 29.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 18
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
19 20 21 22 23 24 25
 */

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

#include "config.h"

#include "gimp.h"
26 27 28
#undef GIMP_DISABLE_DEPRECATED
#undef __GIMP_TEXT_LAYER_PDB_H__
#include "gimptextlayer_pdb.h"
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

/**
 * 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
 * using gimp_image_add_layer().
 *
 * Returns: The new text layer.
 *
 * Since: GIMP 2.6
 */
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;
}

/**
80
 * gimp_text_layer_get_text:
81 82
 * @layer_ID: The text layer.
 *
83
 * Get the text from a text layer as string.
84
 *
85
 * This procedure returns the text from a text layer as a string.
86
 *
87
 * Returns: The text from the specified text layer.
88 89 90
 *
 * Since: GIMP 2.6
 */
91 92
gchar *
gimp_text_layer_get_text (gint32 layer_ID)
93 94 95
{
  GimpParam *return_vals;
  gint nreturn_vals;
96
  gchar *text = NULL;
97

98
  return_vals = gimp_run_procedure ("gimp-text-layer-get-text",
99 100 101 102
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

103 104
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    text = g_strdup (return_vals[1].data.d_string);
105 106 107

  gimp_destroy_params (return_vals, nreturn_vals);

108
  return text;
109 110 111
}

/**
112
 * gimp_text_layer_set_text:
113
 * @layer_ID: The text layer.
114
 * @text: The new text to set.
115
 *
116
 * Set the text of a text layer.
117
 *
118
 * This procedure changes the text of a text layer.
119 120 121 122 123 124
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
125 126
gimp_text_layer_set_text (gint32       layer_ID,
                          const gchar *text)
127 128 129 130 131
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

132
  return_vals = gimp_run_procedure ("gimp-text-layer-set-text",
133 134
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
135
                                    GIMP_PDB_STRING, text,
136 137 138 139 140 141 142 143 144
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
/**
 * 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
 * http://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.
 *
 * Returns: The markup which represents the style of the specified text layer.
 *
 * Since: GIMP 2.8
 */
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;
}

181
/**
182
 * gimp_text_layer_get_font:
183 184
 * @layer_ID: The text layer.
 *
185
 * Get the font from a text layer as string.
186
 *
187
 * This procedure returns the name of the font from a text layer.
188
 *
189
 * Returns: The font which is used in the specified text layer.
190 191 192
 *
 * Since: GIMP 2.6
 */
193 194
gchar *
gimp_text_layer_get_font (gint32 layer_ID)
195 196 197
{
  GimpParam *return_vals;
  gint nreturn_vals;
198
  gchar *font = NULL;
199

200
  return_vals = gimp_run_procedure ("gimp-text-layer-get-font",
201 202 203 204
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

205 206
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    font = g_strdup (return_vals[1].data.d_string);
207 208 209

  gimp_destroy_params (return_vals, nreturn_vals);

210
  return font;
211 212 213
}

/**
214
 * gimp_text_layer_set_font:
215
 * @layer_ID: The text layer.
216
 * @font: The new font to use.
217
 *
218
 * Set the font of a text layer.
219
 *
220
 * This procedure modifies the font used in the specified text layer.
221 222 223 224 225 226
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
227 228
gimp_text_layer_set_font (gint32       layer_ID,
                          const gchar *font)
229 230 231 232 233
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

234
  return_vals = gimp_run_procedure ("gimp-text-layer-set-font",
235 236
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
237
                                    GIMP_PDB_STRING, font,
238 239 240 241 242 243 244 245 246 247
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
248
 * gimp_text_layer_get_font_size:
249
 * @layer_ID: The text layer.
250
 * @unit: The unit used for the font size.
251
 *
252
 * Get the font size from a text layer.
253
 *
254 255 256
 * 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.
257
 *
258
 * Returns: The font size.
259 260 261
 *
 * Since: GIMP 2.6
 */
262 263 264
gdouble
gimp_text_layer_get_font_size (gint32    layer_ID,
                               GimpUnit *unit)
265 266 267
{
  GimpParam *return_vals;
  gint nreturn_vals;
268
  gdouble font_size = 0.0;
269

270
  return_vals = gimp_run_procedure ("gimp-text-layer-get-font-size",
271 272 273 274
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

275 276 277 278 279
  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;
    }
280 281 282

  gimp_destroy_params (return_vals, nreturn_vals);

283
  return font_size;
284 285 286
}

/**
287
 * gimp_text_layer_set_font_size:
288
 * @layer_ID: The text layer.
289 290
 * @font_size: The font size.
 * @unit: The unit to use for the font size.
291
 *
292
 * Set the font size.
293
 *
294 295
 * This procedure changes the font size of a text layer. The size of
 * your font will be a double 'font-size' of 'unit' units.
296 297 298 299 300 301
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
302 303 304
gimp_text_layer_set_font_size (gint32   layer_ID,
                               gdouble  font_size,
                               GimpUnit unit)
305 306 307 308 309
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

310
  return_vals = gimp_run_procedure ("gimp-text-layer-set-font-size",
311 312
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
313 314
                                    GIMP_PDB_FLOAT, font_size,
                                    GIMP_PDB_INT32, unit,
315 316 317 318 319 320 321 322 323 324
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
325
 * gimp_text_layer_get_antialias:
326 327
 * @layer_ID: The text layer.
 *
328
 * Check if antialiasing is used in the text layer.
329
 *
330 331
 * This procedure checks if antialiasing is enabled in the specified
 * text layer.
332
 *
333
 * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
334 335 336 337
 *
 * Since: GIMP 2.6
 */
gboolean
338
gimp_text_layer_get_antialias (gint32 layer_ID)
339 340 341
{
  GimpParam *return_vals;
  gint nreturn_vals;
342
  gboolean antialias = FALSE;
343

344
  return_vals = gimp_run_procedure ("gimp-text-layer-get-antialias",
345 346 347 348
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

349
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
350
    antialias = return_vals[1].data.d_int32;
351 352 353

  gimp_destroy_params (return_vals, nreturn_vals);

354
  return antialias;
355 356 357
}

/**
358
 * gimp_text_layer_set_antialias:
359
 * @layer_ID: The text layer.
360
 * @antialias: Enable/disable antialiasing of the text.
361
 *
362
 * Enable/disable anti-aliasing in a text layer.
363
 *
364 365
 * This procedure enables or disables anti-aliasing of the text in a
 * text layer.
366 367 368 369 370 371
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
372 373
gimp_text_layer_set_antialias (gint32   layer_ID,
                               gboolean antialias)
374 375 376 377 378
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

379
  return_vals = gimp_run_procedure ("gimp-text-layer-set-antialias",
380 381
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
382
                                    GIMP_PDB_INT32, antialias,
383 384 385 386 387 388 389 390 391 392
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
393
 * gimp_text_layer_get_hint_style:
394 395
 * @layer_ID: The text layer.
 *
396
 * Get information about hinting in the specified text layer.
397
 *
398 399 400
 * 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.
401
 *
402
 * Returns: The hint style used for font outlines.
403
 *
404
 * Since: GIMP 2.8
405
 */
406 407
GimpTextHintStyle
gimp_text_layer_get_hint_style (gint32 layer_ID)
408 409 410
{
  GimpParam *return_vals;
  gint nreturn_vals;
411
  GimpTextHintStyle style = 0;
412

413
  return_vals = gimp_run_procedure ("gimp-text-layer-get-hint-style",
414 415 416 417
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

418
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
419
    style = return_vals[1].data.d_int32;
420 421 422

  gimp_destroy_params (return_vals, nreturn_vals);

423
  return style;
424 425 426
}

/**
427
 * gimp_text_layer_set_hint_style:
428
 * @layer_ID: The text layer.
429
 * @style: The new hint style.
430
 *
431
 * Control how font outlines are hinted in a text layer.
432
 *
433 434 435
 * 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.
436 437 438
 *
 * Returns: TRUE on success.
 *
439
 * Since: GIMP 2.8
440 441
 */
gboolean
442 443
gimp_text_layer_set_hint_style (gint32            layer_ID,
                                GimpTextHintStyle style)
444 445 446 447 448
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

449
  return_vals = gimp_run_procedure ("gimp-text-layer-set-hint-style",
450 451
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
452
                                    GIMP_PDB_INT32, style,
453 454 455 456 457 458 459 460 461 462
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
463
 * gimp_text_layer_get_kerning:
464 465
 * @layer_ID: The text layer.
 *
466
 * Check if kerning is used in the text layer.
467
 *
468
 * This procedure checks if kerning is enabled in the specified text
469 470
 * layer.
 *
471
 * Returns: A flag which is true if kerning is used in the text layer.
472 473 474 475
 *
 * Since: GIMP 2.6
 */
gboolean
476
gimp_text_layer_get_kerning (gint32 layer_ID)
477 478 479
{
  GimpParam *return_vals;
  gint nreturn_vals;
480
  gboolean kerning = FALSE;
481

482
  return_vals = gimp_run_procedure ("gimp-text-layer-get-kerning",
483 484 485 486
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

487 488
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    kerning = return_vals[1].data.d_int32;
489 490 491

  gimp_destroy_params (return_vals, nreturn_vals);

492
  return kerning;
493 494 495
}

/**
496
 * gimp_text_layer_set_kerning:
497
 * @layer_ID: The text layer.
498
 * @kerning: Enable/disable kerning in the text.
499
 *
500
 * Enable/disable kerning in a text layer.
501
 *
502
 * This procedure enables or disables kerning in a text layer.
503 504 505 506 507 508
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
509 510
gimp_text_layer_set_kerning (gint32   layer_ID,
                             gboolean kerning)
511 512 513 514 515
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

516
  return_vals = gimp_run_procedure ("gimp-text-layer-set-kerning",
517 518
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
519
                                    GIMP_PDB_INT32, kerning,
520 521 522 523 524 525 526 527 528 529
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
530
 * gimp_text_layer_get_language:
531 532
 * @layer_ID: The text layer.
 *
533
 * Get the language used in the text layer.
534
 *
535 536
 * This procedure returns the language string which is set for the text
 * in the text layer.
537
 *
538
 * Returns: The language used in the text layer.
539 540 541
 *
 * Since: GIMP 2.6
 */
542 543
gchar *
gimp_text_layer_get_language (gint32 layer_ID)
544 545 546
{
  GimpParam *return_vals;
  gint nreturn_vals;
547
  gchar *language = NULL;
548

549
  return_vals = gimp_run_procedure ("gimp-text-layer-get-language",
550 551 552 553
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

554 555
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    language = g_strdup (return_vals[1].data.d_string);
556 557 558

  gimp_destroy_params (return_vals, nreturn_vals);

559
  return language;
560 561 562
}

/**
563
 * gimp_text_layer_set_language:
564
 * @layer_ID: The text layer.
565
 * @language: The new language to use for the text layer.
566
 *
567
 * Set the language of the text layer.
568
 *
569 570
 * 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.
571
 *
572
 * Returns: TRUE on success.
573 574 575
 *
 * Since: GIMP 2.6
 */
576 577 578
gboolean
gimp_text_layer_set_language (gint32       layer_ID,
                              const gchar *language)
579 580 581
{
  GimpParam *return_vals;
  gint nreturn_vals;
582
  gboolean success = TRUE;
583

584
  return_vals = gimp_run_procedure ("gimp-text-layer-set-language",
585 586
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
587
                                    GIMP_PDB_STRING, language,
588 589
                                    GIMP_PDB_END);

590
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
591 592 593

  gimp_destroy_params (return_vals, nreturn_vals);

594
  return success;
595 596 597
}

/**
598
 * gimp_text_layer_get_base_direction:
599 600
 * @layer_ID: The text layer.
 *
601
 * Get the base direction used for rendering the text layer.
602
 *
603 604
 * This procedure returns the base direction used for rendering the
 * text in the text layer
605
 *
606
 * Returns: The based direction used for the text layer.
607 608 609
 *
 * Since: GIMP 2.6
 */
610 611
GimpTextDirection
gimp_text_layer_get_base_direction (gint32 layer_ID)
612 613 614
{
  GimpParam *return_vals;
  gint nreturn_vals;
615
  GimpTextDirection direction = 0;
616

617
  return_vals = gimp_run_procedure ("gimp-text-layer-get-base-direction",
618 619 620 621 622
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
623
    direction = return_vals[1].data.d_int32;
624 625 626

  gimp_destroy_params (return_vals, nreturn_vals);

627
  return direction;
628 629 630
}

/**
631
 * gimp_text_layer_set_base_direction:
632
 * @layer_ID: The text layer.
633
 * @direction: The base direction of the text.
634
 *
635
 * Set the base direction in the text layer.
636
 *
637 638
 * This procedure sets the base direction used in applying the Unicode
 * bidirectional algorithm when rendering the text.
639
 *
640
 * Returns: TRUE on success.
641 642 643
 *
 * Since: GIMP 2.6
 */
644 645 646
gboolean
gimp_text_layer_set_base_direction (gint32            layer_ID,
                                    GimpTextDirection direction)
647 648 649
{
  GimpParam *return_vals;
  gint nreturn_vals;
650
  gboolean success = TRUE;
651

652
  return_vals = gimp_run_procedure ("gimp-text-layer-set-base-direction",
653 654
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
655
                                    GIMP_PDB_INT32, direction,
656 657
                                    GIMP_PDB_END);

658
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
659 660 661

  gimp_destroy_params (return_vals, nreturn_vals);

662
  return success;
663 664 665
}

/**
666
 * gimp_text_layer_get_justification:
667 668
 * @layer_ID: The text layer.
 *
669
 * Get the text justification information of the text layer.
670
 *
671 672
 * This procedure returns the alignment of the lines in the text layer
 * relative to each other.
673
 *
674
 * Returns: The justification used in the text layer.
675 676 677
 *
 * Since: GIMP 2.6
 */
678 679
GimpTextJustification
gimp_text_layer_get_justification (gint32 layer_ID)
680 681 682
{
  GimpParam *return_vals;
  gint nreturn_vals;
683
  GimpTextJustification justify = 0;
684

685
  return_vals = gimp_run_procedure ("gimp-text-layer-get-justification",
686 687 688 689 690
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
691
    justify = return_vals[1].data.d_int32;
692 693 694

  gimp_destroy_params (return_vals, nreturn_vals);

695
  return justify;
696 697 698
}

/**
699
 * gimp_text_layer_set_justification:
700
 * @layer_ID: The text layer.
701
 * @justify: The justification for your text.
702
 *
703
 * Set the justification of the text in a text layer.
704
 *
705 706
 * This procedure sets the alignment of the lines in the text layer
 * relative to each other.
707
 *
708
 * Returns: TRUE on success.
709 710 711 712
 *
 * Since: GIMP 2.6
 */
gboolean
713 714
gimp_text_layer_set_justification (gint32                layer_ID,
                                   GimpTextJustification justify)
715 716 717
{
  GimpParam *return_vals;
  gint nreturn_vals;
718
  gboolean success = TRUE;
719

720
  return_vals = gimp_run_procedure ("gimp-text-layer-set-justification",
721 722
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
723
                                    GIMP_PDB_INT32, justify,
724 725
                                    GIMP_PDB_END);

726
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
727 728 729

  gimp_destroy_params (return_vals, nreturn_vals);

730
  return success;
731 732 733
}

/**
734
 * gimp_text_layer_get_color:
735
 * @layer_ID: The text layer.
736
 * @color: The color of the text.
737
 *
738
 * Get the color of the text in a text layer.
739
 *
740
 * This procedure returns the color of the text in a text layer.
741
 *
742
 * Returns: TRUE on success.
743 744 745 746
 *
 * Since: GIMP 2.6
 */
gboolean
747 748
gimp_text_layer_get_color (gint32   layer_ID,
                           GimpRGB *color)
749 750 751
{
  GimpParam *return_vals;
  gint nreturn_vals;
752
  gboolean success = TRUE;
753

754
  return_vals = gimp_run_procedure ("gimp-text-layer-get-color",
755 756 757 758
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

759 760 761 762
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    *color = return_vals[1].data.d_color;
763 764 765

  gimp_destroy_params (return_vals, nreturn_vals);

766
  return success;
767 768 769
}

/**
770
 * gimp_text_layer_set_color:
771
 * @layer_ID: The text layer.
772
 * @color: The color to use for the text.
773
 *
774
 * Set the color of the text in the text layer.
775
 *
776
 * This procedure sets the text color in the text layer 'layer'.
777
 *
778
 * Returns: TRUE on success.
779 780 781
 *
 * Since: GIMP 2.6
 */
782 783 784
gboolean
gimp_text_layer_set_color (gint32         layer_ID,
                           const GimpRGB *color)
785 786 787
{
  GimpParam *return_vals;
  gint nreturn_vals;
788
  gboolean success = TRUE;
789

790
  return_vals = gimp_run_procedure ("gimp-text-layer-set-color",
791 792
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
793
                                    GIMP_PDB_COLOR, color,
794 795
                                    GIMP_PDB_END);

796
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
797 798 799

  gimp_destroy_params (return_vals, nreturn_vals);

800
  return success;
801 802 803
}

/**
804
 * gimp_text_layer_get_indent:
805 806
 * @layer_ID: The text layer.
 *
807
 * Get the line indentation of text layer.
808
 *
809 810
 * This procedure returns the indentation of the first line in a text
 * layer.
811
 *
812
 * Returns: The indentation value of the first line.
813 814 815
 *
 * Since: GIMP 2.6
 */
816 817
gdouble
gimp_text_layer_get_indent (gint32 layer_ID)
818 819 820
{
  GimpParam *return_vals;
  gint nreturn_vals;
821
  gdouble indent = 0.0;
822

823
  return_vals = gimp_run_procedure ("gimp-text-layer-get-indent",
824 825 826 827 828
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
829
    indent = return_vals[1].data.d_float;
830 831 832

  gimp_destroy_params (return_vals, nreturn_vals);

833
  return indent;
834 835 836
}

/**
837
 * gimp_text_layer_set_indent:
838
 * @layer_ID: The text layer.
839
 * @indent: The indentation for the first line.
840
 *
841
 * Set the indentation of the first line in a text layer.
842
 *
843 844
 * This procedure sets the indentation of the first line in the text
 * layer.
845
 *
846
 * Returns: TRUE on success.
847 848 849
 *
 * Since: GIMP 2.6
 */
850 851 852
gboolean
gimp_text_layer_set_indent (gint32  layer_ID,
                            gdouble indent)
853 854 855
{
  GimpParam *return_vals;
  gint nreturn_vals;
856
  gboolean success = TRUE;
857

858
  return_vals = gimp_run_procedure ("gimp-text-layer-set-indent",
859 860
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
861
                                    GIMP_PDB_FLOAT, indent,
862 863
                                    GIMP_PDB_END);

864
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
865 866 867

  gimp_destroy_params (return_vals, nreturn_vals);

868
  return success;
869 870 871
}

/**
872
 * gimp_text_layer_get_line_spacing:
873 874
 * @layer_ID: The text layer.
 *
875
 * Get the spacing between lines of text.
876
 *
877 878
 * This procedure returns the line-spacing between lines of text in a
 * text layer.
879
 *
880
 * Returns: The line-spacing value.
881 882 883
 *
 * Since: GIMP 2.6
 */
884 885
gdouble
gimp_text_layer_get_line_spacing (gint32 layer_ID)
886 887 888
{
  GimpParam *return_vals;
  gint nreturn_vals;
889
  gdouble line_spacing = 0.0;
890

891
  return_vals = gimp_run_procedure ("gimp-text-layer-get-line-spacing",
892 893 894 895
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

896 897
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    line_spacing = return_vals[1].data.d_float;
898 899 900

  gimp_destroy_params (return_vals, nreturn_vals);

901
  return line_spacing;
902 903 904
}

/**
905
 * gimp_text_layer_set_line_spacing:
906
 * @layer_ID: The text layer.
907
 * @line_spacing: The additional line spacing to use.
908
 *
909
 * Adjust the line spacing in a text layer.
910
 *
911
 * This procedure sets the additional spacing used between lines a text
912 913
 * layer.
 *
914
 * Returns: TRUE on success.
915 916 917
 *
 * Since: GIMP 2.6
 */
918 919 920
gboolean
gimp_text_layer_set_line_spacing (gint32  layer_ID,
                                  gdouble line_spacing)
921 922 923
{
  GimpParam *return_vals;
  gint nreturn_vals;
924
  gboolean success = TRUE;
925

926
  return_vals = gimp_run_procedure ("gimp-text-layer-set-line-spacing",
927 928
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
929
                                    GIMP_PDB_FLOAT, line_spacing,
930 931
                                    GIMP_PDB_END);

932
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
933 934 935

  gimp_destroy_params (return_vals, nreturn_vals);

936
  return success;
937 938 939
}

/**
940
 * gimp_text_layer_get_letter_spacing:
941 942
 * @layer_ID: The text layer.
 *
943
 * Get the letter spacing used in a text layer.
944
 *
945 946
 * This procedure returns the additional spacing between the single
 * glyps in a text layer.
947
 *
948
 * Returns: The letter-spacing value.
949 950 951 952
 *
 * Since: GIMP 2.6
 */
gdouble
953
gimp_text_layer_get_letter_spacing (gint32 layer_ID)
954 955 956
{
  GimpParam *return_vals;
  gint nreturn_vals;
957
  gdouble letter_spacing = 0.0;
958

959
  return_vals = gimp_run_procedure ("gimp-text-layer-get-letter-spacing",
960 961 962 963 964
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
965
    letter_spacing = return_vals[1].data.d_float;
966 967 968

  gimp_destroy_params (return_vals, nreturn_vals);

969
  return letter_spacing;
970 971 972
}

/**
973
 * gimp_text_layer_set_letter_spacing:
974
 * @layer_ID: The text layer.
975
 * @letter_spacing: The additional letter spacing to use.
976
 *
977
 * Adjust the letter spacing in a text layer.
978
 *
979 980
 * This procedure sets the additional spacing between the single glyphs
 * in a text layer.
981
 *
982
 * Returns: TRUE on success.
983 984 985
 *
 * Since: GIMP 2.6
 */
986 987 988
gboolean
gimp_text_layer_set_letter_spacing (gint32  layer_ID,
                                    gdouble letter_spacing)
989 990 991
{
  GimpParam *return_vals;
  gint nreturn_vals;
992
  gboolean success = TRUE;
993

994
  return_vals = gimp_run_procedure ("gimp-text-layer-set-letter-spacing",
995 996
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
997
                                    GIMP_PDB_FLOAT, letter_spacing,
998 999
                                    GIMP_PDB_END);

1000
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1001 1002 1003

  gimp_destroy_params (return_vals, nreturn_vals);

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