Class Attribute

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Attribute extends ProxyInstance

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 and should be initialized using init(AttrClass). By default, an attribute will have an all-inclusive range of [0,G_MAXUINT].

  • Constructor Details

    • Attribute

      public Attribute(MemorySegment address)
      Create a Attribute proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Attribute

      public Attribute(Arena arena)
      Allocate a new Attribute.
      Parameters:
      arena - to control the memory allocation scope
    • Attribute

      public Attribute()
      Allocate a new Attribute. The memory is allocated with Arena.ofAuto().
    • Attribute

      public Attribute(AttrClass klass, int startIndex, int endIndex, Arena arena)
      Allocate a new Attribute with the fields set to the provided values.
      Parameters:
      klass - value for the field klass
      startIndex - value for the field startIndex
      endIndex - value for the field endIndex
      arena - to control the memory allocation scope
    • Attribute

      public Attribute(AttrClass klass, int startIndex, int endIndex)
      Allocate a new Attribute with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      klass - value for the field klass
      startIndex - value for the field startIndex
      endIndex - value for the field endIndex
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Attribute class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readKlass

      public AttrClass readKlass()
      Read the value of the field klass.
      Returns:
      The value of the field klass
    • writeKlass

      public void writeKlass(AttrClass klass)
      Write a value in the field klass.
      Parameters:
      klass - The new value for the field klass
    • readStartIndex

      public int readStartIndex()
      Read the value of the field start_index.
      Returns:
      The value of the field start_index
    • writeStartIndex

      public void writeStartIndex(int startIndex)
      Write a value in the field start_index.
      Parameters:
      startIndex - The new value for the field start_index
    • readEndIndex

      public int readEndIndex()
      Read the value of the field end_index.
      Returns:
      The value of the field end_index
    • writeEndIndex

      public void writeEndIndex(int endIndex)
      Write a value in the field end_index.
      Parameters:
      endIndex - The new value for the field end_index
    • asColor

      public @Nullable AttrColor asColor()

      Returns the attribute cast to PangoAttrColor.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrColor, or null if it's not a color attribute
      Since:
      1.50
    • asFloat

      public @Nullable AttrFloat asFloat()

      Returns the attribute cast to PangoAttrFloat.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrFloat, or null if it's not a floating point attribute
      Since:
      1.50
    • asFontDesc

      public @Nullable AttrFontDesc asFontDesc()

      Returns the attribute cast to PangoAttrFontDesc.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrFontDesc, or null if it's not a font description attribute
      Since:
      1.50
    • asFontFeatures

      public @Nullable AttrFontFeatures asFontFeatures()

      Returns the attribute cast to PangoAttrFontFeatures.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrFontFeatures, or null if it's not a font features attribute
      Since:
      1.50
    • asInt

      public @Nullable AttrInt asInt()

      Returns the attribute cast to PangoAttrInt.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrInt, or null if it's not an integer attribute
      Since:
      1.50
    • asLanguage

      public @Nullable AttrLanguage asLanguage()

      Returns the attribute cast to PangoAttrLanguage.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrLanguage, or null if it's not a language attribute
      Since:
      1.50
    • asShape

      public @Nullable AttrShape asShape()

      Returns the attribute cast to PangoAttrShape.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrShape, or null if it's not a shape attribute
      Since:
      1.50
    • asSize

      public @Nullable AttrSize asSize()

      Returns the attribute cast to PangoAttrSize.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrSize, or NULL if it's not a size attribute
      Since:
      1.50
    • asString

      public @Nullable AttrString asString()

      Returns the attribute cast to PangoAttrString.

      This is mainly useful for language bindings.

      Returns:
      The attribute as PangoAttrString, or null if it's not a string attribute
      Since:
      1.50
    • copy

      public Attribute copy()
      Make a copy of an attribute.
      Returns:
      the newly allocated PangoAttribute, which should be freed with destroy().
    • destroy

      public void destroy()
      Destroy a PangoAttribute and free all associated memory.
    • equal

      public boolean equal(Attribute attr2)

      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 PangoAttribute
      Returns:
      true if the two attributes have the same value
    • init

      public void init(AttrClass klass)
      Initializes attr's klass to klass, it's start_index to PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING and end_index to PANGO_ATTR_INDEX_TO_TEXT_END such that the attribute applies to the entire text by default.
      Parameters:
      klass - a PangoAttrClass
      Since:
      1.20