Git init
[external/pango1.0.git] / docs / tmpl / glyphs.sgml
1 <!-- ##### SECTION Title ##### -->
2 Glyph Storage
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Structures for storing information about glyphs
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 pango_shape() produces a string of glyphs which
10 can be measured or drawn to the screen. The following
11 structures are used to store information about
12 glyphs.
13 </para>
14
15 <!-- ##### SECTION See_Also ##### -->
16 <para>
17
18 </para>
19
20 <!-- ##### SECTION Stability_Level ##### -->
21
22
23 <!-- ##### MACRO PANGO_SCALE ##### -->
24 <para>
25 The %PANGO_SCALE macro represents the scale between dimensions used
26 for Pango distances and device units. (The definition of device
27 units is dependent on the output device; it will typically be pixels
28 for a screen, and points for a printer.) %PANGO_SCALE is currently
29 1024, but this may be changed in the future.
30 </para>
31 <para>
32 When setting font sizes, device units are always considered to be
33 points (as in "12 point font"), rather than pixels. 
34 </para>
35
36
37
38 <!-- ##### MACRO PANGO_PIXELS ##### -->
39 <para>
40 Converts a dimension to device units by rounding.
41 </para>
42
43 @d: a dimension in Pango units.
44 @Returns: rounded dimension in device units.
45
46
47 <!-- ##### MACRO PANGO_PIXELS_FLOOR ##### -->
48 <para>
49 Converts a dimension to device units by flooring.
50 </para>
51
52 @d: a dimension in Pango units.
53 @Returns: floored dimension in device units.
54 @Since: 1.14
55
56
57 <!-- ##### MACRO PANGO_PIXELS_CEIL ##### -->
58 <para>
59 Converts a dimension to device units by ceiling.
60 </para>
61
62 @d: a dimension in Pango units.
63 @Returns: ceiled dimension in device units.
64 @Since: 1.14
65
66
67 <!-- ##### MACRO PANGO_UNITS_ROUND ##### -->
68 <para>
69 Rounds a dimension to whole device units, but does not
70 convert it to device units.
71 </para>
72
73 @d: a dimension in Pango units.
74 @Returns: rounded dimension in Pango units.
75 @Since: 1.18
76
77
78 <!-- ##### FUNCTION pango_units_to_double ##### -->
79 <para>
80
81 </para>
82
83 @i: 
84 @Returns: 
85
86
87 <!-- ##### FUNCTION pango_units_from_double ##### -->
88 <para>
89
90 </para>
91
92 @d: 
93 @Returns: 
94
95
96 <!-- ##### STRUCT PangoRectangle ##### -->
97 <para>
98 The #PangoRectangle structure represents a rectangle. It is frequently
99 used to represent the logical or ink extents of a single glyph or section
100 of text. (See, for instance, pango_font_get_glyph_extents())
101 </para>
102
103 @x: X coordinate of the left side of the rectangle.
104 @y: Y coordinate of the the top side of the rectangle.
105 @width: width of the rectangle.
106 @height: height of the rectangle.
107
108 <!-- ##### MACRO PANGO_ASCENT ##### -->
109 <para>
110 Extracts the <firstterm>ascent</firstterm> from a #PangoRectangle
111 representing glyph extents. The ascent is the distance from the
112 baseline to the highest point of the character. This is positive if the
113 glyph ascends above the baseline.
114 </para>
115
116 @rect: a #PangoRectangle
117
118
119 <!-- ##### MACRO PANGO_DESCENT ##### -->
120 <para>
121 Extracts the <firstterm>descent</firstterm> from a #PangoRectangle
122 representing glyph extents. The descent is the distance from the
123 baseline to the lowest point of the character. This is positive if the
124 glyph descends below the baseline.
125 </para>
126
127 @rect: a #PangoRectangle
128
129
130 <!-- ##### MACRO PANGO_LBEARING ##### -->
131 <para>
132 Extracts the <firstterm>left bearing</firstterm> from a #PangoRectangle
133 representing glyph extents. The left bearing is the distance from the
134 horizontal origin to the farthest left point of the character.
135 This is positive for characters drawn completely to the right of the
136 glyph origin.
137 </para>
138
139 @rect: a #PangoRectangle
140
141
142 <!-- ##### MACRO PANGO_RBEARING ##### -->
143 <para>
144 Extracts the <firstterm>right bearing</firstterm> from a #PangoRectangle
145 representing glyph extents. The right bearing is the distance from the
146 horizontal origin to the farthest right point of the character.
147 This is positive except for characters drawn completely to the left of the
148 horizontal origin.
149 </para>
150
151 @rect: a #PangoRectangle
152
153
154 <!-- ##### FUNCTION pango_extents_to_pixels ##### -->
155 <para>
156
157 </para>
158
159 @inclusive: 
160 @nearest: 
161
162
163 <!-- ##### STRUCT PangoMatrix ##### -->
164 <para>
165
166 </para>
167
168 @xx: 
169 @xy: 
170 @yx: 
171 @yy: 
172 @x0: 
173 @y0: 
174
175 <!-- ##### MACRO PANGO_TYPE_MATRIX ##### -->
176 <para>
177
178 </para>
179
180
181
182 <!-- ##### MACRO PANGO_MATRIX_INIT ##### -->
183 <para>
184
185 </para>
186
187
188
189 <!-- ##### FUNCTION pango_matrix_copy ##### -->
190 <para>
191
192 </para>
193
194 @matrix: 
195 @Returns: 
196
197
198 <!-- ##### FUNCTION pango_matrix_free ##### -->
199 <para>
200
201 </para>
202
203 @matrix: 
204
205
206 <!-- ##### FUNCTION pango_matrix_translate ##### -->
207 <para>
208
209 </para>
210
211 @matrix: 
212 @tx: 
213 @ty: 
214
215
216 <!-- ##### FUNCTION pango_matrix_scale ##### -->
217 <para>
218
219 </para>
220
221 @matrix: 
222 @scale_x: 
223 @scale_y: 
224
225
226 <!-- ##### FUNCTION pango_matrix_rotate ##### -->
227 <para>
228
229 </para>
230
231 @matrix: 
232 @degrees: 
233
234
235 <!-- ##### FUNCTION pango_matrix_concat ##### -->
236 <para>
237
238 </para>
239
240 @matrix: 
241 @new_matrix: 
242
243
244 <!-- ##### FUNCTION pango_matrix_transform_point ##### -->
245 <para>
246
247 </para>
248
249 @matrix: 
250 @x: 
251 @y: 
252
253
254 <!-- ##### FUNCTION pango_matrix_transform_distance ##### -->
255 <para>
256
257 </para>
258
259 @matrix: 
260 @dx: 
261 @dy: 
262
263
264 <!-- ##### FUNCTION pango_matrix_transform_rectangle ##### -->
265 <para>
266
267 </para>
268
269 @matrix: 
270 @rect: 
271
272
273 <!-- ##### FUNCTION pango_matrix_transform_pixel_rectangle ##### -->
274 <para>
275
276 </para>
277
278 @matrix: 
279 @rect: 
280
281
282 <!-- ##### FUNCTION pango_matrix_get_font_scale_factor ##### -->
283 <para>
284
285 </para>
286
287 @matrix: 
288 @Returns: 
289
290
291 <!-- ##### TYPEDEF PangoGlyph ##### -->
292 <para>
293 A #PangoGlyph represents a single glyph in the output form of a string.
294 </para>
295
296
297 <!-- ##### MACRO PANGO_GLYPH_EMPTY ##### -->
298 <para>
299 The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
300 special meaning, which is a zero-width empty glyph.  This is useful for
301 example in shaper modules, to use as the glyph for various zero-width
302 Unicode characters (those passing pango_is_zero_width()).
303 </para>
304
305
306
307 <!-- ##### MACRO PANGO_GLYPH_INVALID_INPUT ##### -->
308 <para>
309 The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
310 special meaning of invalid input.  #PangoLayout produces one such glyph
311 per invalid input UTF-8 byte and such a glyph is rendered as a crossed
312 box.
313
314 Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
315 on.
316 </para>
317
318 @Since: 1.20
319
320
321 <!-- ##### MACRO PANGO_GLYPH_UNKNOWN_FLAG ##### -->
322 <para>
323 The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to
324 a #gunichar value of a valid Unicode character, to produce a #PangoGlyph
325 value, representing an unknown-character glyph for the respective #gunichar.
326 </para>
327
328
329
330 <!-- ##### MACRO PANGO_GET_UNKNOWN_GLYPH ##### -->
331 <para>
332 Returns a #PangoGlyph value that means no glyph was found for @wc.
333 The way this unknown glyphs are rendered is backend specific.  For example,
334 a box with the hexadecimal Unicode code-point of the character written in it
335 is what is done in the most common backends.
336 </para>
337
338 @wc: a Unicode character
339
340
341 <!-- ##### STRUCT PangoGlyphInfo ##### -->
342 <para>
343 The #PangoGlyphInfo structure represents a single glyph together with
344 positioning information and visual attributes.
345 It contains the following fields.
346 </para>
347
348 @glyph: the glyph itself.
349 @geometry: the positional information about the glyph.
350 @attr: the visual attributes of the glyph.
351
352 <!-- ##### STRUCT PangoGlyphGeometry ##### -->
353 <para>
354 The #PangoGlyphGeometry structure contains width and positioning
355 information for a single glyph. 
356 </para>
357
358 @width: the logical width to use for the the character.
359 @x_offset: horizontal offset from nominal character position.
360 @y_offset: vertical offset from nominal character position.
361
362 <!-- ##### TYPEDEF PangoGlyphUnit ##### -->
363 <para>
364 The #PangoGlyphUnit type is used to store dimensions within
365 Pango. Dimensions are stored in 1/%PANGO_SCALE of a device unit.
366 (A device unit might be a pixel for screen display, or
367 a point on a printer.) %PANGO_SCALE is currently 1024, and
368 may change in the future (unlikely though), but you should not
369 depend on its exact value. The PANGO_PIXELS() macro can be used
370 to convert from glyph units into device units with correct rounding.
371 </para>
372
373
374 <!-- ##### STRUCT PangoGlyphVisAttr ##### -->
375 <para>
376 The PangoGlyphVisAttr is used to communicate information between
377 the shaping phase and the rendering phase.  More attributes may be
378 added in the future.
379 </para>
380
381 @is_cluster_start: set for the first logical glyph in each cluster. (Clusters
382                    are stored in visual order, within the cluster, glyphs
383                    are always ordered in logical order, since visual
384                    order is meaningless; that is, in Arabic text, accent glyphs
385                    follow the glyphs for the base character.)
386
387 <!-- ##### STRUCT PangoGlyphString ##### -->
388 <para>
389 The #PangoGlyphString structure is used to store strings
390 of glyphs with geometry and visual attribute information.
391 The storage for the glyph information is owned
392 by the structure which simplifies memory management.
393 </para>
394
395 @num_glyphs: the number of glyphs in the string.
396 @glyphs: an array of #PangoGlyphInfo structures of length <structfield>num_glyphs</structfield>.
397 @log_clusters: for each glyph, byte index of the starting character for the
398 cluster. The indices are relative to the start of the text
399 corresponding to the PangoGlyphString.
400
401 <!-- ##### STRUCT PangoGlyphItem ##### -->
402 <para>
403 A #PangoGlyphItem is a pair of a #PangoItem and the glyphs
404 resulting from shaping the text corresponding to an item.
405 As an example of the usage of #PangoGlyphItem, the results
406 of shaping text with #PangoLayout is a list of #PangoLayoutLine,
407 each of which contains a list of #PangoGlyphItem.
408 </para>
409
410 @item: a #PangoItem structure that provides information
411        about a segment of text.
412 @glyphs: the glyphs obtained by shaping the text
413          corresponding to @item.
414
415 <!-- ##### STRUCT PangoGlyphItemIter ##### -->
416 <para>
417 A #PangoGlyphItemIter is an iterator over the clusters in a
418 #PangoGlyphItem.  The <firstterm>forward direction</firstterm> of the
419 iterator is the logical direction of text.  That is, with increasing
420 @start_index and @start_char values.  If @glyph_item is right-to-left
421 (that is, if <literal>@glyph_item->item->analysis.level</literal> is odd),
422 then @start_glyph decreases as the iterator moves forward.  Moreover,
423 in right-to-left cases, @start_glyph is greater than @end_glyph.
424
425 An iterator should be initialized using either of
426 pango_glyph_item_iter_init_start() and
427 pango_glyph_item_iter_init_end(), for forward and backward iteration
428 respectively, and walked over using any desired mixture of
429 pango_glyph_item_iter_next_cluster() and
430 pango_glyph_item_iter_prev_cluster().  A common idiom for doing a
431 forward iteration over the clusters is:
432 <programlisting>
433 PangoGlyphItemIter cluster_iter;
434 gboolean have_cluster;
435
436 for (have_cluster = pango_glyph_item_iter_init_start (&amp;cluster_iter,
437                                                       glyph_item, text);
438      have_cluster;
439      have_cluster = pango_glyph_item_iter_next_cluster (&amp;cluster_iter))
440 {
441   ...
442 }
443 </programlisting>
444
445 Note that @text is the start of the text for layout, which is then
446 indexed by <literal>@glyph_item->item->offset</literal> to get to the
447 text of @glyph_item.  The @start_index and @end_index values can directly
448 index into @text.  The @start_glyph, @end_glyph, @start_char, and @end_char
449 values however are zero-based for the @glyph_item.  For each cluster, the
450 item pointed at by the start variables is included in the cluster while
451 the one pointed at by end variables is not.
452
453 None of the members of a #PangoGlyphItemIter should be modified manually.
454
455 </para>
456
457 @glyph_item: the #PangoGlyphItem this iterator iterates over
458 @text: the UTF-8 text that @glyph_item refers to
459 @start_glyph: starting glyph of the cluster
460 @start_index: starting text index of the cluster
461 @start_char: starting number of characters of the cluster
462 @end_glyph: ending glyph of the cluster
463 @end_index: ending text index of the cluster
464 @end_char: ending number of characters of the cluster
465 @Since: 1.22
466
467 <!-- ##### MACRO PANGO_TYPE_GLYPH_STRING ##### -->
468 <para>
469 The #GObject type for #PangoGlyphString.
470 </para>
471
472
473
474 <!-- ##### FUNCTION pango_glyph_string_new ##### -->
475 <para>
476
477 </para>
478
479 @Returns: 
480
481
482 <!-- ##### FUNCTION pango_glyph_string_copy ##### -->
483 <para>
484
485 </para>
486
487 @string: 
488 @Returns: 
489
490
491 <!-- ##### FUNCTION pango_glyph_string_set_size ##### -->
492 <para>
493
494 </para>
495
496 @string: 
497 @new_len: 
498
499
500 <!-- ##### FUNCTION pango_glyph_string_free ##### -->
501 <para>
502
503 </para>
504
505 @string: 
506
507
508 <!-- ##### FUNCTION pango_glyph_string_extents ##### -->
509 <para>
510
511 </para>
512
513 @glyphs: 
514 @font: 
515 @ink_rect: 
516 @logical_rect: 
517
518
519 <!-- ##### FUNCTION pango_glyph_string_extents_range ##### -->
520 <para>
521
522 </para>
523
524 @glyphs: 
525 @start: 
526 @end: 
527 @font: 
528 @ink_rect: 
529 @logical_rect: 
530
531
532 <!-- ##### FUNCTION pango_glyph_string_get_width ##### -->
533 <para>
534
535 </para>
536
537 @glyphs: 
538 @Returns: 
539
540
541 <!-- ##### FUNCTION pango_glyph_string_index_to_x ##### -->
542 <para>
543
544 </para>
545
546 @glyphs: 
547 @text: 
548 @length: 
549 @analysis: 
550 @index_: 
551 @trailing: 
552 @x_pos: 
553
554
555 <!-- ##### FUNCTION pango_glyph_string_x_to_index ##### -->
556 <para>
557
558 </para>
559
560 @glyphs: 
561 @text: 
562 @length: 
563 @analysis: 
564 @x_pos: 
565 @index_: 
566 @trailing: 
567
568
569 <!-- ##### FUNCTION pango_glyph_string_get_logical_widths ##### -->
570 <para>
571
572 </para>
573
574 @glyphs: 
575 @text: 
576 @length: 
577 @embedding_level: 
578 @logical_widths: 
579
580
581 <!-- ##### MACRO PANGO_TYPE_GLYPH_ITEM ##### -->
582 <para>
583 The #GObject type for #PangoGlyphItem.
584 </para>
585
586 @Since: 1.20
587
588
589 <!-- ##### FUNCTION pango_glyph_item_copy ##### -->
590 <para>
591
592 </para>
593
594 @orig: 
595 @Returns: 
596
597
598 <!-- ##### FUNCTION pango_glyph_item_free ##### -->
599 <para>
600
601 </para>
602
603 @glyph_item: 
604
605
606 <!-- ##### FUNCTION pango_glyph_item_split ##### -->
607 <para>
608
609 </para>
610
611 @orig: 
612 @text: 
613 @split_index: 
614 @Returns: 
615
616
617 <!-- ##### FUNCTION pango_glyph_item_apply_attrs ##### -->
618 <para>
619
620 </para>
621
622 @glyph_item: 
623 @text: 
624 @list: 
625 @Returns: 
626
627
628 <!-- ##### FUNCTION pango_glyph_item_letter_space ##### -->
629 <para>
630
631 </para>
632
633 @glyph_item: 
634 @text: 
635 @log_attrs: 
636 @letter_spacing: 
637
638
639 <!-- ##### FUNCTION pango_glyph_item_get_logical_widths ##### -->
640 <para>
641
642 </para>
643
644 @glyph_item: 
645 @text: 
646 @logical_widths: 
647
648
649 <!-- ##### MACRO PANGO_TYPE_GLYPH_ITEM_ITER ##### -->
650 <para>
651 The #GObject type for #PangoGlyphItemIter.
652 </para>
653
654 @Since: 1.22
655
656
657 <!-- ##### FUNCTION pango_glyph_item_iter_copy ##### -->
658 <para>
659
660 </para>
661
662 @orig: 
663 @Returns: 
664
665
666 <!-- ##### FUNCTION pango_glyph_item_iter_free ##### -->
667 <para>
668
669 </para>
670
671 @iter: 
672
673
674 <!-- ##### FUNCTION pango_glyph_item_iter_init_start ##### -->
675 <para>
676
677 </para>
678
679 @iter: 
680 @glyph_item: 
681 @text: 
682 @Returns: 
683
684
685 <!-- ##### FUNCTION pango_glyph_item_iter_init_end ##### -->
686 <para>
687
688 </para>
689
690 @iter: 
691 @glyph_item: 
692 @text: 
693 @Returns: 
694
695
696 <!-- ##### FUNCTION pango_glyph_item_iter_next_cluster ##### -->
697 <para>
698
699 </para>
700
701 @iter: 
702 @Returns: 
703
704
705 <!-- ##### FUNCTION pango_glyph_item_iter_prev_cluster ##### -->
706 <para>
707
708 </para>
709
710 @iter: 
711 @Returns: 
712
713