gimptextlayer_pdb.c 28.7 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 145
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
146
 * gimp_text_layer_get_font:
147 148
 * @layer_ID: The text layer.
 *
149
 * Get the font from a text layer as string.
150
 *
151
 * This procedure returns the name of the font from a text layer.
152
 *
153
 * Returns: The font which is used in the specified text layer.
154 155 156
 *
 * Since: GIMP 2.6
 */
157 158
gchar *
gimp_text_layer_get_font (gint32 layer_ID)
159 160 161
{
  GimpParam *return_vals;
  gint nreturn_vals;
162
  gchar *font = NULL;
163

164
  return_vals = gimp_run_procedure ("gimp-text-layer-get-font",
165 166 167 168
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

169 170
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    font = g_strdup (return_vals[1].data.d_string);
171 172 173

  gimp_destroy_params (return_vals, nreturn_vals);

174
  return font;
175 176 177
}

/**
178
 * gimp_text_layer_set_font:
179
 * @layer_ID: The text layer.
180
 * @font: The new font to use.
181
 *
182
 * Set the font of a text layer.
183
 *
184
 * This procedure modifies the font used in the specified text layer.
185 186 187 188 189 190
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
191 192
gimp_text_layer_set_font (gint32       layer_ID,
                          const gchar *font)
193 194 195 196 197
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

198
  return_vals = gimp_run_procedure ("gimp-text-layer-set-font",
199 200
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
201
                                    GIMP_PDB_STRING, font,
202 203 204 205 206 207 208 209 210 211
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
212
 * gimp_text_layer_get_font_size:
213
 * @layer_ID: The text layer.
214
 * @unit: The unit used for the font size.
215
 *
216
 * Get the font size from a text layer.
217
 *
218 219 220
 * 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.
221
 *
222
 * Returns: The font size.
223 224 225
 *
 * Since: GIMP 2.6
 */
226 227 228
gdouble
gimp_text_layer_get_font_size (gint32    layer_ID,
                               GimpUnit *unit)
229 230 231
{
  GimpParam *return_vals;
  gint nreturn_vals;
232
  gdouble font_size = 0.0;
233

234
  return_vals = gimp_run_procedure ("gimp-text-layer-get-font-size",
235 236 237 238
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

239 240 241 242 243
  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;
    }
244 245 246

  gimp_destroy_params (return_vals, nreturn_vals);

247
  return font_size;
248 249 250
}

/**
251
 * gimp_text_layer_set_font_size:
252
 * @layer_ID: The text layer.
253 254
 * @font_size: The font size.
 * @unit: The unit to use for the font size.
255
 *
256
 * Set the font size.
257
 *
258 259
 * This procedure changes the font size of a text layer. The size of
 * your font will be a double 'font-size' of 'unit' units.
260 261 262 263 264 265
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
266 267 268
gimp_text_layer_set_font_size (gint32   layer_ID,
                               gdouble  font_size,
                               GimpUnit unit)
269 270 271 272 273
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

274
  return_vals = gimp_run_procedure ("gimp-text-layer-set-font-size",
275 276
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
277 278
                                    GIMP_PDB_FLOAT, font_size,
                                    GIMP_PDB_INT32, unit,
279 280 281 282 283 284 285 286 287 288
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
289
 * gimp_text_layer_get_antialias:
290 291
 * @layer_ID: The text layer.
 *
292
 * Check if antialiasing is used in the text layer.
293
 *
294 295
 * This procedure checks if antialiasing is enabled in the specified
 * text layer.
296
 *
297
 * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
298 299 300 301
 *
 * Since: GIMP 2.6
 */
gboolean
302
gimp_text_layer_get_antialias (gint32 layer_ID)
303 304 305
{
  GimpParam *return_vals;
  gint nreturn_vals;
306
  gboolean antialias = FALSE;
307

308
  return_vals = gimp_run_procedure ("gimp-text-layer-get-antialias",
309 310 311 312
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

313
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
314
    antialias = return_vals[1].data.d_int32;
315 316 317

  gimp_destroy_params (return_vals, nreturn_vals);

318
  return antialias;
319 320 321
}

/**
322
 * gimp_text_layer_set_antialias:
323
 * @layer_ID: The text layer.
324
 * @antialias: Enable/disable antialiasing of the text.
325
 *
326
 * Enable/disable anti-aliasing in a text layer.
327
 *
328 329
 * This procedure enables or disables anti-aliasing of the text in a
 * text layer.
330 331 332 333 334 335
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
336 337
gimp_text_layer_set_antialias (gint32   layer_ID,
                               gboolean antialias)
338 339 340 341 342
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

343
  return_vals = gimp_run_procedure ("gimp-text-layer-set-antialias",
344 345
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
346
                                    GIMP_PDB_INT32, antialias,
347 348 349 350 351 352 353 354 355 356
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
357
 * gimp_text_layer_get_hint_style:
358 359
 * @layer_ID: The text layer.
 *
360
 * Get information about hinting in the specified text layer.
361
 *
362 363 364
 * 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.
365
 *
366
 * Returns: The hint style used for font outlines.
367
 *
368
 * Since: GIMP 2.8
369
 */
370 371
GimpTextHintStyle
gimp_text_layer_get_hint_style (gint32 layer_ID)
372 373 374
{
  GimpParam *return_vals;
  gint nreturn_vals;
375
  GimpTextHintStyle style = 0;
376

377
  return_vals = gimp_run_procedure ("gimp-text-layer-get-hint-style",
378 379 380 381
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

382
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
383
    style = return_vals[1].data.d_int32;
384 385 386

  gimp_destroy_params (return_vals, nreturn_vals);

387
  return style;
388 389 390
}

/**
391
 * gimp_text_layer_set_hint_style:
392
 * @layer_ID: The text layer.
393
 * @style: The new hint style.
394
 *
395
 * Control how font outlines are hinted in a text layer.
396
 *
397 398 399
 * 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.
400 401 402
 *
 * Returns: TRUE on success.
 *
403
 * Since: GIMP 2.8
404 405
 */
gboolean
406 407
gimp_text_layer_set_hint_style (gint32            layer_ID,
                                GimpTextHintStyle style)
408 409 410 411 412
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

413
  return_vals = gimp_run_procedure ("gimp-text-layer-set-hint-style",
414 415
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
416
                                    GIMP_PDB_INT32, style,
417 418 419 420 421 422 423 424 425 426
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
427
 * gimp_text_layer_get_kerning:
428 429
 * @layer_ID: The text layer.
 *
430
 * Check if kerning is used in the text layer.
431
 *
432
 * This procedure checks if kerning is enabled in the specified text
433 434
 * layer.
 *
435
 * Returns: A flag which is true if kerning is used in the text layer.
436 437 438 439
 *
 * Since: GIMP 2.6
 */
gboolean
440
gimp_text_layer_get_kerning (gint32 layer_ID)
441 442 443
{
  GimpParam *return_vals;
  gint nreturn_vals;
444
  gboolean kerning = FALSE;
445

446
  return_vals = gimp_run_procedure ("gimp-text-layer-get-kerning",
447 448 449 450
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

451 452
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    kerning = return_vals[1].data.d_int32;
453 454 455

  gimp_destroy_params (return_vals, nreturn_vals);

456
  return kerning;
457 458 459
}

/**
460
 * gimp_text_layer_set_kerning:
461
 * @layer_ID: The text layer.
462
 * @kerning: Enable/disable kerning in the text.
463
 *
464
 * Enable/disable kerning in a text layer.
465
 *
466
 * This procedure enables or disables kerning in a text layer.
467 468 469 470 471 472
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
473 474
gimp_text_layer_set_kerning (gint32   layer_ID,
                             gboolean kerning)
475 476 477 478 479
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

480
  return_vals = gimp_run_procedure ("gimp-text-layer-set-kerning",
481 482
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
483
                                    GIMP_PDB_INT32, kerning,
484 485 486 487 488 489 490 491 492 493
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
494
 * gimp_text_layer_get_language:
495 496
 * @layer_ID: The text layer.
 *
497
 * Get the language used in the text layer.
498
 *
499 500
 * This procedure returns the language string which is set for the text
 * in the text layer.
501
 *
502
 * Returns: The language used in the text layer.
503 504 505
 *
 * Since: GIMP 2.6
 */
506 507
gchar *
gimp_text_layer_get_language (gint32 layer_ID)
508 509 510
{
  GimpParam *return_vals;
  gint nreturn_vals;
511
  gchar *language = NULL;
512

513
  return_vals = gimp_run_procedure ("gimp-text-layer-get-language",
514 515 516 517
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

518 519
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    language = g_strdup (return_vals[1].data.d_string);
520 521 522

  gimp_destroy_params (return_vals, nreturn_vals);

523
  return language;
524 525 526
}

/**
527
 * gimp_text_layer_set_language:
528
 * @layer_ID: The text layer.
529
 * @language: The new language to use for the text layer.
530
 *
531
 * Set the language of the text layer.
532
 *
533 534
 * 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.
535
 *
536
 * Returns: TRUE on success.
537 538 539
 *
 * Since: GIMP 2.6
 */
540 541 542
gboolean
gimp_text_layer_set_language (gint32       layer_ID,
                              const gchar *language)
543 544 545
{
  GimpParam *return_vals;
  gint nreturn_vals;
546
  gboolean success = TRUE;
547

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

554
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
555 556 557

  gimp_destroy_params (return_vals, nreturn_vals);

558
  return success;
559 560 561
}

/**
562
 * gimp_text_layer_get_base_direction:
563 564
 * @layer_ID: The text layer.
 *
565
 * Get the base direction used for rendering the text layer.
566
 *
567 568
 * This procedure returns the base direction used for rendering the
 * text in the text layer
569
 *
570
 * Returns: The based direction used for the text layer.
571 572 573
 *
 * Since: GIMP 2.6
 */
574 575
GimpTextDirection
gimp_text_layer_get_base_direction (gint32 layer_ID)
576 577 578
{
  GimpParam *return_vals;
  gint nreturn_vals;
579
  GimpTextDirection direction = 0;
580

581
  return_vals = gimp_run_procedure ("gimp-text-layer-get-base-direction",
582 583 584 585 586
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
587
    direction = return_vals[1].data.d_int32;
588 589 590

  gimp_destroy_params (return_vals, nreturn_vals);

591
  return direction;
592 593 594
}

/**
595
 * gimp_text_layer_set_base_direction:
596
 * @layer_ID: The text layer.
597
 * @direction: The base direction of the text.
598
 *
599
 * Set the base direction in the text layer.
600
 *
601 602
 * This procedure sets the base direction used in applying the Unicode
 * bidirectional algorithm when rendering the text.
603
 *
604
 * Returns: TRUE on success.
605 606 607
 *
 * Since: GIMP 2.6
 */
608 609 610
gboolean
gimp_text_layer_set_base_direction (gint32            layer_ID,
                                    GimpTextDirection direction)
611 612 613
{
  GimpParam *return_vals;
  gint nreturn_vals;
614
  gboolean success = TRUE;
615

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

622
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
623 624 625

  gimp_destroy_params (return_vals, nreturn_vals);

626
  return success;
627 628 629
}

/**
630
 * gimp_text_layer_get_justification:
631 632
 * @layer_ID: The text layer.
 *
633
 * Get the text justification information of the text layer.
634
 *
635 636
 * This procedure returns the alignment of the lines in the text layer
 * relative to each other.
637
 *
638
 * Returns: The justification used in the text layer.
639 640 641
 *
 * Since: GIMP 2.6
 */
642 643
GimpTextJustification
gimp_text_layer_get_justification (gint32 layer_ID)
644 645 646
{
  GimpParam *return_vals;
  gint nreturn_vals;
647
  GimpTextJustification justify = 0;
648

649
  return_vals = gimp_run_procedure ("gimp-text-layer-get-justification",
650 651 652 653 654
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
655
    justify = return_vals[1].data.d_int32;
656 657 658

  gimp_destroy_params (return_vals, nreturn_vals);

659
  return justify;
660 661 662
}

/**
663
 * gimp_text_layer_set_justification:
664
 * @layer_ID: The text layer.
665
 * @justify: The justification for your text.
666
 *
667
 * Set the justification of the text in a text layer.
668
 *
669 670
 * This procedure sets the alignment of the lines in the text layer
 * relative to each other.
671
 *
672
 * Returns: TRUE on success.
673 674 675 676
 *
 * Since: GIMP 2.6
 */
gboolean
677 678
gimp_text_layer_set_justification (gint32                layer_ID,
                                   GimpTextJustification justify)
679 680 681
{
  GimpParam *return_vals;
  gint nreturn_vals;
682
  gboolean success = TRUE;
683

684
  return_vals = gimp_run_procedure ("gimp-text-layer-set-justification",
685 686
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
687
                                    GIMP_PDB_INT32, justify,
688 689
                                    GIMP_PDB_END);

690
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
691 692 693

  gimp_destroy_params (return_vals, nreturn_vals);

694
  return success;
695 696 697
}

/**
698
 * gimp_text_layer_get_color:
699
 * @layer_ID: The text layer.
700
 * @color: The color of the text.
701
 *
702
 * Get the color of the text in a text layer.
703
 *
704
 * This procedure returns the color of the text in a text layer.
705
 *
706
 * Returns: TRUE on success.
707 708 709 710
 *
 * Since: GIMP 2.6
 */
gboolean
711 712
gimp_text_layer_get_color (gint32   layer_ID,
                           GimpRGB *color)
713 714 715
{
  GimpParam *return_vals;
  gint nreturn_vals;
716
  gboolean success = TRUE;
717

718
  return_vals = gimp_run_procedure ("gimp-text-layer-get-color",
719 720 721 722
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

723 724 725 726
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    *color = return_vals[1].data.d_color;
727 728 729

  gimp_destroy_params (return_vals, nreturn_vals);

730
  return success;
731 732 733
}

/**
734
 * gimp_text_layer_set_color:
735
 * @layer_ID: The text layer.
736
 * @color: The color to use for the text.
737
 *
738
 * Set the color of the text in the text layer.
739
 *
740
 * This procedure sets the text color in the text layer 'layer'.
741
 *
742
 * Returns: TRUE on success.
743 744 745
 *
 * Since: GIMP 2.6
 */
746 747 748
gboolean
gimp_text_layer_set_color (gint32         layer_ID,
                           const 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-set-color",
755 756
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
757
                                    GIMP_PDB_COLOR, color,
758 759
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

764
  return success;
765 766 767
}

/**
768
 * gimp_text_layer_get_indent:
769 770
 * @layer_ID: The text layer.
 *
771
 * Get the line indentation of text layer.
772
 *
773 774
 * This procedure returns the indentation of the first line in a text
 * layer.
775
 *
776
 * Returns: The indentation value of the first line.
777 778 779
 *
 * Since: GIMP 2.6
 */
780 781
gdouble
gimp_text_layer_get_indent (gint32 layer_ID)
782 783 784
{
  GimpParam *return_vals;
  gint nreturn_vals;
785
  gdouble indent = 0.0;
786

787
  return_vals = gimp_run_procedure ("gimp-text-layer-get-indent",
788 789 790 791 792
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
793
    indent = return_vals[1].data.d_float;
794 795 796

  gimp_destroy_params (return_vals, nreturn_vals);

797
  return indent;
798 799 800
}

/**
801
 * gimp_text_layer_set_indent:
802
 * @layer_ID: The text layer.
803
 * @indent: The indentation for the first line.
804
 *
805
 * Set the indentation of the first line in a text layer.
806
 *
807 808
 * This procedure sets the indentation of the first line in the text
 * layer.
809
 *
810
 * Returns: TRUE on success.
811 812 813
 *
 * Since: GIMP 2.6
 */
814 815 816
gboolean
gimp_text_layer_set_indent (gint32  layer_ID,
                            gdouble indent)
817 818 819
{
  GimpParam *return_vals;
  gint nreturn_vals;
820
  gboolean success = TRUE;
821

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

828
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
829 830 831

  gimp_destroy_params (return_vals, nreturn_vals);

832
  return success;
833 834 835
}

/**
836
 * gimp_text_layer_get_line_spacing:
837 838
 * @layer_ID: The text layer.
 *
839
 * Get the spacing between lines of text.
840
 *
841 842
 * This procedure returns the line-spacing between lines of text in a
 * text layer.
843
 *
844
 * Returns: The line-spacing value.
845 846 847
 *
 * Since: GIMP 2.6
 */
848 849
gdouble
gimp_text_layer_get_line_spacing (gint32 layer_ID)
850 851 852
{
  GimpParam *return_vals;
  gint nreturn_vals;
853
  gdouble line_spacing = 0.0;
854

855
  return_vals = gimp_run_procedure ("gimp-text-layer-get-line-spacing",
856 857 858 859
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

860 861
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    line_spacing = return_vals[1].data.d_float;
862 863 864

  gimp_destroy_params (return_vals, nreturn_vals);

865
  return line_spacing;
866 867 868
}

/**
869
 * gimp_text_layer_set_line_spacing:
870
 * @layer_ID: The text layer.
871
 * @line_spacing: The additional line spacing to use.
872
 *
873
 * Adjust the line spacing in a text layer.
874
 *
875
 * This procedure sets the additional spacing used between lines a text
876 877
 * layer.
 *
878
 * Returns: TRUE on success.
879 880 881
 *
 * Since: GIMP 2.6
 */
882 883 884
gboolean
gimp_text_layer_set_line_spacing (gint32  layer_ID,
                                  gdouble line_spacing)
885 886 887
{
  GimpParam *return_vals;
  gint nreturn_vals;
888
  gboolean success = TRUE;
889

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

896
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
897 898 899

  gimp_destroy_params (return_vals, nreturn_vals);

900
  return success;
901 902 903
}

/**
904
 * gimp_text_layer_get_letter_spacing:
905 906
 * @layer_ID: The text layer.
 *
907
 * Get the letter spacing used in a text layer.
908
 *
909 910
 * This procedure returns the additional spacing between the single
 * glyps in a text layer.
911
 *
912
 * Returns: The letter-spacing value.
913 914 915 916
 *
 * Since: GIMP 2.6
 */
gdouble
917
gimp_text_layer_get_letter_spacing (gint32 layer_ID)
918 919 920
{
  GimpParam *return_vals;
  gint nreturn_vals;
921
  gdouble letter_spacing = 0.0;
922

923
  return_vals = gimp_run_procedure ("gimp-text-layer-get-letter-spacing",
924 925 926 927 928
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
929
    letter_spacing = return_vals[1].data.d_float;
930 931 932

  gimp_destroy_params (return_vals, nreturn_vals);

933
  return letter_spacing;
934 935 936
}

/**
937
 * gimp_text_layer_set_letter_spacing:
938
 * @layer_ID: The text layer.
939
 * @letter_spacing: The additional letter spacing to use.
940
 *
941
 * Adjust the letter spacing in a text layer.
942
 *
943 944
 * This procedure sets the additional spacing between the single glyphs
 * in a text layer.
945
 *
946
 * Returns: TRUE on success.
947 948 949
 *
 * Since: GIMP 2.6
 */
950 951 952
gboolean
gimp_text_layer_set_letter_spacing (gint32  layer_ID,
                                    gdouble letter_spacing)
953 954 955
{
  GimpParam *return_vals;
  gint nreturn_vals;
956
  gboolean success = TRUE;
957

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

964
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
965 966 967

  gimp_destroy_params (return_vals, nreturn_vals);

968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006
  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.
 *
 * Since: GIMP 2.8
 */
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);

1007
  return success;
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