pango-layout.h 21.2 KB
Newer Older
1
/* Pango
Behdad Esfahbod's avatar
Behdad Esfahbod committed
2
 * pango-layout.h: High-level layout driver
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * Copyright (C) 2000 Red Hat Software
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library 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.
 */

#ifndef __PANGO_LAYOUT_H__
#define __PANGO_LAYOUT_H__

25
26
#include <pango/pango-attributes.h>
#include <pango/pango-context.h>
27
#include <pango/pango-glyph-item.h>
28
#include <pango/pango-tabs.h>
29

Owen Taylor's avatar
Owen Taylor committed
30
G_BEGIN_DECLS
31

32
33
34
typedef struct _PangoLayout      PangoLayout;
typedef struct _PangoLayoutClass PangoLayoutClass;
typedef struct _PangoLayoutLine  PangoLayoutLine;
35

36
37
38
/**
 * PangoLayoutRun:
 *
Matthias Clasen's avatar
Matthias Clasen committed
39
 * A `PangoLayoutRun` represents a single run within a `PangoLayoutLine`.
40
 *
Matthias Clasen's avatar
Matthias Clasen committed
41
 * It is simply an alternate name for [struct@Pango.GlyphItem].
42
 * See the [struct@Pango.GlyphItem] docs for details on the fields.
43
 */
44
typedef PangoGlyphItem PangoLayoutRun;
45

46
47
48
49
50
51
/**
 * PangoAlignment:
 * @PANGO_ALIGN_LEFT: Put all available space on the right
 * @PANGO_ALIGN_CENTER: Center the line within the available space
 * @PANGO_ALIGN_RIGHT: Put all available space on the left
 *
Matthias Clasen's avatar
Matthias Clasen committed
52
53
54
55
56
 * `PangoAlignment` describes how to align the lines of a `PangoLayout`
 * within the available space.
 *
 * If the `PangoLayout` is set to justify using [method@Pango.Layout.set_justify],
 * this only has effect for partial lines.
Matthias Clasen's avatar
Matthias Clasen committed
57
58
59
 *
 * See [method@Pango.Layout.set_auto_dir] for how text direction affects
 * the interpretation of `PangoAlignment values.
60
 */
Owen Taylor's avatar
Owen Taylor committed
61
62
63
64
65
66
typedef enum {
  PANGO_ALIGN_LEFT,
  PANGO_ALIGN_CENTER,
  PANGO_ALIGN_RIGHT
} PangoAlignment;

67
68
69
70
/**
 * PangoWrapMode:
 * @PANGO_WRAP_WORD: wrap lines at word boundaries.
 * @PANGO_WRAP_CHAR: wrap lines at character boundaries.
71
72
 * @PANGO_WRAP_WORD_CHAR: wrap lines at word boundaries, but fall back to
 *   character boundaries if there is not enough space for a full word.
73
 *
Matthias Clasen's avatar
Matthias Clasen committed
74
 * `PangoWrapMode` describes how to wrap the lines of a `PangoLayout`
75
 * to the desired width.
76
77
78
79
80
 *
 * For @PANGO_WRAP_WORD, Pango uses break opportunities that are determined
 * by the Unicode line breaking algorithm. For @PANGO_WRAP_CHAR, Pango allows
 * breaking at grapheme boundaries that are determined by the Unicode text
 * segmentation algorithm.
81
 */
Havoc Pennington's avatar
Havoc Pennington committed
82
83
typedef enum {
  PANGO_WRAP_WORD,
84
85
  PANGO_WRAP_CHAR,
  PANGO_WRAP_WORD_CHAR
Havoc Pennington's avatar
Havoc Pennington committed
86
87
} PangoWrapMode;

88
/**
89
 * PangoEllipsizeMode:
90
91
92
93
 * @PANGO_ELLIPSIZE_NONE: No ellipsization
 * @PANGO_ELLIPSIZE_START: Omit characters at the start of the text
 * @PANGO_ELLIPSIZE_MIDDLE: Omit characters in the middle of the text
 * @PANGO_ELLIPSIZE_END: Omit characters at the end of the text
94
 *
Matthias Clasen's avatar
Matthias Clasen committed
95
96
 * `PangoEllipsizeMode` describes what sort of ellipsization
 * should be applied to text.
97
98
 *
 * In the ellipsization process characters are removed from the
99
100
101
102
103
104
105
106
107
108
 * text in order to make it fit to a given width and replaced
 * with an ellipsis.
 */
typedef enum {
  PANGO_ELLIPSIZE_NONE,
  PANGO_ELLIPSIZE_START,
  PANGO_ELLIPSIZE_MIDDLE,
  PANGO_ELLIPSIZE_END
} PangoEllipsizeMode;

109
110
/**
 * PangoLayoutLine:
111
 * @layout: (nullable): the layout this line belongs to, might be %NULL
112
113
 * @start_index: start of line as byte index into layout->text
 * @length: length of line in bytes
114
 * @runs: (nullable) (element-type Pango.LayoutRun): list of runs in the
115
 *   line, from left to right
116
117
118
 * @is_paragraph_start: #TRUE if this is the first line of the paragraph
 * @resolved_dir: #Resolved PangoDirection of line
 *
Matthias Clasen's avatar
Matthias Clasen committed
119
120
121
122
123
124
 * A `PangoLayoutLine` represents one of the lines resulting from laying
 * out a paragraph via `PangoLayout`.
 *
 * `PangoLayoutLine` structures are obtained by calling
 * [method@Pango.Layout.get_line] and are only valid until the text,
 * attributes, or settings of the parent `PangoLayout` are modified.
125
 */
126
127
128
struct _PangoLayoutLine
{
  PangoLayout *layout;
Havoc Pennington's avatar
Havoc Pennington committed
129
130
  gint         start_index;     /* start of line as byte index into layout->text */
  gint         length;		/* length of line in bytes */
131
  GSList      *runs;
132
  guint        is_paragraph_start : 1;  /* TRUE if this is the first line of the paragraph */
133
  guint        resolved_dir : 3;  /* Resolved PangoDirection of line */
134
135
};

136
137
138
139
140
141
142
143
#define PANGO_TYPE_LAYOUT              (pango_layout_get_type ())
#define PANGO_LAYOUT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_LAYOUT, PangoLayout))
#define PANGO_LAYOUT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_LAYOUT, PangoLayoutClass))
#define PANGO_IS_LAYOUT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_LAYOUT))
#define PANGO_IS_LAYOUT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_LAYOUT))
#define PANGO_LAYOUT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_LAYOUT, PangoLayoutClass))

/* The PangoLayout and PangoLayoutClass structs are private; if you
Behdad Esfahbod's avatar
Behdad Esfahbod committed
144
 * need to create a subclass of these, file a bug.
145
146
 */

147
PANGO_AVAILABLE_IN_ALL
Elliot Lee's avatar
Elliot Lee committed
148
GType        pango_layout_get_type       (void) G_GNUC_CONST;
149
PANGO_AVAILABLE_IN_ALL
150
PangoLayout *pango_layout_new            (PangoContext   *context);
151
PANGO_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
152
PangoLayout *pango_layout_copy           (PangoLayout    *src);
Owen Taylor's avatar
Owen Taylor committed
153

154
PANGO_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
155
156
PangoContext  *pango_layout_get_context    (PangoLayout    *layout);

157
PANGO_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
158
159
void           pango_layout_set_attributes (PangoLayout    *layout,
					    PangoAttrList  *attrs);
160
PANGO_AVAILABLE_IN_ALL
161
162
PangoAttrList *pango_layout_get_attributes (PangoLayout    *layout);

163
PANGO_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
164
void           pango_layout_set_text       (PangoLayout    *layout,
165
					    const char     *text,
Owen Taylor's avatar
Owen Taylor committed
166
					    int             length);
167
PANGO_AVAILABLE_IN_ALL
168
const char    *pango_layout_get_text       (PangoLayout    *layout);
Owen Taylor's avatar
Owen Taylor committed
169

170
PANGO_AVAILABLE_IN_1_30
171
172
gint           pango_layout_get_character_count (PangoLayout *layout);

173
PANGO_AVAILABLE_IN_ALL
174
void           pango_layout_set_markup     (PangoLayout    *layout,
175
176
					    const char     *markup,
					    int             length);
177

178
PANGO_AVAILABLE_IN_ALL
179
void           pango_layout_set_markup_with_accel (PangoLayout    *layout,
180
181
182
183
						   const char     *markup,
						   int             length,
						   gunichar        accel_marker,
						   gunichar       *accel_char);
184

185
PANGO_AVAILABLE_IN_ALL
186
187
void           pango_layout_set_font_description (PangoLayout                *layout,
						  const PangoFontDescription *desc);
Owen Taylor's avatar
Owen Taylor committed
188

189
PANGO_AVAILABLE_IN_1_8
190
const PangoFontDescription *pango_layout_get_font_description (PangoLayout *layout);
Owen Taylor's avatar
Owen Taylor committed
191

192
PANGO_AVAILABLE_IN_ALL
193
194
void           pango_layout_set_width            (PangoLayout                *layout,
						  int                         width);
195
PANGO_AVAILABLE_IN_ALL
196
int            pango_layout_get_width            (PangoLayout                *layout);
197
PANGO_AVAILABLE_IN_1_20
198
199
void           pango_layout_set_height           (PangoLayout                *layout,
						  int                         height);
200
PANGO_AVAILABLE_IN_1_20
201
int            pango_layout_get_height           (PangoLayout                *layout);
202
PANGO_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
203
void           pango_layout_set_wrap             (PangoLayout                *layout,
204
						  PangoWrapMode               wrap);
205
PANGO_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
206
PangoWrapMode  pango_layout_get_wrap             (PangoLayout                *layout);
207
PANGO_AVAILABLE_IN_1_16
208
gboolean       pango_layout_is_wrapped           (PangoLayout                *layout);
209
PANGO_AVAILABLE_IN_ALL
210
211
void           pango_layout_set_indent           (PangoLayout                *layout,
						  int                         indent);
212
PANGO_AVAILABLE_IN_ALL
213
int            pango_layout_get_indent           (PangoLayout                *layout);
214
PANGO_AVAILABLE_IN_ALL
215
216
void           pango_layout_set_spacing          (PangoLayout                *layout,
						  int                         spacing);
217
PANGO_AVAILABLE_IN_ALL
218
int            pango_layout_get_spacing          (PangoLayout                *layout);
Matthias Clasen's avatar
Matthias Clasen committed
219
220
PANGO_AVAILABLE_IN_1_44
void           pango_layout_set_line_spacing     (PangoLayout                *layout,
221
                                                  float                       factor);
Matthias Clasen's avatar
Matthias Clasen committed
222
223
PANGO_AVAILABLE_IN_1_44
float          pango_layout_get_line_spacing     (PangoLayout                *layout);
224
PANGO_AVAILABLE_IN_ALL
225
void           pango_layout_set_justify          (PangoLayout                *layout,
Matthias Clasen's avatar
Matthias Clasen committed
226
                                                  gboolean                    justify);
227
PANGO_AVAILABLE_IN_ALL
228
gboolean       pango_layout_get_justify          (PangoLayout                *layout);
Matthias Clasen's avatar
Matthias Clasen committed
229
230
231
232
233
PANGO_AVAILABLE_IN_1_50
void           pango_layout_set_justify_last_line (PangoLayout                *layout,
                                                   gboolean                    justify);
PANGO_AVAILABLE_IN_1_50
gboolean       pango_layout_get_justify_last_line (PangoLayout                *layout);
234
PANGO_AVAILABLE_IN_1_4
Behdad Esfahbod's avatar
Behdad Esfahbod committed
235
void           pango_layout_set_auto_dir         (PangoLayout                *layout,
236
						  gboolean                    auto_dir);
237
PANGO_AVAILABLE_IN_1_4
Behdad Esfahbod's avatar
Behdad Esfahbod committed
238
gboolean       pango_layout_get_auto_dir         (PangoLayout                *layout);
239
PANGO_AVAILABLE_IN_ALL
240
241
void           pango_layout_set_alignment        (PangoLayout                *layout,
						  PangoAlignment              alignment);
242
PANGO_AVAILABLE_IN_ALL
243
PangoAlignment pango_layout_get_alignment        (PangoLayout                *layout);
Owen Taylor's avatar
Owen Taylor committed
244

245
PANGO_AVAILABLE_IN_ALL
246
void           pango_layout_set_tabs             (PangoLayout                *layout,
247
						  PangoTabArray              *tabs);
248
PANGO_AVAILABLE_IN_ALL
249
250
PangoTabArray* pango_layout_get_tabs             (PangoLayout                *layout);

251
PANGO_AVAILABLE_IN_ALL
252
void           pango_layout_set_single_paragraph_mode (PangoLayout                *layout,
253
						       gboolean                    setting);
254
PANGO_AVAILABLE_IN_ALL
255
256
gboolean       pango_layout_get_single_paragraph_mode (PangoLayout                *layout);

257
PANGO_AVAILABLE_IN_1_6
258
259
void               pango_layout_set_ellipsize (PangoLayout        *layout,
					       PangoEllipsizeMode  ellipsize);
260
PANGO_AVAILABLE_IN_1_6
261
PangoEllipsizeMode pango_layout_get_ellipsize (PangoLayout        *layout);
262
PANGO_AVAILABLE_IN_1_16
263
gboolean           pango_layout_is_ellipsized (PangoLayout        *layout);
264

265
PANGO_AVAILABLE_IN_1_16
266
267
int      pango_layout_get_unknown_glyphs_count (PangoLayout    *layout);

268
269
270
271
PANGO_AVAILABLE_IN_1_46
PangoDirection pango_layout_get_direction (PangoLayout *layout,
                                           int          index);

272
PANGO_AVAILABLE_IN_ALL
273
void     pango_layout_context_changed (PangoLayout    *layout);
274
PANGO_AVAILABLE_IN_1_32
275
guint    pango_layout_get_serial      (PangoLayout    *layout);
Owen Taylor's avatar
Owen Taylor committed
276

277
PANGO_AVAILABLE_IN_ALL
278
279
280
281
void     pango_layout_get_log_attrs (PangoLayout    *layout,
				     PangoLogAttr  **attrs,
				     gint           *n_attrs);

282
PANGO_AVAILABLE_IN_1_30
Behdad Esfahbod's avatar
Minor    
Behdad Esfahbod committed
283
284
const PangoLogAttr *pango_layout_get_log_attrs_readonly (PangoLayout *layout,
							 gint        *n_attrs);
285

286
PANGO_AVAILABLE_IN_ALL
287
void     pango_layout_index_to_pos         (PangoLayout    *layout,
288
					    int             index_,
289
					    PangoRectangle *pos);
290
PANGO_AVAILABLE_IN_ALL
291
void     pango_layout_index_to_line_x      (PangoLayout    *layout,
292
293
294
295
					    int             index_,
					    gboolean        trailing,
					    int            *line,
					    int            *x_pos);
296
PANGO_AVAILABLE_IN_ALL
297
void     pango_layout_get_cursor_pos       (PangoLayout    *layout,
298
					    int             index_,
299
300
					    PangoRectangle *strong_pos,
					    PangoRectangle *weak_pos);
301
302
303
304
305
306
307

PANGO_AVAILABLE_IN_1_50
void     pango_layout_get_caret_pos        (PangoLayout    *layout,
                                            int             index_,
                                            PangoRectangle *strong_pos,
                                            PangoRectangle *weak_pos);

308
PANGO_AVAILABLE_IN_ALL
309
void     pango_layout_move_cursor_visually (PangoLayout    *layout,
310
					    gboolean        strong,
311
312
313
314
315
					    int             old_index,
					    int             old_trailing,
					    int             direction,
					    int            *new_index,
					    int            *new_trailing);
316
PANGO_AVAILABLE_IN_ALL
317
318
319
gboolean pango_layout_xy_to_index          (PangoLayout    *layout,
					    int             x,
					    int             y,
320
					    int            *index_,
321
					    int            *trailing);
322
PANGO_AVAILABLE_IN_ALL
323
324
325
void     pango_layout_get_extents          (PangoLayout    *layout,
					    PangoRectangle *ink_rect,
					    PangoRectangle *logical_rect);
326
PANGO_AVAILABLE_IN_ALL
327
328
329
void     pango_layout_get_pixel_extents    (PangoLayout    *layout,
					    PangoRectangle *ink_rect,
					    PangoRectangle *logical_rect);
330
PANGO_AVAILABLE_IN_ALL
331
332
333
void     pango_layout_get_size             (PangoLayout    *layout,
					    int            *width,
					    int            *height);
334
PANGO_AVAILABLE_IN_ALL
335
336
337
void     pango_layout_get_pixel_size       (PangoLayout    *layout,
					    int            *width,
					    int            *height);
338
PANGO_AVAILABLE_IN_1_22
339
int      pango_layout_get_baseline         (PangoLayout    *layout);
Owen Taylor's avatar
Owen Taylor committed
340

341
PANGO_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
342
int              pango_layout_get_line_count       (PangoLayout    *layout);
343
PANGO_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
344
345
PangoLayoutLine *pango_layout_get_line             (PangoLayout    *layout,
						    int             line);
346
PANGO_AVAILABLE_IN_1_16
347
348
PangoLayoutLine *pango_layout_get_line_readonly    (PangoLayout    *layout,
						    int             line);
349
PANGO_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
350
GSList *         pango_layout_get_lines            (PangoLayout    *layout);
351
PANGO_AVAILABLE_IN_1_16
352
GSList *         pango_layout_get_lines_readonly   (PangoLayout    *layout);
353

354
355
356
/**
 * PangoLayoutSerializeFlags:
 * @PANGO_LAYOUT_SERIALIZE_DEFAULT: Default behavior
357
 * @PANGO_LAYOUT_SERIALIZE_CONTEXT: Include context information
Matthias Clasen's avatar
Matthias Clasen committed
358
 * @PANGO_LAYOUT_SERIALIZE_OUTPUT: Include information about the formatted output
359
360
361
362
363
364
365
 *
 * Flags that influence the behavior of [method@Pango.Layout.serialize].
 *
 * New members may be added to this enumeration over time.
 */
typedef enum {
  PANGO_LAYOUT_SERIALIZE_DEFAULT = 0,
366
  PANGO_LAYOUT_SERIALIZE_CONTEXT = 1 << 0,
Matthias Clasen's avatar
Matthias Clasen committed
367
  PANGO_LAYOUT_SERIALIZE_OUTPUT = 1 << 1,
368
369
370
371
372
373
} PangoLayoutSerializeFlags;

PANGO_AVAILABLE_IN_1_50
GBytes *        pango_layout_serialize             (PangoLayout                *layout,
                                                    PangoLayoutSerializeFlags   flags);

Matthias Clasen's avatar
Matthias Clasen committed
374
PANGO_AVAILABLE_IN_1_50
375
376
377
378
379
gboolean        pango_layout_write_to_file         (PangoLayout                 *layout,
                                                    PangoLayoutSerializeFlags   flags,

                                                    const char                  *filename,
                                                    GError                     **error);
Matthias Clasen's avatar
Matthias Clasen committed
380

Matthias Clasen's avatar
Matthias Clasen committed
381
#define PANGO_LAYOUT_DESERIALIZE_ERROR (pango_layout_deserialize_error_quark ())
Matthias Clasen's avatar
Matthias Clasen committed
382

Matthias Clasen's avatar
Matthias Clasen committed
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
/**
 * PangoLayoutDeserializeError:
 * @PANGO_LAYOUT_SERIALIZE_INVALID: Unspecified error
 * @PANGO_LAYOUT_SERIALIZE_INVALID_SYNTAX: The serialized data had
 *   the wrong structure (e.g. a member was expected to be a JSon object,
 *   but was an array)
 * @PANGO_LAYOUT_SERIALIZE_INVALID_VALUE: A JSon value could not be
 *   interpreted
 * @PANGO_LAYOUT_SERIALIZE_MISSING_VALUE: A required JSon member was
 *   not found
 *
 * Errors that can be returned by [func@Pango.Layout.deserialize].
 */
typedef enum {
  PANGO_LAYOUT_DESERIALIZE_INVALID,
  PANGO_LAYOUT_DESERIALIZE_INVALID_SYNTAX,
  PANGO_LAYOUT_DESERIALIZE_INVALID_VALUE,
  PANGO_LAYOUT_DESERIALIZE_MISSING_VALUE,
} PangoLayoutDeserializeError;
Matthias Clasen's avatar
Matthias Clasen committed
402
403

PANGO_AVAILABLE_IN_1_50
Matthias Clasen's avatar
Matthias Clasen committed
404
GQuark          pango_layout_deserialize_error_quark (void);
Matthias Clasen's avatar
Matthias Clasen committed
405

406
407
408
/**
 * PangoLayoutDeserializeFlags:
 * @PANGO_LAYOUT_DESERIALIZE_DEFAULT: Default behavior
409
410
 * @PANGO_LAYOUT_DESERIALIZE_CONTEXT: Apply context information
 *   from the serialization to the `PangoContext`
411
412
413
414
415
416
417
 *
 * Flags that influence the behavior of [method@Pango.Layout.deserialize].
 *
 * New members may be added to this enumeration over time.
 */
typedef enum {
  PANGO_LAYOUT_DESERIALIZE_DEFAULT = 0,
418
  PANGO_LAYOUT_DESERIALIZE_CONTEXT = 1 << 0,
419
420
} PangoLayoutDeserializeFlags;

Matthias Clasen's avatar
Matthias Clasen committed
421
PANGO_AVAILABLE_IN_1_50
Matthias Clasen's avatar
Matthias Clasen committed
422
423
PangoLayout *   pango_layout_deserialize           (PangoContext                 *context,
                                                    GBytes                       *bytes,
424
                                                    PangoLayoutDeserializeFlags   flags,
Matthias Clasen's avatar
Matthias Clasen committed
425
                                                    GError                      **error);
Matthias Clasen's avatar
Matthias Clasen committed
426

427

428
429
#define PANGO_TYPE_LAYOUT_LINE (pango_layout_line_get_type ())

430
PANGO_AVAILABLE_IN_ALL
431
432
GType    pango_layout_line_get_type     (void) G_GNUC_CONST;

433
PANGO_AVAILABLE_IN_1_10
434
PangoLayoutLine *pango_layout_line_ref   (PangoLayoutLine *line);
435
PANGO_AVAILABLE_IN_ALL
436
437
void             pango_layout_line_unref (PangoLayoutLine *line);

438
439
440
441
442
443
444
445
446
PANGO_AVAILABLE_IN_1_50
int      pango_layout_line_get_start_index (PangoLayoutLine *line);
PANGO_AVAILABLE_IN_1_50
int      pango_layout_line_get_length      (PangoLayoutLine *line);
PANGO_AVAILABLE_IN_1_50
gboolean pango_layout_line_is_paragraph_start (PangoLayoutLine *line);
PANGO_AVAILABLE_IN_1_50
PangoDirection pango_layout_line_get_resolved_direction (PangoLayoutLine *line);

447
PANGO_AVAILABLE_IN_ALL
448
gboolean pango_layout_line_x_to_index   (PangoLayoutLine  *line,
449
					 int               x_pos,
450
					 int              *index_,
451
					 int              *trailing);
452
PANGO_AVAILABLE_IN_ALL
453
void     pango_layout_line_index_to_x   (PangoLayoutLine  *line,
454
					 int               index_,
455
456
					 gboolean          trailing,
					 int              *x_pos);
457
PANGO_AVAILABLE_IN_ALL
458
459
460
461
462
void     pango_layout_line_get_x_ranges (PangoLayoutLine  *line,
					 int               start_index,
					 int               end_index,
					 int             **ranges,
					 int              *n_ranges);
463
PANGO_AVAILABLE_IN_ALL
464
465
466
void     pango_layout_line_get_extents  (PangoLayoutLine  *line,
					 PangoRectangle   *ink_rect,
					 PangoRectangle   *logical_rect);
467
468
469
470
PANGO_AVAILABLE_IN_1_44
void     pango_layout_line_get_height   (PangoLayoutLine  *line,
					 int              *height);

471
PANGO_AVAILABLE_IN_ALL
472
473
474
void     pango_layout_line_get_pixel_extents (PangoLayoutLine *layout_line,
					      PangoRectangle  *ink_rect,
					      PangoRectangle  *logical_rect);
475

476
477
typedef struct _PangoLayoutIter PangoLayoutIter;

478
479
#define PANGO_TYPE_LAYOUT_ITER         (pango_layout_iter_get_type ())

480
PANGO_AVAILABLE_IN_ALL
481
GType            pango_layout_iter_get_type (void) G_GNUC_CONST;
482

483
PANGO_AVAILABLE_IN_ALL
484
PangoLayoutIter *pango_layout_get_iter  (PangoLayout     *layout);
485
PANGO_AVAILABLE_IN_1_20
486
PangoLayoutIter *pango_layout_iter_copy (PangoLayoutIter *iter);
487
PANGO_AVAILABLE_IN_ALL
488
489
void             pango_layout_iter_free (PangoLayoutIter *iter);

490
PANGO_AVAILABLE_IN_ALL
491
int              pango_layout_iter_get_index  (PangoLayoutIter *iter);
492
PANGO_AVAILABLE_IN_ALL
493
PangoLayoutRun  *pango_layout_iter_get_run    (PangoLayoutIter *iter);
494
PANGO_AVAILABLE_IN_1_16
495
PangoLayoutRun  *pango_layout_iter_get_run_readonly   (PangoLayoutIter *iter);
496
PANGO_AVAILABLE_IN_ALL
497
PangoLayoutLine *pango_layout_iter_get_line   (PangoLayoutIter *iter);
498
PANGO_AVAILABLE_IN_1_16
499
PangoLayoutLine *pango_layout_iter_get_line_readonly  (PangoLayoutIter *iter);
500
PANGO_AVAILABLE_IN_ALL
501
gboolean         pango_layout_iter_at_last_line (PangoLayoutIter *iter);
502
PANGO_AVAILABLE_IN_1_20
503
PangoLayout     *pango_layout_iter_get_layout (PangoLayoutIter *iter);
504

505
PANGO_AVAILABLE_IN_ALL
506
gboolean pango_layout_iter_next_char    (PangoLayoutIter *iter);
507
PANGO_AVAILABLE_IN_ALL
508
gboolean pango_layout_iter_next_cluster (PangoLayoutIter *iter);
509
PANGO_AVAILABLE_IN_ALL
510
gboolean pango_layout_iter_next_run     (PangoLayoutIter *iter);
511
PANGO_AVAILABLE_IN_ALL
512
513
gboolean pango_layout_iter_next_line    (PangoLayoutIter *iter);

514
PANGO_AVAILABLE_IN_ALL
515
void pango_layout_iter_get_char_extents    (PangoLayoutIter *iter,
516
					    PangoRectangle  *logical_rect);
517
PANGO_AVAILABLE_IN_ALL
518
void pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter,
519
520
					    PangoRectangle  *ink_rect,
					    PangoRectangle  *logical_rect);
521
PANGO_AVAILABLE_IN_ALL
522
void pango_layout_iter_get_run_extents     (PangoLayoutIter *iter,
523
524
					    PangoRectangle  *ink_rect,
					    PangoRectangle  *logical_rect);
525
PANGO_AVAILABLE_IN_ALL
526
void pango_layout_iter_get_line_extents    (PangoLayoutIter *iter,
527
528
					    PangoRectangle  *ink_rect,
					    PangoRectangle  *logical_rect);
529
530
531
/* All the yranges meet, unlike the logical_rect's (i.e. the yranges
 * assign between-line spacing to the nearest line)
 */
532
PANGO_AVAILABLE_IN_ALL
533
void pango_layout_iter_get_line_yrange     (PangoLayoutIter *iter,
534
535
					    int             *y0_,
					    int             *y1_);
536
PANGO_AVAILABLE_IN_ALL
537
void pango_layout_iter_get_layout_extents  (PangoLayoutIter *iter,
538
539
					    PangoRectangle  *ink_rect,
					    PangoRectangle  *logical_rect);
540
PANGO_AVAILABLE_IN_ALL
541
int  pango_layout_iter_get_baseline        (PangoLayoutIter *iter);
542
543
PANGO_AVAILABLE_IN_1_50
int  pango_layout_iter_get_run_baseline    (PangoLayoutIter *iter);
544

Matthias Clasen's avatar
Matthias Clasen committed
545
546
547
548

G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLayoutIter, pango_layout_iter_free)

Owen Taylor's avatar
Owen Taylor committed
549
G_END_DECLS
550

551
#endif /* __PANGO_LAYOUT_H__ */
552