pangomm 2.56.2

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Symbols | List of all members
Pango::Attribute Class Reference

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

`#include <pangomm/attributes.h>`

Inheritance diagram for Pango::Attribute:
[legend]

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

## Static Public Member Functions
static AttrType | register_type (const Glib::ustring & name)
| Allocate a new attribute type ID.
static Glib::ustring | get_type_name (AttrType type)
| Fetches the attribute type name passed in when registering the type using register_type().
static AttrString | create_attr_family (const Glib::ustring & family)
| Create a new font family attribute.
static AttrLanguage | create_attr_language (const Language & language)
| Create a new language tag attribute.
static AttrColor | create_attr_foreground (guint16 red, guint16 green, guint16 blue)
| Create a new foreground color attribute.
static AttrColor | create_attr_background (guint16 red, guint16 green, guint16 blue)
| Create a new background color attribute.
static AttrInt | create_attr_foreground_alpha (guint16 alpha)
| Create a new foreground alpha attribute.
static AttrInt | create_attr_background_alpha (guint16 alpha)
| Create a new background alpha attribute.
static AttrInt | create_attr_size (int size)
| Create a new font-size attribute.
static AttrInt | create_attr_size_absolute (int size)
| Create a new font-size attribute.
static AttrInt | create_attr_style (Style style)
| Create a new font slant style attribute.
static AttrInt | create_attr_weight (Weight weight)
| Create a new font weight attribute.
static AttrInt | create_attr_variant (Variant variant)
| Create a new font variant attribute (normal or small caps).
static AttrInt | create_attr_stretch (Stretch stretch)
| Create a new font stretch attribute.
static AttrFontDesc | create_attr_font_desc (const FontDescription & desc)
| Create a new font description attribute.
static AttrInt | create_attr_underline (Underline underline)
| Create a new underline-style object.
static AttrColor | create_attr_underline_color (guint16 red, guint16 green, guint16 blue)
| Create a new underline color attribute.
static AttrInt | create_attr_overline (Overline overline)
| Create a new overline-style object.
static AttrColor | create_attr_overline_color (guint16 red, guint16 green, guint16 blue)
| Create a new overline color attribute.
static AttrInt | create_attr_strikethrough (bool strikethrough)
| Create a new font strike-through attribute.
static AttrColor | create_attr_strikethrough_color (guint16 red, guint16 green, guint16 blue)
| Create a new strikethrough color attribute.
static AttrInt | create_attr_rise (int rise)
| Create a new baseline displacement attribute.
static AttrInt | create_attr_baseline_shift (int shift)
| Create a new baseline displacement attribute.
static AttrInt | create_attr_font_scale (FontScale scale)
| Create a new font scale attribute.
static AttrFloat | create_attr_scale (double scale_factor)
| Create a new font size scale attribute.
static AttrInt | create_attr_fallback (bool enable_fallback)
| Create a new font fallback attribute.
static AttrInt | create_attr_letter_spacing (int letter_spacing)
| Create a new letter-spacing attribute.
static AttrShape | create_attr_shape (const Rectangle & ink_rect, const Rectangle & logical_rect)
| Create a new shape attribute.
static AttrInt | create_attr_gravity (Gravity gravity)
| Create a new gravity attribute.
static AttrInt | create_attr_gravity_hint (GravityHint hint)
| Create a new gravity hint attribute.
static AttrString | create_attr_font_features (const Glib::ustring & features)
| Create a new font features tag attribute.
static AttrInt | create_attr_allow_breaks (bool allow_breaks)
| Create a new allow-breaks attribute.
static AttrInt | create_attr_word ()
| Marks the range of the attribute as a single word.
static AttrInt | create_attr_sentence ()
| Marks the range of the attribute as a single sentence.
static AttrInt | create_attr_insert_hyphens (bool insert_hyphens)
| Create a new insert-hyphens attribute.
static AttrInt | create_attr_show (ShowFlags show)
| Create a new attribute that influences how invisible characters are rendered.
static AttrFloat | create_attr_line_height (double factor)
| Modify the height of logical line extents by a factor.
static AttrInt | create_attr_line_height_absolute (int height)
| Override the height of logical line extents to be height.
static AttrInt | create_attr_text_transform (TextTransform transform)
| Create a new attribute that influences how characters are transformed during shaping.

## Protected Attributes
PangoAttribute * | gobject_

## Related Symbols
(Note that these are not member symbols.)
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)

## 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.

## Constructor & Destructor Documentation

## ◆ Attribute() [1/3]

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

Constructs an invalid attribute.

## ◆ Attribute() [2/3]

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

## ◆ Attribute() [3/3]

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

## ◆ ~Attribute()

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

## Member Function Documentation

## ◆ create_attr_allow_breaks()

AttrInt Pango::Attribute::create_attr_allow_breaks | ( | bool | allow_breaks | ) |
| static

Create a new allow-breaks attribute.

If breaks are disabled, the range will be kept in a single run, as far as possible.

Since pangomm 2.46

Parameters

  allow_breaks | true if line breaks are allowed.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_background()

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.

## ◆ create_attr_background_alpha()

AttrInt Pango::Attribute::create_attr_background_alpha | ( | guint16 | alpha | ) |
| static

Create a new background alpha attribute.

Parameters

  alpha | The alpha value, between 1 and 65536.

## ◆ create_attr_baseline_shift()

AttrInt Pango::Attribute::create_attr_baseline_shift | ( | int | shift | ) |
| static

Create a new baseline displacement attribute.

The effect of this attribute is to shift the baseline of a run, relative to the run of preceding run.

Since pangomm 2.50

Parameters

  shift | Either a Pango::BaselineShift enumeration value or an absolute value (> 1024) in Pango units, relative to the baseline of the previous run. Positive values displace the text upwards.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_fallback()

AttrInt Pango::Attribute::create_attr_fallback | ( | bool | enable_fallback | ) |
| static

Create a new font fallback attribute.

If fallback is disabled, characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text.

Since pangomm 2.42

Parameters

  enable_fallback | true if we should fall back on other fonts for characters the active font is missing.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_family()

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.

## ◆ create_attr_font_desc()

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.

## ◆ create_attr_font_features()

AttrString Pango::Attribute::create_attr_font_features | ( | const Glib::ustring & | features | ) |
| static

Create a new font features tag attribute.

Since pangomm 2.42

Parameters

  features | A string with OpenType font features, in CSS syntax.

Returns
  An attribute of type AttrString.

## ◆ create_attr_font_scale()

AttrInt Pango::Attribute::create_attr_font_scale | ( | FontScale | scale | ) |
| static

Create a new font scale attribute.

The effect of this attribute is to change the font size of a run, relative to the size of preceding run.

Since pangomm 2.50

Parameters

  scale | A Pango::FontScale value, which indicates font size change relative to the size of the previous run.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_foreground()

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.

## ◆ create_attr_foreground_alpha()

AttrInt Pango::Attribute::create_attr_foreground_alpha | ( | guint16 | alpha | ) |
| static

Create a new foreground alpha attribute.

Parameters

  alpha | The alpha value, between 1 and 65536.

## ◆ create_attr_gravity()

AttrInt Pango::Attribute::create_attr_gravity | ( | Gravity | gravity | ) |
| static

Create a new gravity attribute.

Since pangomm 2.42

Parameters

  gravity | The gravity value; should not be Pango::Gravity::AUTO.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_gravity_hint()

AttrInt Pango::Attribute::create_attr_gravity_hint | ( | GravityHint | hint | ) |
| static

Create a new gravity hint attribute.

Since pangomm 2.42

Parameters

  hint | The gravity hint value.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_insert_hyphens()

AttrInt Pango::Attribute::create_attr_insert_hyphens | ( | bool | insert_hyphens | ) |
| static

Create a new insert-hyphens attribute.

Pangomm will insert hyphens when breaking lines in the middle of a word. This attribute can be used to suppress the hyphen.

Since pangomm 2.46

Parameters

  insert_hyphens | true if hyphens should be inserted.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_language()

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.

## ◆ create_attr_letter_spacing()

AttrInt Pango::Attribute::create_attr_letter_spacing | ( | int | letter_spacing | ) |
| static

Create a new letter-spacing attribute.

Since pangomm 2.42

Parameters

  letter_spacing | Amount of extra space to add between graphemes of the text, in Pango units.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_line_height()

AttrFloat Pango::Attribute::create_attr_line_height | ( | double | factor | ) |
| static

Modify the height of logical line extents by a factor.

This affects the values returned by Pango::LayoutLine::get_extents(), Pango::LayoutLine::get_pixel_extents() and Pango::LayoutIter::get_line_extents().

Since pangomm 2.50

Parameters

  factor | The scaling factor to apply to the logical height.

Returns
  An attribute of type AttrFloat.

## ◆ create_attr_line_height_absolute()

AttrInt Pango::Attribute::create_attr_line_height_absolute | ( | int | height | ) |
| static

Override the height of logical line extents to be height.

This affects the values returned by Pango::LayoutLine::get_extents(), Pango::LayoutLine::get_pixel_extents() and Pango::LayoutIter::get_line_extents().

Since pangomm 2.50

Parameters

  height | The line height, in Pango::SCALE-ths of a point.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_overline()

AttrInt Pango::Attribute::create_attr_overline | ( | Overline | overline | ) |
| static

Create a new overline-style object.

Since pangomm 2.46

Parameters

  overline | The overline style.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_overline_color()

AttrColor Pango::Attribute::create_attr_overline_color | ( | guint16 | red,
|  | guint16 | green,
|  | guint16 | blue )
| static

Create a new overline color attribute.

This attribute modifies the color of overlines. If not set, overlines will use the foreground color.

Since pangomm 2.46

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.

## ◆ create_attr_rise()

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.

## ◆ create_attr_scale()

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.

## ◆ create_attr_sentence()

AttrInt Pango::Attribute::create_attr_sentence | ( |  | ) |
| static

Marks the range of the attribute as a single sentence.

Note that this may require adjustments to word and sentence classification around the range.

Since pangomm 2.50

Returns
  An attribute of type AttrInt.

## ◆ create_attr_shape()

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.

## ◆ create_attr_show()

AttrInt Pango::Attribute::create_attr_show | ( | ShowFlags | show | ) |
| static

Create a new attribute that influences how invisible characters are rendered.

Since pangomm 2.46

Parameters

  flags | Pango::ShowFlags to apply.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_size()

AttrInt Pango::Attribute::create_attr_size | ( | int | size | ) |
| static

Create a new font-size attribute.

Parameters

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

Returns
  An attribute of type AttrInt.

## ◆ create_attr_size_absolute()

AttrInt Pango::Attribute::create_attr_size_absolute | ( | int | size | ) |
| static

Create a new font-size attribute.

Since pangomm 2.42

Parameters

  size | The font size, in 1024ths of a device unit.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_stretch()

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.

## ◆ create_attr_strikethrough()

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.

## ◆ create_attr_strikethrough_color()

AttrColor Pango::Attribute::create_attr_strikethrough_color | ( | guint16 | red,
|  | guint16 | green,
|  | guint16 | blue )
| static

Create a new strikethrough color attribute.

This attribute modifies the color of strikethrough lines. If not set, strikethrough lines will use the foreground color.

Since pangomm 2.42

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.

## ◆ create_attr_style()

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.

## ◆ create_attr_text_transform()

AttrInt Pango::Attribute::create_attr_text_transform | ( | TextTransform | transform | ) |
| static

Create a new attribute that influences how characters are transformed during shaping.

Since pangomm 2.50

Parameters

  transform | Pango::TextTransform to apply.

Returns
  An attribute of type AttrInt.

## ◆ create_attr_underline()

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.

## ◆ create_attr_underline_color()

AttrColor Pango::Attribute::create_attr_underline_color | ( | guint16 | red,
|  | guint16 | green,
|  | guint16 | blue )
| static

Create a new underline color attribute.

This attribute modifies the color of underlines. If not set, underlines will use the foreground color.

Since pangomm 2.42

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.

## ◆ create_attr_variant()

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.

## ◆ create_attr_weight()

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.

## ◆ create_attr_word()

AttrInt Pango::Attribute::create_attr_word | ( |  | ) |
| static

Marks the range of the attribute as a single word.

Note that this may require adjustments to word and sentence classification around the range.

Since pangomm 2.50

Returns
  An attribute of type AttrInt.

## ◆ equal()

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.

## ◆ get_end_index()

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.

## ◆ get_start_index()

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

Gets the start index of the range.

Returns
  The start index of the range.

## ◆ get_type()

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.

## ◆ get_type_name()

Glib::ustring Pango::Attribute::get_type_name | ( | AttrType | type | ) |
| static

Fetches the attribute type name passed in when registering the type using register_type().

Since pangomm 2.46

Parameters

  type | An attribute type ID to fetch the name for.

Returns
  The type ID name (which may be an empty string), or an empty string if type is a built-in Pango attribute type or invalid.

## ◆ gobj() [1/2]

PangoAttribute * Pango::Attribute::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const PangoAttribute * Pango::Attribute::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ operator=()

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

## ◆ register_type()

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

Allocate a new attribute type ID.

The attribute type name can be accessed later by using get_type_name().

Parameters

  name | An identifier for the type.

Returns
  The new type ID.

## ◆ set_end_index()

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).

## ◆ set_start_index()

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 Symbol Documentation

## ◆ operator!=()

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

## ◆ operator==()

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

## ◆ wrap()

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

## Member Data Documentation

## ◆ gobject_

PangoAttribute* Pango::Attribute::gobject_
| protected