Class Font

All Implemented Interfaces:
PointerInterface

public class Font extends Object
A `PangoFont` is used to represent a font in a
rendering-system-independent manner.

https://docs.gtk.org/Pango/class.Font.html

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • describe

      public FontDescription describe()
      Returns a description of the font, with font size set in points.

      Use [method@Pango.Font.describe_with_absolute_size] if you want
      the font size in device units.
      Returns:
      a newly-allocated `PangoFontDescription` object.
    • describeWithAbsoluteSize

      public FontDescription describeWithAbsoluteSize()
      Returns a description of the font, with absolute font size set
      in device units.

      Use [method@Pango.Font.describe] if you want the font size in points.
      Returns:
      a newly-allocated `PangoFontDescription` object.
    • getCoverage

      public Coverage getCoverage(@Nonnull Language language)
      Computes the coverage map for a given font and language tag.
      Parameters:
      language - the language tag
      Returns:
      a newly-allocated `PangoCoverage` object.
    • getFace

      public FontFace getFace()
      Gets the `PangoFontFace` to which @font belongs.
      Returns:
      the `PangoFontFace`
    • getFontMap

      public FontMap getFontMap()
      Gets the font map for which the font was created.

      Note that the font maintains a *weak* reference to
      the font map, so if all references to font map are
      dropped, the font map will be finalized even if there
      are fonts created with the font map that are still alive.
      In that case this function will return %NULL.

      It is the responsibility of the user to ensure that the
      font map is kept alive. In most uses this is not an issue
      as a `PangoContext` holds a reference to the font map.
      Returns:
      the `PangoFontMap` for the font
    • getMetrics

      public FontMetrics getMetrics(@Nullable Language language)
      Gets overall metric information for a font.

      Since the metrics may be substantially different for different scripts,
      a language tag can be provided to indicate that the metrics should be
      retrieved that correspond to the script(s) used by that language.

      If @font is %NULL, this function gracefully sets some sane values in the
      output variables and returns.
      Parameters:
      language - language tag used to determine which script to get the metrics for, or %NULL to indicate to get the metrics for the entire font.
      Returns:
      a `PangoFontMetrics` object. The caller must call [method@Pango.FontMetrics.unref] when finished using the object.
    • hasChar

      public boolean hasChar(byte wc)
      Returns whether the font provides a glyph for this character.
      Parameters:
      wc - a Unicode character
      Returns:
      `TRUE` if @font can render @wc
    • serialize

      public Bytes serialize()
      Serializes the @font in a way that can be uniquely identified.

      There are no guarantees about the format of the output across different
      versions of Pango.

      The intended use of this function is testing, benchmarking and debugging.
      The format is not meant as a permanent storage format.

      To recreate a font from its serialized form, use [func@Pango.Font.deserialize].
      Returns:
      a `GBytes` containing the serialized form of @font
    • deserialize

      public static Font deserialize(@Nonnull Context context, @Nonnull Bytes bytes) throws AllocationError
      Loads data previously created via [method@Pango.Font.serialize].

      For a discussion of the supported format, see that function.

      Note: to verify that the returned font is identical to
      the one that was serialized, you can compare @bytes to the
      result of serializing the font again.
      Parameters:
      context - a `PangoContext`
      bytes - the bytes containing the data
      Returns:
      a new `PangoFont`
      Throws:
      AllocationError
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()