Class FontMetrics

java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.pango.FontMetrics
All Implemented Interfaces:
Proxy

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

A PangoFontMetrics structure holds the overall metric information for a font.

The information in a PangoFontMetrics structure may be restricted to a script. The fields of this structure are private to implementations of a font backend. See the documentation of the corresponding getters for documentation of their meaning.

For an overview of the most important metrics, see:

Font metrics
  • Constructor Details

    • FontMetrics

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

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

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

      public FontMetrics(int refCount, int ascent, int descent, int height, int approximateCharWidth, int approximateDigitWidth, int underlinePosition, int underlineThickness, int strikethroughPosition, int strikethroughThickness, Arena arena)
      Allocate a new FontMetrics with the fields set to the provided values.
      Parameters:
      refCount - value for the field refCount
      ascent - value for the field ascent
      descent - value for the field descent
      height - value for the field height
      approximateCharWidth - value for the field approximateCharWidth
      approximateDigitWidth - value for the field approximateDigitWidth
      underlinePosition - value for the field underlinePosition
      underlineThickness - value for the field underlineThickness
      strikethroughPosition - value for the field strikethroughPosition
      strikethroughThickness - value for the field strikethroughThickness
      arena - to control the memory allocation scope
    • FontMetrics

      public FontMetrics(int refCount, int ascent, int descent, int height, int approximateCharWidth, int approximateDigitWidth, int underlinePosition, int underlineThickness, int strikethroughPosition, int strikethroughThickness)
      Allocate a new FontMetrics with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      refCount - value for the field refCount
      ascent - value for the field ascent
      descent - value for the field descent
      height - value for the field height
      approximateCharWidth - value for the field approximateCharWidth
      approximateDigitWidth - value for the field approximateDigitWidth
      underlinePosition - value for the field underlinePosition
      underlineThickness - value for the field underlineThickness
      strikethroughPosition - value for the field strikethroughPosition
      strikethroughThickness - value for the field strikethroughThickness
  • Method Details

    • getType

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

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

      public int readRefCount()
      Read the value of the field ref_count.
      Returns:
      The value of the field ref_count
    • writeRefCount

      public void writeRefCount(int refCount)
      Write a value in the field ref_count.
      Parameters:
      refCount - The new value for the field ref_count
    • readAscent

      public int readAscent()
      Read the value of the field ascent.
      Returns:
      The value of the field ascent
    • writeAscent

      public void writeAscent(int ascent)
      Write a value in the field ascent.
      Parameters:
      ascent - The new value for the field ascent
    • readDescent

      public int readDescent()
      Read the value of the field descent.
      Returns:
      The value of the field descent
    • writeDescent

      public void writeDescent(int descent)
      Write a value in the field descent.
      Parameters:
      descent - The new value for the field descent
    • readHeight

      public int readHeight()
      Read the value of the field height.
      Returns:
      The value of the field height
    • writeHeight

      public void writeHeight(int height)
      Write a value in the field height.
      Parameters:
      height - The new value for the field height
    • readApproximateCharWidth

      public int readApproximateCharWidth()
      Read the value of the field approximate_char_width.
      Returns:
      The value of the field approximate_char_width
    • writeApproximateCharWidth

      public void writeApproximateCharWidth(int approximateCharWidth)
      Write a value in the field approximate_char_width.
      Parameters:
      approximateCharWidth - The new value for the field approximate_char_width
    • readApproximateDigitWidth

      public int readApproximateDigitWidth()
      Read the value of the field approximate_digit_width.
      Returns:
      The value of the field approximate_digit_width
    • writeApproximateDigitWidth

      public void writeApproximateDigitWidth(int approximateDigitWidth)
      Write a value in the field approximate_digit_width.
      Parameters:
      approximateDigitWidth - The new value for the field approximate_digit_width
    • readUnderlinePosition

      public int readUnderlinePosition()
      Read the value of the field underline_position.
      Returns:
      The value of the field underline_position
    • writeUnderlinePosition

      public void writeUnderlinePosition(int underlinePosition)
      Write a value in the field underline_position.
      Parameters:
      underlinePosition - The new value for the field underline_position
    • readUnderlineThickness

      public int readUnderlineThickness()
      Read the value of the field underline_thickness.
      Returns:
      The value of the field underline_thickness
    • writeUnderlineThickness

      public void writeUnderlineThickness(int underlineThickness)
      Write a value in the field underline_thickness.
      Parameters:
      underlineThickness - The new value for the field underline_thickness
    • readStrikethroughPosition

      public int readStrikethroughPosition()
      Read the value of the field strikethrough_position.
      Returns:
      The value of the field strikethrough_position
    • writeStrikethroughPosition

      public void writeStrikethroughPosition(int strikethroughPosition)
      Write a value in the field strikethrough_position.
      Parameters:
      strikethroughPosition - The new value for the field strikethrough_position
    • readStrikethroughThickness

      public int readStrikethroughThickness()
      Read the value of the field strikethrough_thickness.
      Returns:
      The value of the field strikethrough_thickness
    • writeStrikethroughThickness

      public void writeStrikethroughThickness(int strikethroughThickness)
      Write a value in the field strikethrough_thickness.
      Parameters:
      strikethroughThickness - The new value for the field strikethrough_thickness
    • getApproximateCharWidth

      public int getApproximateCharWidth()

      Gets the approximate character width for a font metrics structure.

      This is merely a representative value useful, for example, for determining the initial size for a window. Actual characters in text will be wider and narrower than this.

      Returns:
      the character width, in Pango units.
    • getApproximateDigitWidth

      public int getApproximateDigitWidth()

      Gets the approximate digit width for a font metrics structure.

      This is merely a representative value useful, for example, for determining the initial size for a window. Actual digits in text can be wider or narrower than this, though this value is generally somewhat more accurate than the result of pango_font_metrics_get_approximate_char_width() for digits.

      Returns:
      the digit width, in Pango units.
    • getAscent

      public int getAscent()

      Gets the ascent from a font metrics structure.

      The ascent is the distance from the baseline to the logical top of a line of text. (The logical top may be above or below the top of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

      Returns:
      the ascent, in Pango units.
    • getDescent

      public int getDescent()

      Gets the descent from a font metrics structure.

      The descent is the distance from the baseline to the logical bottom of a line of text. (The logical bottom may be above or below the bottom of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

      Returns:
      the descent, in Pango units.
    • getHeight

      public int getHeight()

      Gets the line height from a font metrics structure.

      The line height is the recommended distance between successive baselines in wrapped text using this font.

      If the line height is not available, 0 is returned.

      Returns:
      the height, in Pango units
      Since:
      1.44
    • getStrikethroughPosition

      public int getStrikethroughPosition()

      Gets the suggested position to draw the strikethrough.

      The value returned is the distance above the baseline of the top of the strikethrough.

      Returns:
      the suggested strikethrough position, in Pango units.
      Since:
      1.6
    • getStrikethroughThickness

      public int getStrikethroughThickness()
      Gets the suggested thickness to draw for the strikethrough.
      Returns:
      the suggested strikethrough thickness, in Pango units.
      Since:
      1.6
    • getUnderlinePosition

      public int getUnderlinePosition()

      Gets the suggested position to draw the underline.

      The value returned is the distance above the baseline of the top of the underline. Since most fonts have underline positions beneath the baseline, this value is typically negative.

      Returns:
      the suggested underline position, in Pango units.
      Since:
      1.6
    • getUnderlineThickness

      public int getUnderlineThickness()
      Gets the suggested thickness to draw for the underline.
      Returns:
      the suggested underline thickness, in Pango units.
      Since:
      1.6
    • ref

      public @Nullable FontMetrics ref()
      Increase the reference count of a font metrics structure by one.
      Returns:
      this FontMetrics
    • unref

      public void unref()

      Decrease the reference count of a font metrics structure by one.

      If the result is zero, frees the structure and any associated memory.