~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/pdb/text_tool_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
26
26
#include "libgimpbase/gimpbase.h"
27
27
 
28
28
#include "pdb-types.h"
29
 
#include "procedural_db.h"
 
29
#include "gimppdb.h"
 
30
#include "gimpprocedure.h"
 
31
#include "core/gimpparamspecs.h"
30
32
 
31
33
#include "core/gimpdrawable.h"
32
34
#include "core/gimpimage.h"
33
35
#include "core/gimplayer.h"
34
36
#include "text/gimptext-compat.h"
35
37
 
36
 
static ProcRecord text_fontname_proc;
37
 
static ProcRecord text_get_extents_fontname_proc;
38
 
static ProcRecord text_proc;
39
 
static ProcRecord text_get_extents_proc;
40
 
 
41
 
void
42
 
register_text_tool_procs (Gimp *gimp)
43
 
{
44
 
  procedural_db_register (gimp, &text_fontname_proc);
45
 
  procedural_db_register (gimp, &text_get_extents_fontname_proc);
46
 
  procedural_db_register (gimp, &text_proc);
47
 
  procedural_db_register (gimp, &text_get_extents_proc);
48
 
}
49
 
 
50
 
static Argument *
51
 
text_fontname_invoker (Gimp         *gimp,
52
 
                       GimpContext  *context,
53
 
                       GimpProgress *progress,
54
 
                       Argument     *args)
 
38
#include "internal_procs.h"
 
39
 
 
40
 
 
41
static GValueArray *
 
42
text_fontname_invoker (GimpProcedure     *procedure,
 
43
                       Gimp              *gimp,
 
44
                       GimpContext       *context,
 
45
                       GimpProgress      *progress,
 
46
                       const GValueArray *args)
55
47
{
56
48
  gboolean success = TRUE;
57
 
  Argument *return_args;
58
 
  GimpImage *gimage;
 
49
  GValueArray *return_vals;
 
50
  GimpImage *image;
59
51
  GimpDrawable *drawable;
60
52
  gdouble x;
61
53
  gdouble y;
62
 
  gchar *text;
 
54
  const gchar *text;
63
55
  gint32 border;
64
56
  gboolean antialias;
65
57
  gdouble size;
66
58
  gint32 size_type;
67
 
  gchar *fontname;
 
59
  const gchar *fontname;
68
60
  GimpLayer *text_layer = NULL;
69
61
 
70
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
71
 
  if (! GIMP_IS_IMAGE (gimage))
72
 
    success = FALSE;
73
 
 
74
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
75
 
 
76
 
  x = args[2].value.pdb_float;
77
 
 
78
 
  y = args[3].value.pdb_float;
79
 
 
80
 
  text = (gchar *) args[4].value.pdb_pointer;
81
 
  if (text == NULL || !g_utf8_validate (text, -1, NULL))
82
 
    success = FALSE;
83
 
 
84
 
  border = args[5].value.pdb_int;
85
 
  if (border < -1)
86
 
    success = FALSE;
87
 
 
88
 
  antialias = args[6].value.pdb_int ? TRUE : FALSE;
89
 
 
90
 
  size = args[7].value.pdb_float;
91
 
  if (size <= 0.0)
92
 
    success = FALSE;
93
 
 
94
 
  size_type = args[8].value.pdb_int;
95
 
  if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS)
96
 
    success = FALSE;
97
 
 
98
 
  fontname = (gchar *) args[9].value.pdb_pointer;
99
 
  if (fontname == NULL || !g_utf8_validate (fontname, -1, NULL))
100
 
    success = FALSE;
 
62
  image = gimp_value_get_image (&args->values[0], gimp);
 
63
  drawable = gimp_value_get_drawable (&args->values[1], gimp);
 
64
  x = g_value_get_double (&args->values[2]);
 
65
  y = g_value_get_double (&args->values[3]);
 
66
  text = g_value_get_string (&args->values[4]);
 
67
  border = g_value_get_int (&args->values[5]);
 
68
  antialias = g_value_get_boolean (&args->values[6]);
 
69
  size = g_value_get_double (&args->values[7]);
 
70
  size_type = g_value_get_enum (&args->values[8]);
 
71
  fontname = g_value_get_string (&args->values[9]);
101
72
 
102
73
  if (success)
103
74
    {
108
79
        {
109
80
          gchar *real_fontname = g_strdup_printf ("%s %d", fontname, (gint) size);
110
81
 
111
 
          text_layer = text_render (gimage, drawable, context,
 
82
          text_layer = text_render (image, drawable, context,
112
83
                                    x, y, real_fontname, text,
113
84
                                    border, antialias);
114
85
 
116
87
        }
117
88
    }
118
89
 
119
 
  return_args = procedural_db_return_args (&text_fontname_proc, success);
 
90
  return_vals = gimp_procedure_get_return_values (procedure, success);
120
91
 
121
92
  if (success)
122
 
    return_args[1].value.pdb_int = text_layer ? gimp_item_get_ID (GIMP_ITEM (text_layer)) : -1;
 
93
    gimp_value_set_layer (&return_vals->values[1], text_layer);
123
94
 
124
 
  return return_args;
 
95
  return return_vals;
125
96
}
126
97
 
127
 
static ProcArg text_fontname_inargs[] =
128
 
{
129
 
  {
130
 
    GIMP_PDB_IMAGE,
131
 
    "image",
132
 
    "The image"
133
 
  },
134
 
  {
135
 
    GIMP_PDB_DRAWABLE,
136
 
    "drawable",
137
 
    "The affected drawable: (-1 for a new text layer)"
138
 
  },
139
 
  {
140
 
    GIMP_PDB_FLOAT,
141
 
    "x",
142
 
    "The x coordinate for the left of the text bounding box"
143
 
  },
144
 
  {
145
 
    GIMP_PDB_FLOAT,
146
 
    "y",
147
 
    "The y coordinate for the top of the text bounding box"
148
 
  },
149
 
  {
150
 
    GIMP_PDB_STRING,
151
 
    "text",
152
 
    "The text to generate (in UTF-8 encoding)"
153
 
  },
154
 
  {
155
 
    GIMP_PDB_INT32,
156
 
    "border",
157
 
    "The size of the border: -1 <= border"
158
 
  },
159
 
  {
160
 
    GIMP_PDB_INT32,
161
 
    "antialias",
162
 
    "Antialiasing (TRUE or FALSE)"
163
 
  },
164
 
  {
165
 
    GIMP_PDB_FLOAT,
166
 
    "size",
167
 
    "The size of text in either pixels or points"
168
 
  },
169
 
  {
170
 
    GIMP_PDB_INT32,
171
 
    "size_type",
172
 
    "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)"
173
 
  },
174
 
  {
175
 
    GIMP_PDB_STRING,
176
 
    "fontname",
177
 
    "The name of the font"
178
 
  }
179
 
};
180
 
 
181
 
static ProcArg text_fontname_outargs[] =
182
 
{
183
 
  {
184
 
    GIMP_PDB_LAYER,
185
 
    "text_layer",
186
 
    "The new text layer or -1 if no layer was created."
187
 
  }
188
 
};
189
 
 
190
 
static ProcRecord text_fontname_proc =
191
 
{
192
 
  "gimp_text_fontname",
193
 
  "Add text at the specified location as a floating selection or a new layer.",
194
 
  "This tool requires a fontname matching an installed PangoFT2 font. You can specify the fontsize in units of pixels or points, and the appropriate metric is specified using the size_type argument. The x and y parameters together control the placement of the new text by specifying the upper left corner of the text bounding box. If the specified drawable parameter is valid, the text will be created as a floating selection attached to the drawable. If the drawable parameter is not valid (-1), the text will appear as a new layer. Finally, a border can be specified around the final rendered text. The border is measured in pixels.",
195
 
  "Martin Edlman & Sven Neumann",
196
 
  "Spencer Kimball & Peter Mattis",
197
 
  "1998- 2001",
198
 
  NULL,
199
 
  GIMP_INTERNAL,
200
 
  10,
201
 
  text_fontname_inargs,
202
 
  1,
203
 
  text_fontname_outargs,
204
 
  { { text_fontname_invoker } }
205
 
};
206
 
 
207
 
static Argument *
208
 
text_get_extents_fontname_invoker (Gimp         *gimp,
209
 
                                   GimpContext  *context,
210
 
                                   GimpProgress *progress,
211
 
                                   Argument     *args)
 
98
static GValueArray *
 
99
text_get_extents_fontname_invoker (GimpProcedure     *procedure,
 
100
                                   Gimp              *gimp,
 
101
                                   GimpContext       *context,
 
102
                                   GimpProgress      *progress,
 
103
                                   const GValueArray *args)
212
104
{
213
105
  gboolean success = TRUE;
214
 
  Argument *return_args;
215
 
  gchar *text;
 
106
  GValueArray *return_vals;
 
107
  const gchar *text;
216
108
  gdouble size;
217
109
  gint32 size_type;
218
 
  gchar *fontname;
219
 
  gint32 width;
220
 
  gint32 height;
221
 
  gint32 ascent;
222
 
  gint32 descent;
223
 
  gchar *real_fontname;
224
 
 
225
 
  text = (gchar *) args[0].value.pdb_pointer;
226
 
  if (text == NULL || !g_utf8_validate (text, -1, NULL))
227
 
    success = FALSE;
228
 
 
229
 
  size = args[1].value.pdb_float;
230
 
  if (size <= 0.0)
231
 
    success = FALSE;
232
 
 
233
 
  size_type = args[2].value.pdb_int;
234
 
  if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS)
235
 
    success = FALSE;
236
 
 
237
 
  fontname = (gchar *) args[3].value.pdb_pointer;
238
 
  if (fontname == NULL || !g_utf8_validate (fontname, -1, NULL))
239
 
    success = FALSE;
 
110
  const gchar *fontname;
 
111
  gint32 width = 0;
 
112
  gint32 height = 0;
 
113
  gint32 ascent = 0;
 
114
  gint32 descent = 0;
 
115
 
 
116
  text = g_value_get_string (&args->values[0]);
 
117
  size = g_value_get_double (&args->values[1]);
 
118
  size_type = g_value_get_enum (&args->values[2]);
 
119
  fontname = g_value_get_string (&args->values[3]);
240
120
 
241
121
  if (success)
242
122
    {
243
 
      real_fontname = g_strdup_printf ("%s %d", fontname, (gint) size);
 
123
      gchar *real_fontname = g_strdup_printf ("%s %d", fontname, (gint) size);
244
124
 
245
125
      success = text_get_extents (real_fontname, text,
246
126
                                  &width, &height,
249
129
      g_free (real_fontname);
250
130
    }
251
131
 
252
 
  return_args = procedural_db_return_args (&text_get_extents_fontname_proc, success);
 
132
  return_vals = gimp_procedure_get_return_values (procedure, success);
253
133
 
254
134
  if (success)
255
135
    {
256
 
      return_args[1].value.pdb_int = width;
257
 
      return_args[2].value.pdb_int = height;
258
 
      return_args[3].value.pdb_int = ascent;
259
 
      return_args[4].value.pdb_int = descent;
 
136
      g_value_set_int (&return_vals->values[1], width);
 
137
      g_value_set_int (&return_vals->values[2], height);
 
138
      g_value_set_int (&return_vals->values[3], ascent);
 
139
      g_value_set_int (&return_vals->values[4], descent);
260
140
    }
261
141
 
262
 
  return return_args;
 
142
  return return_vals;
263
143
}
264
144
 
265
 
static ProcArg text_get_extents_fontname_inargs[] =
266
 
{
267
 
  {
268
 
    GIMP_PDB_STRING,
269
 
    "text",
270
 
    "The text to generate (in UTF-8 encoding)"
271
 
  },
272
 
  {
273
 
    GIMP_PDB_FLOAT,
274
 
    "size",
275
 
    "The size of text in either pixels or points"
276
 
  },
277
 
  {
278
 
    GIMP_PDB_INT32,
279
 
    "size_type",
280
 
    "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)"
281
 
  },
282
 
  {
283
 
    GIMP_PDB_STRING,
284
 
    "fontname",
285
 
    "The name of the font"
286
 
  }
287
 
};
288
 
 
289
 
static ProcArg text_get_extents_fontname_outargs[] =
290
 
{
291
 
  {
292
 
    GIMP_PDB_INT32,
293
 
    "width",
294
 
    "The width of the specified font"
295
 
  },
296
 
  {
297
 
    GIMP_PDB_INT32,
298
 
    "height",
299
 
    "The height of the specified font"
300
 
  },
301
 
  {
302
 
    GIMP_PDB_INT32,
303
 
    "ascent",
304
 
    "The ascent of the specified font"
305
 
  },
306
 
  {
307
 
    GIMP_PDB_INT32,
308
 
    "descent",
309
 
    "The descent of the specified font"
310
 
  }
311
 
};
312
 
 
313
 
static ProcRecord text_get_extents_fontname_proc =
314
 
{
315
 
  "gimp_text_get_extents_fontname",
316
 
  "Get extents of the bounding box for the specified text.",
317
 
  "This tool returns the width and height of a bounding box for the specified text string with the specified font information. Ascent and descent for the specified font are returned as well.",
318
 
  "Martin Edlman & Sven Neumann",
319
 
  "Spencer Kimball & Peter Mattis",
320
 
  "1998- 2001",
321
 
  NULL,
322
 
  GIMP_INTERNAL,
323
 
  4,
324
 
  text_get_extents_fontname_inargs,
325
 
  4,
326
 
  text_get_extents_fontname_outargs,
327
 
  { { text_get_extents_fontname_invoker } }
328
 
};
329
 
 
330
 
static Argument *
331
 
text_invoker (Gimp         *gimp,
332
 
              GimpContext  *context,
333
 
              GimpProgress *progress,
334
 
              Argument     *args)
 
145
static GValueArray *
 
146
text_invoker (GimpProcedure     *procedure,
 
147
              Gimp              *gimp,
 
148
              GimpContext       *context,
 
149
              GimpProgress      *progress,
 
150
              const GValueArray *args)
335
151
{
336
152
  gboolean success = TRUE;
337
 
  Argument *return_args;
338
 
  GimpImage *gimage;
 
153
  GValueArray *return_vals;
 
154
  GimpImage *image;
339
155
  GimpDrawable *drawable;
340
156
  gdouble x;
341
157
  gdouble y;
342
 
  gchar *text;
 
158
  const gchar *text;
343
159
  gint32 border;
344
160
  gboolean antialias;
345
161
  gdouble size;
346
162
  gint32 size_type;
347
 
  gchar *foundry;
348
 
  gchar *family;
349
 
  gchar *weight;
350
 
  gchar *slant;
351
 
  gchar *set_width;
352
 
  gchar *spacing;
353
 
  gchar *registry;
354
 
  gchar *encoding;
 
163
  const gchar *foundry;
 
164
  const gchar *family;
 
165
  const gchar *weight;
 
166
  const gchar *slant;
 
167
  const gchar *set_width;
 
168
  const gchar *spacing;
 
169
  const gchar *registry;
 
170
  const gchar *encoding;
355
171
  GimpLayer *text_layer = NULL;
356
172
 
357
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
358
 
  if (! GIMP_IS_IMAGE (gimage))
359
 
    success = FALSE;
360
 
 
361
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
362
 
 
363
 
  x = args[2].value.pdb_float;
364
 
 
365
 
  y = args[3].value.pdb_float;
366
 
 
367
 
  text = (gchar *) args[4].value.pdb_pointer;
368
 
  if (text == NULL || !g_utf8_validate (text, -1, NULL))
369
 
    success = FALSE;
370
 
 
371
 
  border = args[5].value.pdb_int;
372
 
  if (border < -1)
373
 
    success = FALSE;
374
 
 
375
 
  antialias = args[6].value.pdb_int ? TRUE : FALSE;
376
 
 
377
 
  size = args[7].value.pdb_float;
378
 
  if (size <= 0.0)
379
 
    success = FALSE;
380
 
 
381
 
  size_type = args[8].value.pdb_int;
382
 
  if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS)
383
 
    success = FALSE;
384
 
 
385
 
  foundry = (gchar *) args[9].value.pdb_pointer;
386
 
  if (foundry == NULL)
387
 
    success = FALSE;
388
 
 
389
 
  family = (gchar *) args[10].value.pdb_pointer;
390
 
  if (family == NULL)
391
 
    success = FALSE;
392
 
 
393
 
  weight = (gchar *) args[11].value.pdb_pointer;
394
 
  if (weight == NULL)
395
 
    success = FALSE;
396
 
 
397
 
  slant = (gchar *) args[12].value.pdb_pointer;
398
 
  if (slant == NULL)
399
 
    success = FALSE;
400
 
 
401
 
  set_width = (gchar *) args[13].value.pdb_pointer;
402
 
  if (set_width == NULL)
403
 
    success = FALSE;
404
 
 
405
 
  spacing = (gchar *) args[14].value.pdb_pointer;
406
 
  if (spacing == NULL)
407
 
    success = FALSE;
408
 
 
409
 
  registry = (gchar *) args[15].value.pdb_pointer;
410
 
  if (registry == NULL)
411
 
    success = FALSE;
412
 
 
413
 
  encoding = (gchar *) args[16].value.pdb_pointer;
414
 
  if (encoding == NULL)
415
 
    success = FALSE;
 
173
  image = gimp_value_get_image (&args->values[0], gimp);
 
174
  drawable = gimp_value_get_drawable (&args->values[1], gimp);
 
175
  x = g_value_get_double (&args->values[2]);
 
176
  y = g_value_get_double (&args->values[3]);
 
177
  text = g_value_get_string (&args->values[4]);
 
178
  border = g_value_get_int (&args->values[5]);
 
179
  antialias = g_value_get_boolean (&args->values[6]);
 
180
  size = g_value_get_double (&args->values[7]);
 
181
  size_type = g_value_get_enum (&args->values[8]);
 
182
  foundry = g_value_get_string (&args->values[9]);
 
183
  family = g_value_get_string (&args->values[10]);
 
184
  weight = g_value_get_string (&args->values[11]);
 
185
  slant = g_value_get_string (&args->values[12]);
 
186
  set_width = g_value_get_string (&args->values[13]);
 
187
  spacing = g_value_get_string (&args->values[14]);
 
188
  registry = g_value_get_string (&args->values[15]);
 
189
  encoding = g_value_get_string (&args->values[16]);
416
190
 
417
191
  if (success)
418
192
    {
423
197
        {
424
198
          gchar *real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
425
199
 
426
 
          text_layer = text_render (gimage, drawable, context,
 
200
          text_layer = text_render (image, drawable, context,
427
201
                                    x, y, real_fontname, text,
428
202
                                    border, antialias);
429
203
 
431
205
        }
432
206
    }
433
207
 
434
 
  return_args = procedural_db_return_args (&text_proc, success);
 
208
  return_vals = gimp_procedure_get_return_values (procedure, success);
435
209
 
436
210
  if (success)
437
 
    return_args[1].value.pdb_int = text_layer ? gimp_item_get_ID (GIMP_ITEM (text_layer)) : -1;
 
211
    gimp_value_set_layer (&return_vals->values[1], text_layer);
438
212
 
439
 
  return return_args;
 
213
  return return_vals;
440
214
}
441
215
 
442
 
static ProcArg text_inargs[] =
443
 
{
444
 
  {
445
 
    GIMP_PDB_IMAGE,
446
 
    "image",
447
 
    "The image"
448
 
  },
449
 
  {
450
 
    GIMP_PDB_DRAWABLE,
451
 
    "drawable",
452
 
    "The affected drawable: (-1 for a new text layer)"
453
 
  },
454
 
  {
455
 
    GIMP_PDB_FLOAT,
456
 
    "x",
457
 
    "The x coordinate for the left of the text bounding box"
458
 
  },
459
 
  {
460
 
    GIMP_PDB_FLOAT,
461
 
    "y",
462
 
    "The y coordinate for the top of the text bounding box"
463
 
  },
464
 
  {
465
 
    GIMP_PDB_STRING,
466
 
    "text",
467
 
    "The text to generate (in UTF-8 encoding)"
468
 
  },
469
 
  {
470
 
    GIMP_PDB_INT32,
471
 
    "border",
472
 
    "The size of the border: -1 <= border"
473
 
  },
474
 
  {
475
 
    GIMP_PDB_INT32,
476
 
    "antialias",
477
 
    "Antialiasing (TRUE or FALSE)"
478
 
  },
479
 
  {
480
 
    GIMP_PDB_FLOAT,
481
 
    "size",
482
 
    "The size of text in either pixels or points"
483
 
  },
484
 
  {
485
 
    GIMP_PDB_INT32,
486
 
    "size_type",
487
 
    "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)"
488
 
  },
489
 
  {
490
 
    GIMP_PDB_STRING,
491
 
    "foundry",
492
 
    "The font foundry"
493
 
  },
494
 
  {
495
 
    GIMP_PDB_STRING,
496
 
    "family",
497
 
    "The font family"
498
 
  },
499
 
  {
500
 
    GIMP_PDB_STRING,
501
 
    "weight",
502
 
    "The font weight"
503
 
  },
504
 
  {
505
 
    GIMP_PDB_STRING,
506
 
    "slant",
507
 
    "The font slant"
508
 
  },
509
 
  {
510
 
    GIMP_PDB_STRING,
511
 
    "set_width",
512
 
    "The font set-width"
513
 
  },
514
 
  {
515
 
    GIMP_PDB_STRING,
516
 
    "spacing",
517
 
    "The font spacing"
518
 
  },
519
 
  {
520
 
    GIMP_PDB_STRING,
521
 
    "registry",
522
 
    "The font registry"
523
 
  },
524
 
  {
525
 
    GIMP_PDB_STRING,
526
 
    "encoding",
527
 
    "The font encoding"
528
 
  }
529
 
};
530
 
 
531
 
static ProcArg text_outargs[] =
532
 
{
533
 
  {
534
 
    GIMP_PDB_LAYER,
535
 
    "text_layer",
536
 
    "The new text layer or -1 if no layer was created."
537
 
  }
538
 
};
539
 
 
540
 
static ProcRecord text_proc =
541
 
{
542
 
  "gimp_text",
543
 
  "This procedure is deprecated! Use 'gimp_text_fontname' instead.",
544
 
  "This procedure is deprecated! Use 'gimp_text_fontname' instead.",
545
 
  "",
546
 
  "",
547
 
  "",
548
 
  "gimp_text_fontname",
549
 
  GIMP_INTERNAL,
550
 
  17,
551
 
  text_inargs,
552
 
  1,
553
 
  text_outargs,
554
 
  { { text_invoker } }
555
 
};
556
 
 
557
 
static Argument *
558
 
text_get_extents_invoker (Gimp         *gimp,
559
 
                          GimpContext  *context,
560
 
                          GimpProgress *progress,
561
 
                          Argument     *args)
 
216
static GValueArray *
 
217
text_get_extents_invoker (GimpProcedure     *procedure,
 
218
                          Gimp              *gimp,
 
219
                          GimpContext       *context,
 
220
                          GimpProgress      *progress,
 
221
                          const GValueArray *args)
562
222
{
563
223
  gboolean success = TRUE;
564
 
  Argument *return_args;
565
 
  gchar *text;
 
224
  GValueArray *return_vals;
 
225
  const gchar *text;
566
226
  gdouble size;
567
227
  gint32 size_type;
568
 
  gchar *foundry;
569
 
  gchar *family;
570
 
  gchar *weight;
571
 
  gchar *slant;
572
 
  gchar *set_width;
573
 
  gchar *spacing;
574
 
  gchar *registry;
575
 
  gchar *encoding;
576
 
  gint32 width;
577
 
  gint32 height;
578
 
  gint32 ascent;
579
 
  gint32 descent;
580
 
  gchar *real_fontname;
581
 
 
582
 
  text = (gchar *) args[0].value.pdb_pointer;
583
 
  if (text == NULL || !g_utf8_validate (text, -1, NULL))
584
 
    success = FALSE;
585
 
 
586
 
  size = args[1].value.pdb_float;
587
 
  if (size <= 0.0)
588
 
    success = FALSE;
589
 
 
590
 
  size_type = args[2].value.pdb_int;
591
 
  if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS)
592
 
    success = FALSE;
593
 
 
594
 
  foundry = (gchar *) args[3].value.pdb_pointer;
595
 
  if (foundry == NULL)
596
 
    success = FALSE;
597
 
 
598
 
  family = (gchar *) args[4].value.pdb_pointer;
599
 
  if (family == NULL)
600
 
    success = FALSE;
601
 
 
602
 
  weight = (gchar *) args[5].value.pdb_pointer;
603
 
  if (weight == NULL)
604
 
    success = FALSE;
605
 
 
606
 
  slant = (gchar *) args[6].value.pdb_pointer;
607
 
  if (slant == NULL)
608
 
    success = FALSE;
609
 
 
610
 
  set_width = (gchar *) args[7].value.pdb_pointer;
611
 
  if (set_width == NULL)
612
 
    success = FALSE;
613
 
 
614
 
  spacing = (gchar *) args[8].value.pdb_pointer;
615
 
  if (spacing == NULL)
616
 
    success = FALSE;
617
 
 
618
 
  registry = (gchar *) args[9].value.pdb_pointer;
619
 
  if (registry == NULL)
620
 
    success = FALSE;
621
 
 
622
 
  encoding = (gchar *) args[10].value.pdb_pointer;
623
 
  if (encoding == NULL)
624
 
    success = FALSE;
 
228
  const gchar *foundry;
 
229
  const gchar *family;
 
230
  const gchar *weight;
 
231
  const gchar *slant;
 
232
  const gchar *set_width;
 
233
  const gchar *spacing;
 
234
  const gchar *registry;
 
235
  const gchar *encoding;
 
236
  gint32 width = 0;
 
237
  gint32 height = 0;
 
238
  gint32 ascent = 0;
 
239
  gint32 descent = 0;
 
240
 
 
241
  text = g_value_get_string (&args->values[0]);
 
242
  size = g_value_get_double (&args->values[1]);
 
243
  size_type = g_value_get_enum (&args->values[2]);
 
244
  foundry = g_value_get_string (&args->values[3]);
 
245
  family = g_value_get_string (&args->values[4]);
 
246
  weight = g_value_get_string (&args->values[5]);
 
247
  slant = g_value_get_string (&args->values[6]);
 
248
  set_width = g_value_get_string (&args->values[7]);
 
249
  spacing = g_value_get_string (&args->values[8]);
 
250
  registry = g_value_get_string (&args->values[9]);
 
251
  encoding = g_value_get_string (&args->values[10]);
625
252
 
626
253
  if (success)
627
254
    {
628
 
      real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
 
255
      gchar *real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
629
256
 
630
257
      success = text_get_extents (real_fontname, text,
631
258
                                  &width, &height,
634
261
      g_free (real_fontname);
635
262
    }
636
263
 
637
 
  return_args = procedural_db_return_args (&text_get_extents_proc, success);
 
264
  return_vals = gimp_procedure_get_return_values (procedure, success);
638
265
 
639
266
  if (success)
640
267
    {
641
 
      return_args[1].value.pdb_int = width;
642
 
      return_args[2].value.pdb_int = height;
643
 
      return_args[3].value.pdb_int = ascent;
644
 
      return_args[4].value.pdb_int = descent;
 
268
      g_value_set_int (&return_vals->values[1], width);
 
269
      g_value_set_int (&return_vals->values[2], height);
 
270
      g_value_set_int (&return_vals->values[3], ascent);
 
271
      g_value_set_int (&return_vals->values[4], descent);
645
272
    }
646
273
 
647
 
  return return_args;
648
 
}
649
 
 
650
 
static ProcArg text_get_extents_inargs[] =
651
 
{
652
 
  {
653
 
    GIMP_PDB_STRING,
654
 
    "text",
655
 
    "The text to generate (in UTF-8 encoding)"
656
 
  },
657
 
  {
658
 
    GIMP_PDB_FLOAT,
659
 
    "size",
660
 
    "The size of text in either pixels or points"
661
 
  },
662
 
  {
663
 
    GIMP_PDB_INT32,
664
 
    "size_type",
665
 
    "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)"
666
 
  },
667
 
  {
668
 
    GIMP_PDB_STRING,
669
 
    "foundry",
670
 
    "The font foundry"
671
 
  },
672
 
  {
673
 
    GIMP_PDB_STRING,
674
 
    "family",
675
 
    "The font family"
676
 
  },
677
 
  {
678
 
    GIMP_PDB_STRING,
679
 
    "weight",
680
 
    "The font weight"
681
 
  },
682
 
  {
683
 
    GIMP_PDB_STRING,
684
 
    "slant",
685
 
    "The font slant"
686
 
  },
687
 
  {
688
 
    GIMP_PDB_STRING,
689
 
    "set_width",
690
 
    "The font set-width"
691
 
  },
692
 
  {
693
 
    GIMP_PDB_STRING,
694
 
    "spacing",
695
 
    "The font spacing"
696
 
  },
697
 
  {
698
 
    GIMP_PDB_STRING,
699
 
    "registry",
700
 
    "The font registry"
701
 
  },
702
 
  {
703
 
    GIMP_PDB_STRING,
704
 
    "encoding",
705
 
    "The font encoding"
706
 
  }
707
 
};
708
 
 
709
 
static ProcArg text_get_extents_outargs[] =
710
 
{
711
 
  {
712
 
    GIMP_PDB_INT32,
713
 
    "width",
714
 
    "The width of the specified font"
715
 
  },
716
 
  {
717
 
    GIMP_PDB_INT32,
718
 
    "height",
719
 
    "The height of the specified font"
720
 
  },
721
 
  {
722
 
    GIMP_PDB_INT32,
723
 
    "ascent",
724
 
    "The ascent of the specified font"
725
 
  },
726
 
  {
727
 
    GIMP_PDB_INT32,
728
 
    "descent",
729
 
    "The descent of the specified font"
730
 
  }
731
 
};
732
 
 
733
 
static ProcRecord text_get_extents_proc =
734
 
{
735
 
  "gimp_text_get_extents",
736
 
  "This procedure is deprecated! Use 'gimp_text_get_extents_fontname' instead.",
737
 
  "This procedure is deprecated! Use 'gimp_text_get_extents_fontname' instead.",
738
 
  "",
739
 
  "",
740
 
  "",
741
 
  "gimp_text_get_extents_fontname",
742
 
  GIMP_INTERNAL,
743
 
  11,
744
 
  text_get_extents_inargs,
745
 
  4,
746
 
  text_get_extents_outargs,
747
 
  { { text_get_extents_invoker } }
748
 
};
 
274
  return return_vals;
 
275
}
 
276
 
 
277
void
 
278
register_text_tool_procs (GimpPDB *pdb)
 
279
{
 
280
  GimpProcedure *procedure;
 
281
 
 
282
  /*
 
283
   * gimp-text-fontname
 
284
   */
 
285
  procedure = gimp_procedure_new (text_fontname_invoker);
 
286
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-text-fontname");
 
287
  gimp_procedure_set_static_strings (procedure,
 
288
                                     "gimp-text-fontname",
 
289
                                     "Add text at the specified location as a floating selection or a new layer.",
 
290
                                     "This tool requires a fontname matching an installed PangoFT2 font. You can specify the fontsize in units of pixels or points, and the appropriate metric is specified using the size_type argument. The x and y parameters together control the placement of the new text by specifying the upper left corner of the text bounding box. If the specified drawable parameter is valid, the text will be created as a floating selection attached to the drawable. If the drawable parameter is not valid (-1), the text will appear as a new layer. Finally, a border can be specified around the final rendered text. The border is measured in pixels. Parameter size-type is not used and is currently ignored. If you need to display a font in points, divide the size in points by 72.0 and multiply it by the image's vertical resolution.",
 
291
                                     "Martin Edlman & Sven Neumann",
 
292
                                     "Spencer Kimball & Peter Mattis",
 
293
                                     "1998- 2001",
 
294
                                     NULL);
 
295
  gimp_procedure_add_argument (procedure,
 
296
                               gimp_param_spec_image_id ("image",
 
297
                                                         "image",
 
298
                                                         "The image",
 
299
                                                         pdb->gimp, FALSE,
 
300
                                                         GIMP_PARAM_READWRITE));
 
301
  gimp_procedure_add_argument (procedure,
 
302
                               gimp_param_spec_drawable_id ("drawable",
 
303
                                                            "drawable",
 
304
                                                            "The affected drawable: (-1 for a new text layer)",
 
305
                                                            pdb->gimp, TRUE,
 
306
                                                            GIMP_PARAM_READWRITE));
 
307
  gimp_procedure_add_argument (procedure,
 
308
                               g_param_spec_double ("x",
 
309
                                                    "x",
 
310
                                                    "The x coordinate for the left of the text bounding box",
 
311
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
312
                                                    GIMP_PARAM_READWRITE));
 
313
  gimp_procedure_add_argument (procedure,
 
314
                               g_param_spec_double ("y",
 
315
                                                    "y",
 
316
                                                    "The y coordinate for the top of the text bounding box",
 
317
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
318
                                                    GIMP_PARAM_READWRITE));
 
319
  gimp_procedure_add_argument (procedure,
 
320
                               gimp_param_spec_string ("text",
 
321
                                                       "text",
 
322
                                                       "The text to generate (in UTF-8 encoding)",
 
323
                                                       FALSE, FALSE,
 
324
                                                       NULL,
 
325
                                                       GIMP_PARAM_READWRITE));
 
326
  gimp_procedure_add_argument (procedure,
 
327
                               gimp_param_spec_int32 ("border",
 
328
                                                      "border",
 
329
                                                      "The size of the border",
 
330
                                                      -1, G_MAXINT32, -1,
 
331
                                                      GIMP_PARAM_READWRITE));
 
332
  gimp_procedure_add_argument (procedure,
 
333
                               g_param_spec_boolean ("antialias",
 
334
                                                     "antialias",
 
335
                                                     "Antialiasing",
 
336
                                                     FALSE,
 
337
                                                     GIMP_PARAM_READWRITE));
 
338
  gimp_procedure_add_argument (procedure,
 
339
                               g_param_spec_double ("size",
 
340
                                                    "size",
 
341
                                                    "The size of text in either pixels or points",
 
342
                                                    0, G_MAXDOUBLE, 0,
 
343
                                                    GIMP_PARAM_READWRITE));
 
344
  gimp_procedure_add_argument (procedure,
 
345
                               g_param_spec_enum ("size-type",
 
346
                                                  "size type",
 
347
                                                  "The units of specified size",
 
348
                                                  GIMP_TYPE_SIZE_TYPE,
 
349
                                                  GIMP_PIXELS,
 
350
                                                  GIMP_PARAM_READWRITE));
 
351
  gimp_procedure_add_argument (procedure,
 
352
                               gimp_param_spec_string ("fontname",
 
353
                                                       "fontname",
 
354
                                                       "The name of the font",
 
355
                                                       FALSE, FALSE,
 
356
                                                       NULL,
 
357
                                                       GIMP_PARAM_READWRITE));
 
358
  gimp_procedure_add_return_value (procedure,
 
359
                                   gimp_param_spec_layer_id ("text-layer",
 
360
                                                             "text layer",
 
361
                                                             "The new text layer or -1 if no layer was created.",
 
362
                                                             pdb->gimp, FALSE,
 
363
                                                             GIMP_PARAM_READWRITE));
 
364
  gimp_pdb_register_procedure (pdb, procedure);
 
365
  g_object_unref (procedure);
 
366
 
 
367
  /*
 
368
   * gimp-text-get-extents-fontname
 
369
   */
 
370
  procedure = gimp_procedure_new (text_get_extents_fontname_invoker);
 
371
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-text-get-extents-fontname");
 
372
  gimp_procedure_set_static_strings (procedure,
 
373
                                     "gimp-text-get-extents-fontname",
 
374
                                     "Get extents of the bounding box for the specified text.",
 
375
                                     "This tool returns the width and height of a bounding box for the specified text string with the specified font information. Ascent and descent for the specified font are returned as well. Parameter size-type is not used and is currently ignored. If you need to display a font in points, divide the size in points by 72.0 and multiply it by the vertical resolution of the image you are taking into account.",
 
376
                                     "Martin Edlman & Sven Neumann",
 
377
                                     "Spencer Kimball & Peter Mattis",
 
378
                                     "1998- 2001",
 
379
                                     NULL);
 
380
  gimp_procedure_add_argument (procedure,
 
381
                               gimp_param_spec_string ("text",
 
382
                                                       "text",
 
383
                                                       "The text to generate (in UTF-8 encoding)",
 
384
                                                       FALSE, FALSE,
 
385
                                                       NULL,
 
386
                                                       GIMP_PARAM_READWRITE));
 
387
  gimp_procedure_add_argument (procedure,
 
388
                               g_param_spec_double ("size",
 
389
                                                    "size",
 
390
                                                    "The size of text in either pixels or points",
 
391
                                                    0, G_MAXDOUBLE, 0,
 
392
                                                    GIMP_PARAM_READWRITE));
 
393
  gimp_procedure_add_argument (procedure,
 
394
                               g_param_spec_enum ("size-type",
 
395
                                                  "size type",
 
396
                                                  "The units of specified size",
 
397
                                                  GIMP_TYPE_SIZE_TYPE,
 
398
                                                  GIMP_PIXELS,
 
399
                                                  GIMP_PARAM_READWRITE));
 
400
  gimp_procedure_add_argument (procedure,
 
401
                               gimp_param_spec_string ("fontname",
 
402
                                                       "fontname",
 
403
                                                       "The name of the font",
 
404
                                                       FALSE, FALSE,
 
405
                                                       NULL,
 
406
                                                       GIMP_PARAM_READWRITE));
 
407
  gimp_procedure_add_return_value (procedure,
 
408
                                   gimp_param_spec_int32 ("width",
 
409
                                                          "width",
 
410
                                                          "The width of the specified font",
 
411
                                                          G_MININT32, G_MAXINT32, 0,
 
412
                                                          GIMP_PARAM_READWRITE));
 
413
  gimp_procedure_add_return_value (procedure,
 
414
                                   gimp_param_spec_int32 ("height",
 
415
                                                          "height",
 
416
                                                          "The height of the specified font",
 
417
                                                          G_MININT32, G_MAXINT32, 0,
 
418
                                                          GIMP_PARAM_READWRITE));
 
419
  gimp_procedure_add_return_value (procedure,
 
420
                                   gimp_param_spec_int32 ("ascent",
 
421
                                                          "ascent",
 
422
                                                          "The ascent of the specified font",
 
423
                                                          G_MININT32, G_MAXINT32, 0,
 
424
                                                          GIMP_PARAM_READWRITE));
 
425
  gimp_procedure_add_return_value (procedure,
 
426
                                   gimp_param_spec_int32 ("descent",
 
427
                                                          "descent",
 
428
                                                          "The descent of the specified font",
 
429
                                                          G_MININT32, G_MAXINT32, 0,
 
430
                                                          GIMP_PARAM_READWRITE));
 
431
  gimp_pdb_register_procedure (pdb, procedure);
 
432
  g_object_unref (procedure);
 
433
 
 
434
  /*
 
435
   * gimp-text
 
436
   */
 
437
  procedure = gimp_procedure_new (text_invoker);
 
438
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-text");
 
439
  gimp_procedure_set_static_strings (procedure,
 
440
                                     "gimp-text",
 
441
                                     "This procedure is deprecated! Use 'gimp-text-fontname' instead.",
 
442
                                     "This procedure is deprecated! Use 'gimp-text-fontname' instead.",
 
443
                                     "",
 
444
                                     "",
 
445
                                     "",
 
446
                                     "gimp-text-fontname");
 
447
  gimp_procedure_add_argument (procedure,
 
448
                               gimp_param_spec_image_id ("image",
 
449
                                                         "image",
 
450
                                                         "The image",
 
451
                                                         pdb->gimp, FALSE,
 
452
                                                         GIMP_PARAM_READWRITE));
 
453
  gimp_procedure_add_argument (procedure,
 
454
                               gimp_param_spec_drawable_id ("drawable",
 
455
                                                            "drawable",
 
456
                                                            "The affected drawable: (-1 for a new text layer)",
 
457
                                                            pdb->gimp, TRUE,
 
458
                                                            GIMP_PARAM_READWRITE));
 
459
  gimp_procedure_add_argument (procedure,
 
460
                               g_param_spec_double ("x",
 
461
                                                    "x",
 
462
                                                    "The x coordinate for the left of the text bounding box",
 
463
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
464
                                                    GIMP_PARAM_READWRITE));
 
465
  gimp_procedure_add_argument (procedure,
 
466
                               g_param_spec_double ("y",
 
467
                                                    "y",
 
468
                                                    "The y coordinate for the top of the text bounding box",
 
469
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
470
                                                    GIMP_PARAM_READWRITE));
 
471
  gimp_procedure_add_argument (procedure,
 
472
                               gimp_param_spec_string ("text",
 
473
                                                       "text",
 
474
                                                       "The text to generate (in UTF-8 encoding)",
 
475
                                                       FALSE, FALSE,
 
476
                                                       NULL,
 
477
                                                       GIMP_PARAM_READWRITE));
 
478
  gimp_procedure_add_argument (procedure,
 
479
                               gimp_param_spec_int32 ("border",
 
480
                                                      "border",
 
481
                                                      "The size of the border",
 
482
                                                      -1, G_MAXINT32, -1,
 
483
                                                      GIMP_PARAM_READWRITE));
 
484
  gimp_procedure_add_argument (procedure,
 
485
                               g_param_spec_boolean ("antialias",
 
486
                                                     "antialias",
 
487
                                                     "Antialiasing",
 
488
                                                     FALSE,
 
489
                                                     GIMP_PARAM_READWRITE));
 
490
  gimp_procedure_add_argument (procedure,
 
491
                               g_param_spec_double ("size",
 
492
                                                    "size",
 
493
                                                    "The size of text in either pixels or points",
 
494
                                                    0, G_MAXDOUBLE, 0,
 
495
                                                    GIMP_PARAM_READWRITE));
 
496
  gimp_procedure_add_argument (procedure,
 
497
                               g_param_spec_enum ("size-type",
 
498
                                                  "size type",
 
499
                                                  "The units of specified size",
 
500
                                                  GIMP_TYPE_SIZE_TYPE,
 
501
                                                  GIMP_PIXELS,
 
502
                                                  GIMP_PARAM_READWRITE));
 
503
  gimp_procedure_add_argument (procedure,
 
504
                               gimp_param_spec_string ("foundry",
 
505
                                                       "foundry",
 
506
                                                       "The font foundry",
 
507
                                                       TRUE, FALSE,
 
508
                                                       NULL,
 
509
                                                       GIMP_PARAM_READWRITE));
 
510
  gimp_procedure_add_argument (procedure,
 
511
                               gimp_param_spec_string ("family",
 
512
                                                       "family",
 
513
                                                       "The font family",
 
514
                                                       TRUE, FALSE,
 
515
                                                       NULL,
 
516
                                                       GIMP_PARAM_READWRITE));
 
517
  gimp_procedure_add_argument (procedure,
 
518
                               gimp_param_spec_string ("weight",
 
519
                                                       "weight",
 
520
                                                       "The font weight",
 
521
                                                       TRUE, FALSE,
 
522
                                                       NULL,
 
523
                                                       GIMP_PARAM_READWRITE));
 
524
  gimp_procedure_add_argument (procedure,
 
525
                               gimp_param_spec_string ("slant",
 
526
                                                       "slant",
 
527
                                                       "The font slant",
 
528
                                                       TRUE, FALSE,
 
529
                                                       NULL,
 
530
                                                       GIMP_PARAM_READWRITE));
 
531
  gimp_procedure_add_argument (procedure,
 
532
                               gimp_param_spec_string ("set-width",
 
533
                                                       "set width",
 
534
                                                       "The font set-width",
 
535
                                                       TRUE, FALSE,
 
536
                                                       NULL,
 
537
                                                       GIMP_PARAM_READWRITE));
 
538
  gimp_procedure_add_argument (procedure,
 
539
                               gimp_param_spec_string ("spacing",
 
540
                                                       "spacing",
 
541
                                                       "The font spacing",
 
542
                                                       TRUE, FALSE,
 
543
                                                       NULL,
 
544
                                                       GIMP_PARAM_READWRITE));
 
545
  gimp_procedure_add_argument (procedure,
 
546
                               gimp_param_spec_string ("registry",
 
547
                                                       "registry",
 
548
                                                       "The font registry",
 
549
                                                       TRUE, FALSE,
 
550
                                                       NULL,
 
551
                                                       GIMP_PARAM_READWRITE));
 
552
  gimp_procedure_add_argument (procedure,
 
553
                               gimp_param_spec_string ("encoding",
 
554
                                                       "encoding",
 
555
                                                       "The font encoding",
 
556
                                                       TRUE, FALSE,
 
557
                                                       NULL,
 
558
                                                       GIMP_PARAM_READWRITE));
 
559
  gimp_procedure_add_return_value (procedure,
 
560
                                   gimp_param_spec_layer_id ("text-layer",
 
561
                                                             "text layer",
 
562
                                                             "The new text layer or -1 if no layer was created.",
 
563
                                                             pdb->gimp, FALSE,
 
564
                                                             GIMP_PARAM_READWRITE));
 
565
  gimp_pdb_register_procedure (pdb, procedure);
 
566
  g_object_unref (procedure);
 
567
 
 
568
  /*
 
569
   * gimp-text-get-extents
 
570
   */
 
571
  procedure = gimp_procedure_new (text_get_extents_invoker);
 
572
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-text-get-extents");
 
573
  gimp_procedure_set_static_strings (procedure,
 
574
                                     "gimp-text-get-extents",
 
575
                                     "This procedure is deprecated! Use 'gimp-text-get-extents-fontname' instead.",
 
576
                                     "This procedure is deprecated! Use 'gimp-text-get-extents-fontname' instead.",
 
577
                                     "",
 
578
                                     "",
 
579
                                     "",
 
580
                                     "gimp-text-get-extents-fontname");
 
581
  gimp_procedure_add_argument (procedure,
 
582
                               gimp_param_spec_string ("text",
 
583
                                                       "text",
 
584
                                                       "The text to generate (in UTF-8 encoding)",
 
585
                                                       FALSE, FALSE,
 
586
                                                       NULL,
 
587
                                                       GIMP_PARAM_READWRITE));
 
588
  gimp_procedure_add_argument (procedure,
 
589
                               g_param_spec_double ("size",
 
590
                                                    "size",
 
591
                                                    "The size of text in either pixels or points",
 
592
                                                    0, G_MAXDOUBLE, 0,
 
593
                                                    GIMP_PARAM_READWRITE));
 
594
  gimp_procedure_add_argument (procedure,
 
595
                               g_param_spec_enum ("size-type",
 
596
                                                  "size type",
 
597
                                                  "The units of specified size",
 
598
                                                  GIMP_TYPE_SIZE_TYPE,
 
599
                                                  GIMP_PIXELS,
 
600
                                                  GIMP_PARAM_READWRITE));
 
601
  gimp_procedure_add_argument (procedure,
 
602
                               gimp_param_spec_string ("foundry",
 
603
                                                       "foundry",
 
604
                                                       "The font foundry",
 
605
                                                       TRUE, FALSE,
 
606
                                                       NULL,
 
607
                                                       GIMP_PARAM_READWRITE));
 
608
  gimp_procedure_add_argument (procedure,
 
609
                               gimp_param_spec_string ("family",
 
610
                                                       "family",
 
611
                                                       "The font family",
 
612
                                                       TRUE, FALSE,
 
613
                                                       NULL,
 
614
                                                       GIMP_PARAM_READWRITE));
 
615
  gimp_procedure_add_argument (procedure,
 
616
                               gimp_param_spec_string ("weight",
 
617
                                                       "weight",
 
618
                                                       "The font weight",
 
619
                                                       TRUE, FALSE,
 
620
                                                       NULL,
 
621
                                                       GIMP_PARAM_READWRITE));
 
622
  gimp_procedure_add_argument (procedure,
 
623
                               gimp_param_spec_string ("slant",
 
624
                                                       "slant",
 
625
                                                       "The font slant",
 
626
                                                       TRUE, FALSE,
 
627
                                                       NULL,
 
628
                                                       GIMP_PARAM_READWRITE));
 
629
  gimp_procedure_add_argument (procedure,
 
630
                               gimp_param_spec_string ("set-width",
 
631
                                                       "set width",
 
632
                                                       "The font set-width",
 
633
                                                       TRUE, FALSE,
 
634
                                                       NULL,
 
635
                                                       GIMP_PARAM_READWRITE));
 
636
  gimp_procedure_add_argument (procedure,
 
637
                               gimp_param_spec_string ("spacing",
 
638
                                                       "spacing",
 
639
                                                       "The font spacing",
 
640
                                                       TRUE, FALSE,
 
641
                                                       NULL,
 
642
                                                       GIMP_PARAM_READWRITE));
 
643
  gimp_procedure_add_argument (procedure,
 
644
                               gimp_param_spec_string ("registry",
 
645
                                                       "registry",
 
646
                                                       "The font registry",
 
647
                                                       TRUE, FALSE,
 
648
                                                       NULL,
 
649
                                                       GIMP_PARAM_READWRITE));
 
650
  gimp_procedure_add_argument (procedure,
 
651
                               gimp_param_spec_string ("encoding",
 
652
                                                       "encoding",
 
653
                                                       "The font encoding",
 
654
                                                       TRUE, FALSE,
 
655
                                                       NULL,
 
656
                                                       GIMP_PARAM_READWRITE));
 
657
  gimp_procedure_add_return_value (procedure,
 
658
                                   gimp_param_spec_int32 ("width",
 
659
                                                          "width",
 
660
                                                          "The width of the specified font",
 
661
                                                          G_MININT32, G_MAXINT32, 0,
 
662
                                                          GIMP_PARAM_READWRITE));
 
663
  gimp_procedure_add_return_value (procedure,
 
664
                                   gimp_param_spec_int32 ("height",
 
665
                                                          "height",
 
666
                                                          "The height of the specified font",
 
667
                                                          G_MININT32, G_MAXINT32, 0,
 
668
                                                          GIMP_PARAM_READWRITE));
 
669
  gimp_procedure_add_return_value (procedure,
 
670
                                   gimp_param_spec_int32 ("ascent",
 
671
                                                          "ascent",
 
672
                                                          "The ascent of the specified font",
 
673
                                                          G_MININT32, G_MAXINT32, 0,
 
674
                                                          GIMP_PARAM_READWRITE));
 
675
  gimp_procedure_add_return_value (procedure,
 
676
                                   gimp_param_spec_int32 ("descent",
 
677
                                                          "descent",
 
678
                                                          "The descent of the specified font",
 
679
                                                          G_MININT32, G_MAXINT32, 0,
 
680
                                                          GIMP_PARAM_READWRITE));
 
681
  gimp_pdb_register_procedure (pdb, procedure);
 
682
  g_object_unref (procedure);
 
683
}