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