summaryrefslogtreecommitdiff
path: root/docs/tmpl/glyphs.sgml
blob: 926bf539439a31dfe2cb37f01db5f7be2c14e996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
<!-- ##### SECTION Title ##### -->
Glyph Storage

<!-- ##### SECTION Short_Description ##### -->
Structures for storing information about glyphs

<!-- ##### SECTION Long_Description ##### -->
<para>
pango_shape() produces a string of glyphs which
can be measured or drawn to the screen. The following
structures are used to store information about
glyphs.
</para>

<!-- ##### SECTION See_Also ##### -->
<para>

</para>

<!-- ##### SECTION Stability_Level ##### -->


<!-- ##### SECTION Image ##### -->


<!-- ##### MACRO PANGO_SCALE ##### -->
<para>
The %PANGO_SCALE macro represents the scale between dimensions used
for Pango distances and device units. (The definition of device
units is dependent on the output device; it will typically be pixels
for a screen, and points for a printer.) %PANGO_SCALE is currently
1024, but this may be changed in the future.
</para>
<para>
When setting font sizes, device units are always considered to be
points (as in "12 point font"), rather than pixels. 
</para>



<!-- ##### MACRO PANGO_PIXELS ##### -->
<para>
Converts a dimension to device units by rounding.
</para>

@d: a dimension in Pango units.
@Returns: rounded dimension in device units.


<!-- ##### MACRO PANGO_PIXELS_FLOOR ##### -->
<para>
Converts a dimension to device units by flooring.
</para>

@d: a dimension in Pango units.
@Returns: floored dimension in device units.
@Since: 1.14


<!-- ##### MACRO PANGO_PIXELS_CEIL ##### -->
<para>
Converts a dimension to device units by ceiling.
</para>

@d: a dimension in Pango units.
@Returns: ceiled dimension in device units.
@Since: 1.14


<!-- ##### MACRO PANGO_UNITS_ROUND ##### -->
<para>
Rounds a dimension to whole device units, but does not
convert it to device units.
</para>

@d: a dimension in Pango units.
@Returns: rounded dimension in Pango units.
@Since: 1.18


<!-- ##### FUNCTION pango_units_to_double ##### -->
<para>

</para>

@i: 
@Returns: 


<!-- ##### FUNCTION pango_units_from_double ##### -->
<para>

</para>

@d: 
@Returns: 


<!-- ##### STRUCT PangoRectangle ##### -->
<para>
The #PangoRectangle structure represents a rectangle. It is frequently
used to represent the logical or ink extents of a single glyph or section
of text. (See, for instance, pango_font_get_glyph_extents())
</para>

@x: X coordinate of the left side of the rectangle.
@y: Y coordinate of the the top side of the rectangle.
@width: width of the rectangle.
@height: height of the rectangle.

<!-- ##### MACRO PANGO_ASCENT ##### -->
<para>
Extracts the <firstterm>ascent</firstterm> from a #PangoRectangle
representing glyph extents. The ascent is the distance from the
baseline to the highest point of the character. This is positive if the
glyph ascends above the baseline.
</para>

@rect: a #PangoRectangle


<!-- ##### MACRO PANGO_DESCENT ##### -->
<para>
Extracts the <firstterm>descent</firstterm> from a #PangoRectangle
representing glyph extents. The descent is the distance from the
baseline to the lowest point of the character. This is positive if the
glyph descends below the baseline.
</para>

@rect: a #PangoRectangle


<!-- ##### MACRO PANGO_LBEARING ##### -->
<para>
Extracts the <firstterm>left bearing</firstterm> from a #PangoRectangle
representing glyph extents. The left bearing is the distance from the
horizontal origin to the farthest left point of the character.
This is positive for characters drawn completely to the right of the
glyph origin.
</para>

@rect: a #PangoRectangle


<!-- ##### MACRO PANGO_RBEARING ##### -->
<para>
Extracts the <firstterm>right bearing</firstterm> from a #PangoRectangle
representing glyph extents. The right bearing is the distance from the
horizontal origin to the farthest right point of the character.
This is positive except for characters drawn completely to the left of the
horizontal origin.
</para>

@rect: a #PangoRectangle


<!-- ##### FUNCTION pango_extents_to_pixels ##### -->
<para>

</para>

@inclusive: 
@nearest: 


<!-- ##### STRUCT PangoMatrix ##### -->
<para>

</para>


<!-- ##### MACRO PANGO_TYPE_MATRIX ##### -->
<para>

</para>



<!-- ##### MACRO PANGO_MATRIX_INIT ##### -->
<para>

</para>



<!-- ##### FUNCTION pango_matrix_copy ##### -->
<para>

</para>

@matrix: 
@Returns: 


<!-- ##### FUNCTION pango_matrix_free ##### -->
<para>

</para>

@matrix: 


<!-- ##### FUNCTION pango_matrix_translate ##### -->
<para>

</para>

@matrix: 
@tx: 
@ty: 


<!-- ##### FUNCTION pango_matrix_scale ##### -->
<para>

</para>

@matrix: 
@scale_x: 
@scale_y: 


<!-- ##### FUNCTION pango_matrix_rotate ##### -->
<para>

</para>

@matrix: 
@degrees: 


<!-- ##### FUNCTION pango_matrix_concat ##### -->
<para>

</para>

@matrix: 
@new_matrix: 


<!-- ##### FUNCTION pango_matrix_transform_point ##### -->
<para>

</para>

@matrix: 
@x: 
@y: 


<!-- ##### FUNCTION pango_matrix_transform_distance ##### -->
<para>

</para>

@matrix: 
@dx: 
@dy: 


<!-- ##### FUNCTION pango_matrix_transform_rectangle ##### -->
<para>

</para>

@matrix: 
@rect: 


<!-- ##### FUNCTION pango_matrix_transform_pixel_rectangle ##### -->
<para>

</para>

@matrix: 
@rect: 


<!-- ##### FUNCTION pango_matrix_get_font_scale_factor ##### -->
<para>

</para>

@matrix: 
@Returns: 


<!-- ##### TYPEDEF PangoGlyph ##### -->
<para>
A #PangoGlyph represents a single glyph in the output form of a string.
</para>


<!-- ##### MACRO PANGO_GLYPH_EMPTY ##### -->
<para>
The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
special meaning, which is a zero-width empty glyph.  This is useful for
example in shaper modules, to use as the glyph for various zero-width
Unicode characters (those passing pango_is_zero_width()).
</para>



<!-- ##### MACRO PANGO_GLYPH_INVALID_INPUT ##### -->
<para>
The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
special meaning of invalid input.  #PangoLayout produces one such glyph
per invalid input UTF-8 byte and such a glyph is rendered as a crossed
box.

Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
on.
</para>

@Since: 1.20


<!-- ##### MACRO PANGO_GLYPH_UNKNOWN_FLAG ##### -->
<para>
The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to
a #gunichar value of a valid Unicode character, to produce a #PangoGlyph
value, representing an unknown-character glyph for the respective #gunichar.
</para>



<!-- ##### MACRO PANGO_GET_UNKNOWN_GLYPH ##### -->
<para>
Returns a #PangoGlyph value that means no glyph was found for @wc.
The way this unknown glyphs are rendered is backend specific.  For example,
a box with the hexadecimal Unicode code-point of the character written in it
is what is done in the most common backends.
</para>

@wc: a Unicode character


<!-- ##### STRUCT PangoGlyphInfo ##### -->
<para>
The #PangoGlyphInfo structure represents a single glyph together with
positioning information and visual attributes.
It contains the following fields.
</para>

@glyph: the glyph itself.
@geometry: the positional information about the glyph.
@attr: the visual attributes of the glyph.

<!-- ##### STRUCT PangoGlyphGeometry ##### -->
<para>
The #PangoGlyphGeometry structure contains width and positioning
information for a single glyph. 
</para>

@width: the logical width to use for the the character.
@x_offset: horizontal offset from nominal character position.
@y_offset: vertical offset from nominal character position.

<!-- ##### TYPEDEF PangoGlyphUnit ##### -->
<para>
The #PangoGlyphUnit type is used to store dimensions within
Pango. Dimensions are stored in 1/%PANGO_SCALE of a device unit.
(A device unit might be a pixel for screen display, or
a point on a printer.) %PANGO_SCALE is currently 1024, and
may change in the future (unlikely though), but you should not
depend on its exact value. The PANGO_PIXELS() macro can be used
to convert from glyph units into device units with correct rounding.
</para>


<!-- ##### STRUCT PangoGlyphVisAttr ##### -->
<para>
The PangoGlyphVisAttr is used to communicate information between
the shaping phase and the rendering phase.  More attributes may be
added in the future.
</para>

@is_cluster_start: set for the first logical glyph in each cluster. (Clusters
		   are stored in visual order, within the cluster, glyphs
		   are always ordered in logical order, since visual
		   order is meaningless; that is, in Arabic text, accent glyphs
		   follow the glyphs for the base character.)

<!-- ##### STRUCT PangoGlyphString ##### -->
<para>
The #PangoGlyphString structure is used to store strings
of glyphs with geometry and visual attribute information.
The storage for the glyph information is owned
by the structure which simplifies memory management.
</para>


<!-- ##### STRUCT PangoGlyphItem ##### -->
<para>
A #PangoGlyphItem is a pair of a #PangoItem and the glyphs
resulting from shaping the text corresponding to an item.
As an example of the usage of #PangoGlyphItem, the results
of shaping text with #PangoLayout is a list of #PangoLayoutLine,
each of which contains a list of #PangoGlyphItem.
</para>


<!-- ##### STRUCT PangoGlyphItemIter ##### -->
<para>
A #PangoGlyphItemIter is an iterator over the clusters in a
#PangoGlyphItem.  The <firstterm>forward direction</firstterm> of the
iterator is the logical direction of text.  That is, with increasing
@start_index and @start_char values.  If @glyph_item is right-to-left
(that is, if <literal>@glyph_item->item->analysis.level</literal> is odd),
then @start_glyph decreases as the iterator moves forward.  Moreover,
in right-to-left cases, @start_glyph is greater than @end_glyph.

An iterator should be initialized using either of
pango_glyph_item_iter_init_start() and
pango_glyph_item_iter_init_end(), for forward and backward iteration
respectively, and walked over using any desired mixture of
pango_glyph_item_iter_next_cluster() and
pango_glyph_item_iter_prev_cluster().  A common idiom for doing a
forward iteration over the clusters is:
<programlisting>
PangoGlyphItemIter cluster_iter;
gboolean have_cluster;

for (have_cluster = pango_glyph_item_iter_init_start (&amp;cluster_iter,
                                                      glyph_item, text);
     have_cluster;
     have_cluster = pango_glyph_item_iter_next_cluster (&amp;cluster_iter))
{
  ...
}
</programlisting>

Note that @text is the start of the text for layout, which is then
indexed by <literal>@glyph_item->item->offset</literal> to get to the
text of @glyph_item.  The @start_index and @end_index values can directly
index into @text.  The @start_glyph, @end_glyph, @start_char, and @end_char
values however are zero-based for the @glyph_item.  For each cluster, the
item pointed at by the start variables is included in the cluster while
the one pointed at by end variables is not.

None of the members of a #PangoGlyphItemIter should be modified manually.

</para>

@Since: 1.22

<!-- ##### MACRO PANGO_TYPE_GLYPH_STRING ##### -->
<para>
The #GObject type for #PangoGlyphString.
</para>



<!-- ##### FUNCTION pango_glyph_string_new ##### -->
<para>

</para>

@void: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_string_copy ##### -->
<para>

</para>

@string: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_string_set_size ##### -->
<para>

</para>

@string: 
@new_len: 


<!-- ##### FUNCTION pango_glyph_string_free ##### -->
<para>

</para>

@string: 


<!-- ##### FUNCTION pango_glyph_string_extents ##### -->
<para>

</para>

@glyphs: 
@font: 
@ink_rect: 
@logical_rect: 


<!-- ##### FUNCTION pango_glyph_string_extents_range ##### -->
<para>

</para>

@glyphs: 
@start: 
@end: 
@font: 
@ink_rect: 
@logical_rect: 


<!-- ##### FUNCTION pango_glyph_string_get_width ##### -->
<para>

</para>

@glyphs: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_string_index_to_x ##### -->
<para>

</para>

@glyphs: 
@text: 
@length: 
@analysis: 
@index_: 
@trailing: 
@x_pos: 


<!-- ##### FUNCTION pango_glyph_string_x_to_index ##### -->
<para>

</para>

@glyphs: 
@text: 
@length: 
@analysis: 
@x_pos: 
@index_: 
@trailing: 


<!-- ##### FUNCTION pango_glyph_string_get_logical_widths ##### -->
<para>

</para>

@glyphs: 
@text: 
@length: 
@embedding_level: 
@logical_widths: 


<!-- ##### MACRO PANGO_TYPE_GLYPH_ITEM ##### -->
<para>
The #GObject type for #PangoGlyphItem.
</para>

@Since: 1.20


<!-- ##### FUNCTION pango_glyph_item_copy ##### -->
<para>

</para>

@orig: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_item_free ##### -->
<para>

</para>

@glyph_item: 


<!-- ##### FUNCTION pango_glyph_item_split ##### -->
<para>

</para>

@orig: 
@text: 
@split_index: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_item_apply_attrs ##### -->
<para>

</para>

@glyph_item: 
@text: 
@list: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_item_letter_space ##### -->
<para>

</para>

@glyph_item: 
@text: 
@log_attrs: 
@letter_spacing: 


<!-- ##### FUNCTION pango_glyph_item_get_logical_widths ##### -->
<para>

</para>

@glyph_item: 
@text: 
@logical_widths: 


<!-- ##### MACRO PANGO_TYPE_GLYPH_ITEM_ITER ##### -->
<para>
The #GObject type for #PangoGlyphItemIter.
</para>

@Since: 1.22


<!-- ##### FUNCTION pango_glyph_item_iter_copy ##### -->
<para>

</para>

@orig: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_item_iter_free ##### -->
<para>

</para>

@iter: 


<!-- ##### FUNCTION pango_glyph_item_iter_init_start ##### -->
<para>

</para>

@iter: 
@glyph_item: 
@text: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_item_iter_init_end ##### -->
<para>

</para>

@iter: 
@glyph_item: 
@text: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_item_iter_next_cluster ##### -->
<para>

</para>

@iter: 
@Returns: 


<!-- ##### FUNCTION pango_glyph_item_iter_prev_cluster ##### -->
<para>

</para>

@iter: 
@Returns: