Git init
[external/pango1.0.git] / docs / tmpl / text-attributes.sgml
1 <!-- ##### SECTION Title ##### -->
2 Text Attributes
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Font and other attributes for annotating text
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 Attributed text is used in a number of places in Pango. It
10 is used as the input to the itemization process and also when
11 creating a #PangoLayout. The data types and functions in
12 this section are used to represent and manipulate sets
13 of attributes applied to a portion of text.
14 </para>
15
16 <!-- ##### SECTION See_Also ##### -->
17 <para>
18
19 </para>
20
21 <!-- ##### SECTION Stability_Level ##### -->
22
23
24 <!-- ##### ENUM PangoAttrType ##### -->
25 <para>
26 The #PangoAttrType
27 distinguishes between different types of attributes. Along with the
28 predefined values, it is possible to allocate additional values
29 for custom attributes using pango_attr_type_register(). The predefined
30 values are given below. The type of structure used to store the
31 attribute is listed in parentheses after the description.
32 </para>
33
34 @PANGO_ATTR_INVALID: does not happen
35 @PANGO_ATTR_LANGUAGE: language (#PangoAttrLanguage)
36 @PANGO_ATTR_FAMILY: font family name list (#PangoAttrString)
37 @PANGO_ATTR_STYLE: font slant style (#PangoAttrInt)
38 @PANGO_ATTR_WEIGHT: font weight (#PangoAttrInt)
39 @PANGO_ATTR_VARIANT: font variant (normal or small caps) (#PangoAttrInt)
40 @PANGO_ATTR_STRETCH: font stretch (#PangoAttrInt)
41 @PANGO_ATTR_SIZE: font size in points scaled by %PANGO_SCALE (#PangoAttrInt)
42 @PANGO_ATTR_FONT_DESC: font description (#PangoAttrFontDesc)
43 @PANGO_ATTR_FOREGROUND: foreground color (#PangoAttrColor)
44 @PANGO_ATTR_BACKGROUND: background color (#PangoAttrColor)
45 @PANGO_ATTR_UNDERLINE: whether the text has an underline (#PangoAttrInt)
46 @PANGO_ATTR_STRIKETHROUGH: whether the text is struck-through (#PangoAttrInt)
47 @PANGO_ATTR_RISE: baseline displacement (#PangoAttrInt)
48 @PANGO_ATTR_SHAPE: shape (#PangoAttrShape)
49 @PANGO_ATTR_SCALE: font size scale factor (#PangoAttrFloat)
50 @PANGO_ATTR_FALLBACK: whether fallback is enabled (#PangoAttrInt)
51 @PANGO_ATTR_LETTER_SPACING: letter spacing (#PangoAttrInt)
52 @PANGO_ATTR_UNDERLINE_COLOR: underline color (#PangoAttrColor)
53 @PANGO_ATTR_STRIKETHROUGH_COLOR: strikethrough color (#PangoAttrColor)
54 @PANGO_ATTR_ABSOLUTE_SIZE: font size in pixels scaled by %PANGO_SCALE (#PangoAttrInt)
55 @PANGO_ATTR_GRAVITY: base text gravity (#PangoAttrInt)
56 @PANGO_ATTR_GRAVITY_HINT: gravity hint (#PangoAttrInt)
57
58 <!-- ##### MACRO PANGO_TYPE_ATTR_TYPE ##### -->
59 <para>
60 The #GObject type for #PangoAttrType.
61 </para>
62
63
64
65 <!-- ##### STRUCT PangoAttrClass ##### -->
66 <para>
67 The #PangoAttrClass structure stores the type and operations for
68 a particular type of attribute. The functions in this structure should
69 not be called directly. Instead, one should use the wrapper functions
70 provided for #PangoAttribute.
71 </para>
72
73 @type: the type ID for this attribute
74 @copy: function to duplicate an attribute of this type (see pango_attribute_copy())
75 @destroy: function to free an attribute of this type (see pango_attribute_destroy())
76 @equal: function to check two attributes of this type for equality (see pango_attribute_equal())
77
78 <!-- ##### STRUCT PangoAttribute ##### -->
79 <para>
80 The #PangoAttribute structure represents the common portions of all
81 attributes. Particular types of attributes include this structure
82 as their initial portion. The common portion of the attribute holds
83 the range to which the value in the type-specific part of the attribute
84 applies and should be initialized using pango_attribute_init().
85 By default an attribute will have an all-inclusive range of [0,%G_MAXUINT].
86 </para>
87
88 @klass: the class structure holding information about the type of the attribute
89 @start_index: the start index of the range (in bytes).
90 @end_index: end index of the range (in bytes). The character at this index
91         is not included in the range.
92
93 <!-- ##### MACRO PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING ##### -->
94 <para>
95 This value can be used to set the start_index member of a #PangoAttribute
96 such that the attribute covers from the beginning of the text.
97 </para>
98
99 Since: 1.24
100
101
102
103 <!-- ##### MACRO PANGO_ATTR_INDEX_TO_TEXT_END ##### -->
104 <para>
105 This value can be used to set the end_index member of a #PangoAttribute
106 such that the attribute covers to the end of the text.
107 </para>
108
109 Since: 1.24
110
111
112
113 <!-- ##### STRUCT PangoAttrString ##### -->
114 <para>
115 The #PangoAttrString structure is used to represent attributes with
116 a string value.
117 </para>
118
119 @attr: the common portion of the attribute
120 @value: the string which is the value of the attribute
121
122 <!-- ##### STRUCT PangoAttrLanguage ##### -->
123 <para>
124 The #PangoAttrLanguage structure is used to represent attributes that
125 are languages.
126 </para>
127
128 @attr: the common portion of the attribute
129 @value: the #PangoLanguage which is the value of the attribute
130
131 <!-- ##### STRUCT PangoAttrColor ##### -->
132 <para>
133 The #PangoAttrColor structure is used to represent attributes that
134 are colors.
135 </para>
136
137 @attr: the common portion of the attribute
138 @color: the #PangoColor which is the value of the attribute
139
140 <!-- ##### STRUCT PangoAttrInt ##### -->
141 <para>
142 The #PangoAttrInt structure is used to represent attributes with
143 an integer or enumeration value.
144 </para>
145
146 @attr: the common portion of the attribute
147 @value: the value of the attribute
148
149 <!-- ##### STRUCT PangoAttrFloat ##### -->
150 <para>
151 The #PangoAttrFloat structure is used to represent attributes with
152 a float or double value.
153 </para>
154
155 @attr: the common portion of the attribute
156 @value: the value of the attribute
157
158 <!-- ##### STRUCT PangoAttrFontDesc ##### -->
159 <para>
160 The #PangoAttrFontDesc structure is used to store an attribute that
161 sets all aspects of the font description at once.
162 </para>
163
164 @attr: the common portion of the attribute
165 @desc: the font description which is the value of this attribute
166
167 <!-- ##### STRUCT PangoAttrShape ##### -->
168 <para>
169 The #PangoAttrShape structure is used to represent attributes which 
170 impose shape restrictions.
171 </para>
172
173 @attr: the common portion of the attribute
174 @ink_rect: the ink rectangle to restrict to
175 @logical_rect: the logical rectangle to restrict to
176 @data: user data set (see pango_attr_shape_new_with_data())
177 @copy_func: copy function for the user data
178 @destroy_func: destroy function for the user data
179
180 <!-- ##### STRUCT PangoAttrSize ##### -->
181 <para>
182 The #PangoAttrShape structure is used to represent attributes which
183 set font size.
184 </para>
185
186 @attr: the common portion of the attribute
187 @size: size of font, in units of 1/%PANGO_SCALE of a point (for
188   %PANGO_ATTR_SIZE) or of a device uni (for %PANGO_ATTR_ABSOLUTE_SIZE)
189 @absolute: whether the font size is in device units or points.
190    This field is only present for compatibility with Pango-1.8.0
191    (%PANGO_ATTR_ABSOLUTE_SIZE was added in 1.8.1); and always will
192    be %FALSE for %PANGO_ATTR_SIZE and %TRUE for %PANGO_ATTR_ABSOLUTE_SIZE.
193
194 <!-- ##### FUNCTION pango_parse_markup ##### -->
195 <para>
196
197 </para>
198
199 @markup_text: 
200 @length: 
201 @accel_marker: 
202 @attr_list: 
203 @text: 
204 @accel_char: 
205 @error: 
206 @Returns: 
207
208
209 <!-- ##### FUNCTION pango_attr_type_register ##### -->
210 <para>
211
212 </para>
213
214 @name: 
215 @Returns: 
216
217
218 <!-- ##### FUNCTION pango_attr_type_get_name ##### -->
219 <para>
220
221 </para>
222
223 @type: 
224 @Returns: 
225
226
227 <!-- ##### FUNCTION pango_attribute_init ##### -->
228 <para>
229
230 </para>
231
232 @attr: 
233 @klass: 
234
235
236 <!-- ##### FUNCTION pango_attribute_copy ##### -->
237 <para>
238
239 </para>
240
241 @attr: 
242 @Returns: 
243
244
245 <!-- ##### FUNCTION pango_attribute_equal ##### -->
246 <para>
247
248 </para>
249
250 @attr1: 
251 @attr2: 
252 @Returns: 
253
254
255 <!-- ##### FUNCTION pango_attribute_destroy ##### -->
256 <para>
257
258 </para>
259
260 @attr: 
261
262
263 <!-- ##### FUNCTION pango_attr_language_new ##### -->
264 <para>
265
266 </para>
267
268 @language: 
269 @Returns: 
270
271
272 <!-- ##### FUNCTION pango_attr_family_new ##### -->
273 <para>
274
275 </para>
276
277 @family: 
278 @Returns: 
279
280
281 <!-- ##### FUNCTION pango_attr_style_new ##### -->
282 <para>
283
284 </para>
285
286 @style: 
287 @Returns: 
288
289
290 <!-- ##### FUNCTION pango_attr_variant_new ##### -->
291 <para>
292
293 </para>
294
295 @variant: 
296 @Returns: 
297
298
299 <!-- ##### FUNCTION pango_attr_stretch_new ##### -->
300 <para>
301
302 </para>
303
304 @stretch: 
305 @Returns: 
306
307
308 <!-- ##### FUNCTION pango_attr_weight_new ##### -->
309 <para>
310
311 </para>
312
313 @weight: 
314 @Returns: 
315
316
317 <!-- ##### FUNCTION pango_attr_size_new ##### -->
318 <para>
319
320 </para>
321
322 @size: 
323 @Returns: 
324
325
326 <!-- ##### FUNCTION pango_attr_size_new_absolute ##### -->
327 <para>
328
329 </para>
330
331 @size: 
332 @Returns: 
333
334
335 <!-- ##### FUNCTION pango_attr_font_desc_new ##### -->
336 <para>
337
338 </para>
339
340 @desc: 
341 @Returns: 
342
343
344 <!-- ##### FUNCTION pango_attr_foreground_new ##### -->
345 <para>
346
347 </para>
348
349 @red: 
350 @green: 
351 @blue: 
352 @Returns: 
353
354
355 <!-- ##### FUNCTION pango_attr_background_new ##### -->
356 <para>
357
358 </para>
359
360 @red: 
361 @green: 
362 @blue: 
363 @Returns: 
364
365
366 <!-- ##### FUNCTION pango_attr_strikethrough_new ##### -->
367 <para>
368
369 </para>
370
371 @strikethrough: 
372 @Returns: 
373
374
375 <!-- ##### FUNCTION pango_attr_strikethrough_color_new ##### -->
376 <para>
377
378 </para>
379
380 @red: 
381 @green: 
382 @blue: 
383 @Returns: 
384
385
386 <!-- ##### FUNCTION pango_attr_underline_new ##### -->
387 <para>
388
389 </para>
390
391 @underline: 
392 @Returns: 
393
394
395 <!-- ##### FUNCTION pango_attr_underline_color_new ##### -->
396 <para>
397
398 </para>
399
400 @red: 
401 @green: 
402 @blue: 
403 @Returns: 
404
405
406 <!-- ##### ENUM PangoUnderline ##### -->
407 <para>
408 the #PangoUnderline enumeration is used to specify
409 whether text should be underlined, and if so, the type
410 of underlining.
411 </para>
412
413 @PANGO_UNDERLINE_NONE: no underline should be drawn
414 @PANGO_UNDERLINE_SINGLE: a single underline should be drawn
415 @PANGO_UNDERLINE_DOUBLE: a double underline should be drawn
416 @PANGO_UNDERLINE_LOW: a single underline should be drawn at a position
417                       beneath the ink extents of the text being
418                       underlined. This should be used only for underlining
419                       single characters, such as for keyboard
420                       accelerators. %PANGO_UNDERLINE_SINGLE should
421                       be used for extended portions of text.
422 @PANGO_UNDERLINE_ERROR: a wavy underline should be drawn below.
423                       This underline is typically used to indicate
424                       an error such as a possilble mispelling; in some
425                       cases a contrasting color may automatically
426                       be used. This type of underlining is available
427                       since Pango 1.4.
428
429 <!-- ##### MACRO PANGO_TYPE_UNDERLINE ##### -->
430 <para>
431 The #GObject type for #PangoUnderline.
432 </para>
433
434
435
436 <!-- ##### FUNCTION pango_attr_shape_new ##### -->
437 <para>
438
439 </para>
440
441 @ink_rect: 
442 @logical_rect: 
443 @Returns: 
444
445
446 <!-- ##### FUNCTION pango_attr_shape_new_with_data ##### -->
447 <para>
448
449 </para>
450
451 @ink_rect: 
452 @logical_rect: 
453 @data: 
454 @copy_func: 
455 @destroy_func: 
456 @Returns: 
457
458
459 <!-- ##### USER_FUNCTION PangoAttrDataCopyFunc ##### -->
460 <para>
461 A copy function passed to attribute new functions that take
462 user data.
463 </para>
464
465 @data: the user data
466 @Returns: a new copy of @data.
467
468
469 <!-- ##### FUNCTION pango_attr_scale_new ##### -->
470 <para>
471
472 </para>
473
474 @scale_factor: 
475 @Returns: 
476
477
478 <!-- ##### MACRO PANGO_SCALE_XX_SMALL ##### -->
479 <para>
480 The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
481 </para>
482
483
484
485 <!-- ##### MACRO PANGO_SCALE_X_SMALL ##### -->
486 <para>
487 The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
488 </para>
489
490
491
492 <!-- ##### MACRO PANGO_SCALE_SMALL ##### -->
493 <para>
494 The scale factor for one shrinking step (1 / 1.2).
495 </para>
496
497
498
499 <!-- ##### MACRO PANGO_SCALE_MEDIUM ##### -->
500 <para>
501 The scale factor for normal size (1.0).
502 </para>
503
504
505
506 <!-- ##### MACRO PANGO_SCALE_LARGE ##### -->
507 <para>
508 The scale factor for one magnification step (1.2).
509 </para>
510
511
512
513 <!-- ##### MACRO PANGO_SCALE_X_LARGE ##### -->
514 <para>
515 The scale factor for two magnification steps (1.2 * 1.2).
516 </para>
517
518
519
520 <!-- ##### MACRO PANGO_SCALE_XX_LARGE ##### -->
521 <para>
522 The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
523 </para>
524
525
526
527 <!-- ##### FUNCTION pango_attr_rise_new ##### -->
528 <para>
529
530 </para>
531
532 @rise: 
533 @Returns: 
534
535
536 <!-- ##### FUNCTION pango_attr_letter_spacing_new ##### -->
537 <para>
538
539 </para>
540
541 @letter_spacing: 
542 @Returns: 
543
544
545 <!-- ##### FUNCTION pango_attr_fallback_new ##### -->
546 <para>
547
548 </para>
549
550 @enable_fallback: 
551 @Returns: 
552
553
554 <!-- ##### FUNCTION pango_attr_gravity_new ##### -->
555 <para>
556
557 </para>
558
559 @gravity: 
560 @Returns: 
561
562
563 <!-- ##### FUNCTION pango_attr_gravity_hint_new ##### -->
564 <para>
565
566 </para>
567
568 @hint: 
569 @Returns: 
570
571
572 <!-- ##### STRUCT PangoColor ##### -->
573 <para>
574 The #PangoColor structure is used to
575 represent a color in an uncalibrated RGB color-space.
576 </para>
577
578 @red: The red component of the color. This is a value between 0 and 65535, 
579       with 65535 indicating full intensity.
580 @green: The green component of the color. This is a value between 0 and 65535, 
581       with 65535 indicating full intensity.
582 @blue: The blue component of the color. This is a value between 0 and 65535, 
583       with 65535 indicating full intensity.
584
585 <!-- ##### MACRO PANGO_TYPE_COLOR ##### -->
586 <para>
587 The #GObject type for #PangoColor.
588 </para>
589
590
591
592 <!-- ##### FUNCTION pango_color_parse ##### -->
593 <para>
594
595 </para>
596
597 @color: 
598 @spec: 
599 @Returns: 
600
601
602 <!-- ##### FUNCTION pango_color_copy ##### -->
603 <para>
604
605 </para>
606
607 @src: 
608 @Returns: 
609
610
611 <!-- ##### FUNCTION pango_color_free ##### -->
612 <para>
613
614 </para>
615
616 @color: 
617
618
619 <!-- ##### FUNCTION pango_color_to_string ##### -->
620 <para>
621
622 </para>
623
624 @color: 
625 @Returns: 
626
627
628 <!-- ##### STRUCT PangoAttrList ##### -->
629 <para>
630 The #PangoAttrList structure represents a list of attributes
631 that apply to a section of text. The attributes are, in general,
632 allowed to overlap in an arbitrary fashion, however, if the
633 attributes are manipulated only through pango_attr_list_change(),
634 the overlap between properties will meet stricter criteria.
635 </para>
636 <para>
637 Since the #PangoAttrList structure is stored as a linear list,
638 it is not suitable for storing attributes for large amounts
639 of text. In general, you should not use a single #PangoAttrList
640 for more than one paragraph of text.
641 </para>
642
643
644 <!-- ##### MACRO PANGO_TYPE_ATTR_LIST ##### -->
645 <para>
646 The #GObject type for #PangoAttrList.
647 </para>
648
649
650
651 <!-- ##### FUNCTION pango_attr_list_new ##### -->
652 <para>
653
654 </para>
655
656 @Returns: 
657
658
659 <!-- ##### FUNCTION pango_attr_list_ref ##### -->
660 <para>
661
662 </para>
663
664 @list: 
665 @Returns: 
666
667
668 <!-- ##### FUNCTION pango_attr_list_unref ##### -->
669 <para>
670
671 </para>
672
673 @list: 
674
675
676 <!-- ##### FUNCTION pango_attr_list_copy ##### -->
677 <para>
678
679 </para>
680
681 @list: 
682 @Returns: 
683
684
685 <!-- ##### FUNCTION pango_attr_list_insert ##### -->
686 <para>
687
688 </para>
689
690 @list: 
691 @attr: 
692
693
694 <!-- ##### FUNCTION pango_attr_list_insert_before ##### -->
695 <para>
696
697 </para>
698
699 @list: 
700 @attr: 
701
702
703 <!-- ##### FUNCTION pango_attr_list_change ##### -->
704 <para>
705
706 </para>
707
708 @list: 
709 @attr: 
710
711
712 <!-- ##### FUNCTION pango_attr_list_splice ##### -->
713 <para>
714
715 </para>
716
717 @list: 
718 @other: 
719 @pos: 
720 @len: 
721
722
723 <!-- ##### FUNCTION pango_attr_list_filter ##### -->
724 <para>
725
726 </para>
727
728 @list: 
729 @func: 
730 @data: 
731 @Returns: 
732
733
734 <!-- ##### USER_FUNCTION PangoAttrFilterFunc ##### -->
735 <para>
736 A predicate function used by pango_attr_list_filter()
737 to filter out a subset of attributes for a list.
738 </para>
739
740 @attribute: a #PangoAttribute
741 @data: callback data passed to pango_attr_list_filter()
742 @Returns: %TRUE if the attribute should be filtered out
743
744
745 <!-- ##### FUNCTION pango_attr_list_get_iterator ##### -->
746 <para>
747
748 </para>
749
750 @list: 
751 @Returns: 
752
753
754 <!-- ##### STRUCT PangoAttrIterator ##### -->
755 <para>
756 The #PangoAttrIterator structure is used to represent an
757 iterator through a #PangoAttrList. A new iterator is created
758 with pango_attr_list_get_iterator(). Once the iterator
759 is created, it can be advanced through the style changes
760 in the text using pango_attr_iterator_next(). At each
761 style change, the range of the current style segment and the
762 attributes currently in effect can be queried.
763 </para>
764
765
766 <!-- ##### FUNCTION pango_attr_iterator_copy ##### -->
767 <para>
768
769 </para>
770
771 @iterator: 
772 @Returns: 
773
774
775 <!-- ##### FUNCTION pango_attr_iterator_next ##### -->
776 <para>
777
778 </para>
779
780 @iterator: 
781 @Returns: 
782
783
784 <!-- ##### FUNCTION pango_attr_iterator_range ##### -->
785 <para>
786
787 </para>
788
789 @iterator: 
790 @start: 
791 @end: 
792
793
794 <!-- ##### FUNCTION pango_attr_iterator_get ##### -->
795 <para>
796
797 </para>
798
799 @iterator: 
800 @type: 
801 @Returns: 
802
803
804 <!-- ##### FUNCTION pango_attr_iterator_get_font ##### -->
805 <para>
806
807 </para>
808
809 @iterator: 
810 @desc: 
811 @language: 
812 @extra_attrs: 
813
814
815 <!-- ##### FUNCTION pango_attr_iterator_get_attrs ##### -->
816 <para>
817
818 </para>
819
820 @iterator: 
821 @Returns: 
822
823
824 <!-- ##### FUNCTION pango_attr_iterator_destroy ##### -->
825 <para>
826
827 </para>
828
829 @iterator: 
830
831