Details
enum PangoAttrType
typedef enum
{
PANGO_ATTR_INVALID, /* 0 is an invalid attribute type */
PANGO_ATTR_LANGUAGE, /* PangoAttrLanguage */
PANGO_ATTR_FAMILY, /* PangoAttrString */
PANGO_ATTR_STYLE, /* PangoAttrInt */
PANGO_ATTR_WEIGHT, /* PangoAttrInt */
PANGO_ATTR_VARIANT, /* PangoAttrInt */
PANGO_ATTR_STRETCH, /* PangoAttrInt */
PANGO_ATTR_SIZE, /* PangoAttrSize */
PANGO_ATTR_FONT_DESC, /* PangoAttrFontDesc */
PANGO_ATTR_FOREGROUND, /* PangoAttrColor */
PANGO_ATTR_BACKGROUND, /* PangoAttrColor */
PANGO_ATTR_UNDERLINE, /* PangoAttrInt */
PANGO_ATTR_STRIKETHROUGH, /* PangoAttrInt */
PANGO_ATTR_RISE, /* PangoAttrInt */
PANGO_ATTR_SHAPE, /* PangoAttrShape */
PANGO_ATTR_SCALE /* PangoAttrFloat */
} 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_register_type(). The predefined
values are given below. The type of structure used to store the
attribute is listed in parentheses after the description.
PANGO_TYPE_ATTR_TYPE
#define PANGO_TYPE_ATTR_TYPE (pango_attr_type_get_type()) |
struct PangoAttrClass
struct PangoAttrClass
{
PangoAttrType type;
PangoAttribute * (*copy) (const PangoAttribute *attr);
void (*destroy) (PangoAttribute *attr);
gboolean (*equal) (const PangoAttribute *attr1, const PangoAttribute *attr2);
}; |
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.
struct PangoAttribute
struct PangoAttribute
{
const PangoAttrClass *klass;
guint start_index;
guint end_index;
}; |
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.
struct PangoAttrString
struct PangoAttrString
{
PangoAttribute attr;
char *value;
}; |
The PangoAttrString structure is used to represent attributes with
a string value.
struct PangoAttrColor
struct PangoAttrColor
{
PangoAttribute attr;
PangoColor color;
}; |
The PangoAttrColor structure is used to represent attributes that
are colors.
struct PangoAttrInt
struct PangoAttrInt
{
PangoAttribute attr;
int value;
}; |
The PangoAttrInt structure is used to represent attributes with
a integer or enumeration value.
struct PangoAttrFloat
struct PangoAttrFloat
{
PangoAttribute attr;
double value;
}; |
struct PangoAttrFontDesc
struct PangoAttrFontDesc
{
PangoAttribute attr;
PangoFontDescription desc;
}; |
The PangoAttrFontDesc structure is used to store an attribute that
sets all aspects of the font description at once.
struct PangoAttrShape
struct PangoAttrShape
{
PangoAttribute attr;
PangoRectangle ink_rect;
PangoRectangle logical_rect;
}; |
pango_parse_markup ()
Parses marked-up text (see
<link linkend="PangoMarkupFormat">markup format</link>) to create
a plaintext string and an attribute list.
If accel_marker is nonzero, the given character will mark the
character following it as an accelerator. For example, the accel
marker might be an ampersand or underscore. All characters marked
as an accelerator will receive a PANGO_UNDERLINE_LOW attribute,
and the first character so marked will be returned in accel_char.
Two accel_marker characters following each other produce a single
literal accel_marker character.
pango_attr_type_register ()
Allocate a new attribute type ID.
pango_attribute_copy ()
Make a copy of an attribute.
pango_attribute_equal ()
Compare two attributes for equality. This compares only the
actual value of the two attributes and not the ranges that the
attributes apply to.
pango_attribute_destroy ()
Destroy a PangoAttribute and free all associated memory.
pango_attr_family_new ()
Create a new font family attribute.
pango_attr_style_new ()
Create a new font slant style attribute.
pango_attr_variant_new ()
Create a new font variant attribute (normal or small caps)
pango_attr_stretch_new ()
Create a new font stretch attribute
pango_attr_weight_new ()
Create a new font weight attribute.
pango_attr_size_new ()
Create a new font-size attribute.
pango_attr_font_desc_new ()
Create a new font description attribute. (This attribute
allows setting family, style, weight, variant, stretch,
and size simultaneously.)
pango_attr_foreground_new ()
Create a new foreground color attribute.
pango_attr_background_new ()
Create a new background color attribute.
pango_attr_strikethrough_new ()
Create a new font strike-through attribute.
pango_attr_underline_new ()
Create a new underline-style object.
enum PangoUnderline
typedef enum {
PANGO_UNDERLINE_NONE,
PANGO_UNDERLINE_SINGLE,
PANGO_UNDERLINE_DOUBLE,
PANGO_UNDERLINE_LOW
} PangoUnderline; |
the PangoUnderline enumeration is used to specify
whether text should be underlined, and if so, the type
of underlining.
PANGO_TYPE_UNDERLINE
#define PANGO_TYPE_UNDERLINE (pango_underline_get_type()) |
pango_attr_shape_new ()
Create a new shape attribute. A shape is used to impose a
particular ink and logical rect on the result of shaping a
particular glyph. This might be used, for instance, for
embedding a picture or a widget inside a PangoLayout.
pango_attr_scale_new ()
Create a new font size scale attribute. The base font for the
affected text will have its size multiplied by scale_factor.
PANGO_SCALE_XX_SMALL
#define PANGO_SCALE_XX_SMALL ((double)0.5787037037037) |
PANGO_SCALE_X_SMALL
#define PANGO_SCALE_X_SMALL ((double)0.6444444444444) |
PANGO_SCALE_SMALL
#define PANGO_SCALE_SMALL ((double)0.8333333333333) |
PANGO_SCALE_MEDIUM
#define PANGO_SCALE_MEDIUM ((double)1.0) |
PANGO_SCALE_LARGE
#define PANGO_SCALE_LARGE ((double)1.2) |
PANGO_SCALE_X_LARGE
#define PANGO_SCALE_X_LARGE ((double)1.4399999999999) |
PANGO_SCALE_XX_LARGE
#define PANGO_SCALE_XX_LARGE ((double)1.728) |
pango_attr_rise_new ()
Create a new baseline displacement attribute.
struct PangoColor
struct PangoColor
{
guint16 red;
guint16 green;
guint16 blue;
}; |
PANGO_TYPE_COLOR
#define PANGO_TYPE_COLOR pango_color_get_type () |
pango_color_copy ()
Creates a copy of src, which should be freed with
pango_color_free(). Primarily used by language bindings,
not that useful otherwise (since colors can just be copied
by assignment in C).
struct PangoAttrList
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.
PANGO_TYPE_ATTR_LIST
#define PANGO_TYPE_ATTR_LIST pango_attr_list_get_type () |
pango_attr_list_new ()
Create a new empty attribute list with a reference count of 1.
pango_attr_list_ref ()
Increase the reference count of the given attribute list by one.
pango_attr_list_unref ()
Decrease the reference count of the given attribute list by one.
If the result is zero, free the attribute list and the attributes
it contains.
pango_attr_list_copy ()
Copy list and return an identical, new list.
pango_attr_list_insert ()
Insert the given attribute into the PangoAttrList. It will
be inserted after all other attributes with a matching
start_index.
pango_attr_list_insert_before ()
Insert the given attribute into the PangoAttrList. It will
be inserted before all other attributes with a matching
start_index.
pango_attr_list_change ()
Insert the given attribute into the PangoAttrList. It will
replace any attributes of the same type on that segment
and be merged with any adjoining attributes that are identical.
This function is slower than pango_attr_list_insert() for
creating a attribute list in order (potentially much slower
for large lists). However, pango_attr_list_insert() is not
suitable for continually changing a set of attributes
since it never removes or combines existing attributes.
pango_attr_list_splice ()
This function splices attribute list other into list.
This operation is equivalent to stretching every attribute
applies at position pos in list by an amount len,
and then calling pango_attr_list_change() with a copy
of each attributes in other in sequence (offset in position by pos).
This operation proves useful for, for instance, inserting
a preedit string in the middle of an edit buffer.
pango_attr_list_get_iterator ()
Create a iterator initialized to the beginning of the list.
struct PangoAttrIterator
struct PangoAttrIterator; |
The PangoAttrIterator structure is used to represent an
iterator through a PangoList. 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.
pango_attr_iterator_next ()
Advance the iterator until the next change of style.
pango_attr_iterator_range ()
Get the range of the current segment.
pango_attr_iterator_get ()
Find the current attribute of a particular type at the iterator
location. When multiple attributes of the same type overlap,
the attribute whose range starts closest to the current location
is used.
pango_attr_iterator_get_font ()
Get the font and other attributes at the current iterator position.
pango_attr_iterator_destroy ()
Destroy a PangoAttrIterator and free all associated memory.