Main Page Namespaces Book

# Pango::Attribute Class Reference

Inheritance diagram for Pango::Attribute:

[legend]

List of all members.

## Detailed Description

The Pango::Attribute structure represents the common portions of all attributes.

Particular types of attributes derive this class. It holds the range in which the value in the type-specific part of the attribute applies.

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 Pango::Layout.

## Public Member Functions

| Attribute (PangoAttribute* castitem, bool take_copy=true)
| Attribute (const Attribute& src)
| Attribute ()
| Constructs an invalid attribute.
bool | equal (const Attribute& attr2) const
| Compare two attributes for equality.
unsigned int | get_end_index () const
| Gets the end index of the range.
unsigned int | get_start_index () const
| Gets the start index of the range.
AttrType | get_type () const
| Gets the type ID for this attribute.
const PangoAttribute* | gobj () const
| Provides access to the underlying C GObject.
PangoAttribute* | gobj ()
| Provides access to the underlying C GObject.
Attribute& | operator= (const Attribute& src)
void | set_end_index (const unsigned int& value)
| Sets the end index of the range.
void | set_start_index (const unsigned int& value)
| Sets the start index of the range.
| ~Attribute ()

## Static Public Member Functions

static AttrColor | create_attr_background (guint16 red, guint16 green, guint16 blue)
| Create a new background color attribute.
static AttrString | create_attr_family (const Glib::ustring& family)
| Create a new font family attribute.
static AttrFontDesc | create_attr_font_desc (const FontDescription& desc)
| Create a new font description attribute.
static AttrColor | create_attr_foreground (guint16 red, guint16 green, guint16 blue)
| Create a new foreground color attribute.
static AttrLanguage | create_attr_language (const Language& language)
| Create a new language tag attribute.
static AttrInt | create_attr_rise (int rise)
| Create a new baseline displacement attribute.
static AttrFloat | create_attr_scale (double scale_factor)
| Create a new font size scale attribute.
static AttrShape | create_attr_shape (const Rectangle& ink_rect, const Rectangle& logical_rect)
| Create a new shape attribute.
static AttrInt | create_attr_size (int size)
| Create a new font-size attribute.
static AttrInt | create_attr_stretch (Stretch stretch)
| Create a new font stretch attribute.
static AttrInt | create_attr_strikethrough (bool strikethrough)
| Create a new font strike-through attribute.
static AttrInt | create_attr_style (Style style)
| Create a new font slant style attribute.
static AttrInt | create_attr_underline (Underline underline)
| Create a new underline-style object.
static AttrInt | create_attr_variant (Variant variant)
| Create a new font variant attribute (normal or small caps).
static AttrInt | create_attr_weight (Weight weight)
| Create a new font weight attribute.
static AttrType | register_type (const Glib::ustring& name)
| Allocate a new attribute type ID.

## Protected Attributes

PangoAttribute* | gobject_

## Related Functions

(Note that these are not member functions.)
bool | operator!= (const Attribute& lhs, const Attribute& rhs)
bool | operator== (const Attribute& lhs, const Attribute& rhs)
Pango::Attribute | wrap (PangoAttribute* object, bool take_copy=false)

## Constructor & Destructor Documentation

Pango::Attribute::Attribute | ( |  | ) |

Constructs an invalid attribute.

Pango::Attribute::Attribute | ( | const Attribute& | src | ) |

Pango::Attribute::Attribute | ( | PangoAttribute * | castitem,
|  | bool | take_copy = `true` |
| ) |  |  | `[explicit]`

Pango::Attribute::~Attribute | ( |  | ) |

## Member Function Documentation

static AttrColor Pango::Attribute::create_attr_background | ( | guint16 | red,
|  | guint16 | green,
|  | guint16 | blue |
| ) |  |  | `[static]`

Create a new background color attribute.

Parameters:

  | red | The red value (ranging from 0 to 65535).
  | green | The green value (ranging from 0 to 65535).
  | blue | The blue value (ranging from 0 to 65535).

Returns:
  An attribute of type AttrColor.

static AttrString Pango::Attribute::create_attr_family | ( | const Glib::ustring & | family | ) | `[static]`

Create a new font family attribute.

Parameters:

  | family | The family or comma separated list of families.

Returns:
  An attribute of type AttrString.

static AttrFontDesc Pango::Attribute::create_attr_font_desc | ( | const FontDescription& | desc | ) | `[static]`

Create a new font description attribute.

This attribute allows setting family, style, weight, variant, stretch, and size simultaneously.

Parameters:

  | desc | The font description.

Returns:
  An attribute of type AttrFontDesc.

static AttrColor Pango::Attribute::create_attr_foreground | ( | guint16 | red,
|  | guint16 | green,
|  | guint16 | blue |
| ) |  |  | `[static]`

Create a new foreground color attribute.

Parameters:

  | red | The red value (ranging from 0 to 65535).
  | green | The green value (ranging from 0 to 65535).
  | blue | The blue value (ranging from 0 to 65535).

Returns:
  An attribute of type AttrColor.

static AttrLanguage Pango::Attribute::create_attr_language | ( | const Language& | language | ) | `[static]`

Create a new language tag attribute.

Parameters:

  | language | The language tag.

Returns:
  An attribute of type AttrLanguage.

static AttrInt Pango::Attribute::create_attr_rise | ( | int | rise | ) | `[static]`

Create a new baseline displacement attribute.

Parameters:

  | rise | The amount that the text should be displaced vertically, in 10'000ths of an em. Positive values displace the text upwards.

Returns:
  An attribute of type AttrInt.

static AttrFloat Pango::Attribute::create_attr_scale | ( | double | scale_factor | ) | `[static]`

Create a new font size scale attribute.

The base font for the affected text will have its size multiplied by scale_factor.

Parameters:

  | scale_factor | Factor to scale the font.

Returns:
  An attribute of type AttrFloat.

static AttrShape Pango::Attribute::create_attr_shape | ( | const Rectangle& | ink_rect,
|  | const Rectangle& | logical_rect |
| ) |  |  | `[static]`

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.

Parameters:

  | ink_rect | Ink rectangle to assign to each character.
  | logical_rect | Logical rectangle assign to each character.

Returns:
  An attribute of type AttrShape.

static AttrInt Pango::Attribute::create_attr_size | ( | int | size | ) | `[static]`

Create a new font-size attribute.

Parameters:

  | size | The font size, in 1000ths of a point.

Returns:
  An attribute of type AttrInt.

static AttrInt Pango::Attribute::create_attr_stretch | ( | Stretch | stretch | ) | `[static]`

Create a new font stretch attribute.

Parameters:

  | stretch | The stretch.

Returns:
  An attribute of type AttrInt.

static AttrInt Pango::Attribute::create_attr_strikethrough | ( | bool | strikethrough | ) | `[static]`

Create a new font strike-through attribute.

Parameters:

  | strikethrough | True indicates the text should be struck-through.

Returns:
  An attribute of type AttrInt.

static AttrInt Pango::Attribute::create_attr_style | ( | Style | style | ) | `[static]`

Create a new font slant style attribute.

Parameters:

  | style | The slant style.

Returns:
  An attribute of type AttrInt.

static AttrInt Pango::Attribute::create_attr_underline | ( | Underline | underline | ) | `[static]`

Create a new underline-style object.

Parameters:

  | underline | The underline style.

Returns:
  An attribute of type AttrInt.

static AttrInt Pango::Attribute::create_attr_variant | ( | Variant | variant | ) | `[static]`

Create a new font variant attribute (normal or small caps).

Parameters:

  | variant | The variant.

Returns:
  An attribute of type AttrInt.

static AttrInt Pango::Attribute::create_attr_weight | ( | Weight | weight | ) | `[static]`

Create a new font weight attribute.

Parameters:

  | weight | The weight.

Returns:
  An attribute of type AttrInt.

bool Pango::Attribute::equal | ( | const Attribute& | attr2 | ) | const

Compare two attributes for equality.

This compares only the actual value of the two attributes and not the ranges that the attributes apply to.

Parameters:

  | attr2 | Another Pango::Attribute.

Returns:
  `true` if the two attributes have the same value.

Referenced by operator!=(), and operator==().

unsigned int Pango::Attribute::get_end_index | ( |  | ) | const

Gets the end index of the range.

The character at this index is not included in the range.

Returns:
  The end index of the range.

unsigned int Pango::Attribute::get_start_index | ( |  | ) | const

Gets the start index of the range.

Returns:
  The start index of the range.

AttrType Pango::Attribute::get_type | ( |  | ) | const

Gets the type ID for this attribute.

Returns:
  The type ID for this attribute or ATTR_INVALID if the attribute is invalid.

const PangoAttribute* Pango::Attribute::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented in Pango::AttrString, Pango::AttrLanguage, Pango::AttrColor, Pango::AttrInt, Pango::AttrFloat, Pango::AttrFontDesc, and Pango::AttrShape.

References gobject_.

PangoAttribute* Pango::Attribute::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented in Pango::AttrString, Pango::AttrLanguage, Pango::AttrColor, Pango::AttrInt, Pango::AttrFloat, Pango::AttrFontDesc, and Pango::AttrShape.

References gobject_.

Referenced by Pango::AttributeTraits::to_c_type().

Attribute& Pango::Attribute::operator= | ( | const Attribute& | src | ) |

static AttrType Pango::Attribute::register_type | ( | const Glib::ustring & | name | ) | `[static]`

Allocate a new attribute type ID.

Parameters:

  | name | An identifier for the type (currently unused).

Returns:
  The new type ID.

void Pango::Attribute::set_end_index | ( | const unsigned int & | value | ) |

Sets the end index of the range.

The character at this index is not included in the range.

Parameters:

  | value | The new end index (in bytes).

void Pango::Attribute::set_start_index | ( | const unsigned int & | value | ) |

Sets the start index of the range.

Parameters:

  | value | The new start index (in bytes).

## Friends And Related Function Documentation

bool operator!= | ( | const Attribute& | lhs,
|  | const Attribute& | rhs |
| ) |  |  | `[related]`

References equal().

bool operator== | ( | const Attribute& | lhs,
|  | const Attribute& | rhs |
| ) |  |  | `[related]`

References equal().

Pango::Attribute wrap | ( | PangoAttribute * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

## Member Data Documentation

PangoAttribute* Pango::Attribute::gobject_`[protected]`

Referenced by Pango::AttrShape::gobj(), Pango::AttrFontDesc::gobj(), Pango::AttrFloat::gobj(), Pango::AttrInt::gobj(), Pango::AttrColor::gobj(), Pango::AttrLanguage::gobj(), Pango::AttrString::gobj(), and gobj().

The documentation for this class was generated from the following file:

- attributes.h