gimptextlayer_pdb.c 27.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimptextlayer_pdb.c
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * 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
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

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

#include "config.h"

#include "gimp.h"
27 28 29
#undef GIMP_DISABLE_DEPRECATED
#undef __GIMP_TEXT_LAYER_PDB_H__
#include "gimptextlayer_pdb.h"
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 80

/**
 * 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;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

109
  return text;
110 111 112
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

175
  return font;
176 177 178
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

248
  return font_size;
249 250 251
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

319
  return antialias;
320 321 322
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

388
  return style;
389 390 391
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

457
  return kerning;
458 459 460
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

524
  return language;
525 526 527
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

559
  return success;
560 561 562
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

592
  return direction;
593 594 595
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

627
  return success;
628 629 630
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

660
  return justify;
661 662 663
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

695
  return success;
696 697 698
}

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

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

731
  return success;
732 733 734
}

/**
735
 * gimp_text_layer_set_color:
736
 * @layer_ID: The text layer.
737
 * @color: The color to use for the text.
738
 *
739
 * Set the color of the text in the text layer.
740
 *
741
 * This procedure sets the text color in the text layer 'layer'.
742
 *
743
 * Returns: TRUE on success.
744 745 746
 *
 * Since: GIMP 2.6
 */
747 748 749
gboolean
gimp_text_layer_set_color (gint32         layer_ID,
                           const GimpRGB *color)
750 751 752
{
  GimpParam *return_vals;
  gint nreturn_vals;
753
  gboolean success = TRUE;
754

755
  return_vals = gimp_run_procedure ("gimp-text-layer-set-color",
756 757
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
758
                                    GIMP_PDB_COLOR, color,
759 760
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

765
  return success;
766 767 768
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

798
  return indent;
799 800 801
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

833
  return success;
834 835 836
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

866
  return line_spacing;
867 868 869
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

901
  return success;
902 903 904
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

934
  return letter_spacing;
935 936 937
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

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

/**
 * gimp_text_layer_get_hinting:
 * @layer_ID: The text layer.
 * @autohint: A flag which is true if the text layer is forced to use the autohinter from FreeType.
 *
 * This procedure is deprecated! Use gimp_text_layer_get_hint_style()
 * instead.
 *
 * Returns: A flag which is true if hinting is used on the font.
 */
gboolean
gimp_text_layer_get_hinting (gint32    layer_ID,
                             gboolean *autohint)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean hinting = FALSE;

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

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    {
      hinting = return_vals[1].data.d_int32;
      *autohint = return_vals[2].data.d_int32;
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return hinting;
}

/**
 * gimp_text_layer_set_hinting:
 * @layer_ID: The text layer.
 * @hinting: Enable/disable the use of hinting on the text.
 * @autohint: Force the use of the autohinter provided through FreeType.
 *
 * This procedure is deprecated! Use gimp_text_layer_set_hint_style()
 * instead.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.6
 */
gboolean
gimp_text_layer_set_hinting (gint32   layer_ID,
                             gboolean hinting,
                             gboolean autohint)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-text-layer-set-hinting",
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_INT32, hinting,
                                    GIMP_PDB_INT32, autohint,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}