Text Attributes
Font and other attributes for annotating text
Attributed text is used in a number of places in Pango. It
is used as the input to the itemization process and also when
creating a #PangoLayout. The data types and functions in
this section are used to represent and manipulate sets
of attributes applied to a portion of text.
The #PangoAttrType
distinguishes between different types of attributes. Along with the
predefined values, it is possible to allocate additional values
for custom attributes using pango_attr_type_register(). The predefined
values are given below. The type of structure used to store the
attribute is listed in parentheses after the description.
@PANGO_ATTR_INVALID:
@PANGO_ATTR_LANGUAGE: language (#PangoAttrLanguage)
@PANGO_ATTR_FAMILY: font family name list (#PangoAttrString)
@PANGO_ATTR_STYLE: font slant style (#PangoAttrInt)
@PANGO_ATTR_WEIGHT: font weight (#PangoAttrInt)
@PANGO_ATTR_VARIANT: font variant (normal or small caps) (#PangoAttrInt)
@PANGO_ATTR_STRETCH: font stretch (#PangoAttrInt)
@PANGO_ATTR_SIZE: font size in points divided by %PANGO_SCALE (#PangoAttrInt)
@PANGO_ATTR_FONT_DESC: font description (#PangoAttrFontDesc)
@PANGO_ATTR_FOREGROUND: foreground color (#PangoAttrColor)
@PANGO_ATTR_BACKGROUND: background color (#PangoAttrColor)
@PANGO_ATTR_UNDERLINE: whether the text has an underline (#PangoAttrInt)
@PANGO_ATTR_STRIKETHROUGH: whether the text is struck-through (#PangoAttrInt)
@PANGO_ATTR_RISE: baseline displacement (#PangoAttrInt)
@PANGO_ATTR_SHAPE: shape (#PangoAttrShape)
@PANGO_ATTR_SCALE: font size scale factor (#PangoAttrFloat)
@PANGO_ATTR_FALLBACK: whether fallback is enabled (#PangoAttrInt)
@PANGO_ATTR_LETTER_SPACING:
@PANGO_ATTR_UNDERLINE_COLOR:
@PANGO_ATTR_STRIKETHROUGH_COLOR:
@PANGO_ATTR_ABSOLUTE_SIZE:
The GObject type for #PangoAttrType.
The #PangoAttrClass structure stores the type and operations for
a particular type of attribute. The functions in this structure should
not be called directly. Instead, one should use the wrapper functions
provided for #PangoAttribute.
@type: the type ID for this attribute
@copy: function to duplicate an attribute of this type (see pango_attribute_copy())
@destroy: function to free an attribute of this type (see pango_attribute_destroy())
@equal:
The #PangoAttribute structure represents the common portions of all
attributes. Particular types of attributes include this structure
as their initial portion. The common portion of the attribute holds
the range to which the value in the type-specific part of the attribute
applies.
@klass: the class structure holding information about the type of the attribute
@start_index: the start index of the range (in bytes).
@end_index: end index of the range (in bytes). The character at this index
is not included in the range.
The #PangoAttrString structure is used to represent attributes with
a string value.
@attr: the common portion of the attribute
@value: the string which is the value of the attribute
The #PangoAttrLanguage structure is used to represent attributes that
are languages.
@attr: the common portion of the attribute
@value: the #PangoLanguage which is the value of the attribute
The #PangoAttrColor structure is used to represent attributes that
are colors.
@attr: the common portion of the attribute
@color: the #PangoColor which is the value of the attribute
The #PangoAttrInt structure is used to represent attributes with
an integer or enumeration value.
@attr: the common portion of the attribute
@value: the value of the attribute
The #PangoAttrFloat structure is used to represent attributes with
a float or double value.
@attr: the common portion of the attribute
@value: the value of the attribute
The #PangoAttrFontDesc structure is used to store an attribute that
sets all aspects of the font description at once.
@attr: the common portion of the attribute
@desc: the font description which is the value of this attribute
The #PangoAttrShape structure is used to represent attributes which
impose shape restrictions.
@attr: the common portion of the attribute
@ink_rect: the ink rectangle to restrict to
@logical_rect: the logical rectangle to restrict to
@data:
@copy_func:
@destroy_func:
The #PangoAttrShape structure is used to represent attributes which
set font size.
@attr: the common portion of the attribute
@size: size of font, in units of 1/%PANGO_SCALE of a point (for
%PANGO_ATTR_SIZE) or of a device uni (for %PANGO_ATTR_ABSOLUTE_SIZE)
@absolute: whether the font size is in device units or points.
This field is only present for compatibility with Pango-1.8.0
(%PANGO_ATTR_ABSOLUTE_SIZE was added in 1.8.1); and always will
be %FALSE for %PANGO_ATTR_SIZE and %TRUE for %PANGO_ATTR_ABSOLUTE_SIZE.
@markup_text:
@length:
@accel_marker:
@attr_list:
@text:
@accel_char:
@error:
@Returns:
@name:
@Returns:
@attr:
@Returns:
@attr1:
@attr2:
@Returns:
@attr:
@language:
@Returns:
@family:
@Returns:
@style:
@Returns:
@variant:
@Returns:
@stretch:
@Returns:
@weight:
@Returns:
@size:
@Returns:
@size:
@Returns:
@desc:
@Returns:
@red:
@green:
@blue:
@Returns:
@red:
@green:
@blue:
@Returns:
@strikethrough:
@Returns:
@red:
@green:
@blue:
@Returns:
@underline:
@Returns:
@red:
@green:
@blue:
@Returns:
the #PangoUnderline enumeration is used to specify
whether text should be underlined, and if so, the type
of underlining.
@PANGO_UNDERLINE_NONE: no underline should be drawn
@PANGO_UNDERLINE_SINGLE: a single underline should be drawn
@PANGO_UNDERLINE_DOUBLE: a double underline should be drawn
@PANGO_UNDERLINE_LOW: a single underline should be drawn at a position
beneath the ink extents of the text being
underlined. This should be used only for underlining
single characters, such as for keyboard
accelerators. %PANGO_UNDERLINE_SINGLE should
be used for extended portions of text.
@PANGO_UNDERLINE_ERROR: a wavy underline should be drawn below.
This underline is typically used to indicate
an error such as a possilble mispelling; in some
cases a contrasting color may automatically
be used. This type of underlining is available
since Pango 1.4.
The GObject type for #PangoUnderline.
@ink_rect:
@logical_rect:
@Returns:
@ink_rect:
@logical_rect:
@data:
@copy_func:
@destroy_func:
@Returns:
A copy function passed to attribute new functions that take
user data.
@data: the user data
@Returns: a new copy of @data.
@scale_factor:
@Returns:
@enable_fallback:
@Returns:
The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
The scale factor for one shrinking step (1 / 1.2).
The scale factor for normal size (1.0).
The scale factor for one magnification step (1.2).
The scale factor for two magnification steps (1.2 * 1.2).
The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
@rise:
@Returns:
@letter_spacing:
@Returns:
The #PangoColor structure is used to
represent a color in an uncalibrated RGB colorspace.
@red: The red component of the color. This is a value between 0 and 65535,
with 65535 indicating full intensity.
@green: The green component of the color. This is a value between 0 and 65535,
with 65535 indicating full intensity.
@blue: The blue component of the color. This is a value between 0 and 65535,
with 65535 indicating full intensity.
The GObject type for #PangoColor.
@color:
@color:
@spec:
@Returns:
@src:
@Returns:
The #PangoLanguage structure is used to
represent a language.
#PangoLanguage pointers can be efficiently
copied and compared with each other.
The GObject type for #PangoLanguage.
@language:
@Returns:
Returns a RFC-3066 format string representing the given language tag.
@language: a language tag.
@Returns: a string representing the language tag.
@language:
@range_list:
@Returns:
The #PangoAttrList structure represents a list of attributes
that apply to a section of text. The attributes are, in general,
allowed to overlap in an arbitrary fashion, however, if the
attributes are manipulated only through pango_attr_list_change(),
the overlap between properties will meet stricter criteria.
Since the #PangoAttrList structure is stored as a linear list,
it is not suitable for storing attributes for large amounts
of text. In general, you should not use a single #PangoAttrList
for more than one paragraph of text.
The GObject type for #PangoAttrList.
@Returns:
@list:
@Returns:
@list:
@list:
@Returns:
@list:
@attr:
@list:
@attr:
@list:
@attr:
@list:
@other:
@pos:
@len:
@list:
@func:
@data:
@Returns:
A predicate function used by pango_attr_list_filter()
to filter out a subset of attributes for a list.
@attribute: a #PangoAttribute
@data: callback data passed to pango_attr_list_filter()
@Returns: %TRUE if the attribute should be filtered out
@list:
@Returns:
The #PangoAttrIterator structure is used to represent an
iterator through a #PangoAttrList. A new iterator is created
with pango_attr_list_get_iterator(). Once the iterator
is created, it can be advanced through the style changes
in the text using pango_attr_iterator_next(). At each
style change, the range of the current style segment and the
attributes currently in effect can be queried.
@iterator:
@Returns:
@iterator:
@Returns:
@iterator:
@start:
@end:
@iterator:
@type:
@Returns:
@iterator:
@desc:
@language:
@extra_attrs:
@iterator:
@Returns:
@iterator: