org.gnome.pango

## Class Attribute

- Object
- - org.freedesktop.bindings.Pointer
  - - org.gnome.glib.Boxed
    - - org.gnome.pango.Attribute

- Direct Known Subclasses:
    BackgroundColorAttribute, FallbackAttribute, FontDescriptionAttribute, ForegroundColorAttribute, RiseAttribute, SizeAttribute, StyleAttribute, UnderlineAttribute, UnderlineColorAttribute, VariantAttribute, WeightAttribute

      public abstract class Attribute
      extends Boxed

  A (single) specific formatting or font to be applied to a range of Text.

  Examples of setting up Attributes include:

       attr = new StyleAttribute(Style.ITALIC);

  although many settings can be compounded by setting a FontDescription:

       desc = new FontDescription("DejaVu Serif, 9pt");
       attr = new FontDescriptionAttribute(desc);

  in general it's one Attribute per characteristic. You then aggregate these together in an AttributeList and then apply them to a Layout. See `AttributeList` for an example of using these on discrete parts of text.

  WARNING:
  When coding with Attributes be aware of the following restrictions:

  - Once you have assigned an Attribute to a specific range of text in a given Layout you must not attempt to reuse it.
  - Once you have inserted an Attribute into an AttributeList it is "consumed" by that list and you must not attempt to reuse it.

  The different text attribute manipulations you can do are analogous to those found on FontDescription and TextTag. Indeed, Pango's Attributes are the underlying mechanism powering TextView and Label's rendering of rich markup.

  Pango Attributes have an internal ugliness which is that each one needs to be told the offsets of text it applies to. The problem is that these are in terms of UTF-8 bytes, which not something we have access to from Java (nor would we want to expose such in our public API). We take care of setting the start and end points properly when you call `setAttributes()`, but you have to have already set the text into the Layout for us to be able to do so, obviously.

  Since:
    4.0.10
  Author:
    Andrew Cowie

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `setIndices(int offset, int width)` Given the text already in a Pango Layout, a starting position, and a width, set the indexes of this Attribute accordingly.

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### setIndices

          public void setIndices(int offset,
                        int width)

      Given the text already in a Pango Layout, a starting position, and a width, set the indexes of this Attribute accordingly. `offset` and `width` are in terms of Java characters. The result of this call is that the start_index and end_index properties of the specified Attribute will be set.

      By default an Attribute added to an AttributeList covers all the text in whatever that AttributeList is applied to. If that's not what you want, you need to tell each Attribute what range it covers using this method.

      Since:
        4.0.11