Class FontFamily

All Implemented Interfaces:
Iterable<FontFace>, Collection<FontFace>, List<FontFace>, SequencedCollection<FontFace>, ListModel<FontFace>, Proxy, ListModelJavaList<FontFace>
Direct Known Subclasses:
FontFamily.FontFamily$Impl

@Generated("org.javagi.JavaGI") public abstract class FontFamily extends GObject implements ListModel<FontFace>

A PangoFontFamily is used to represent a family of related font faces.

The font faces in a family share a common design, but differ in slant, weight, width or other aspects.

  • Constructor Details

    • FontFamily

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

      public FontFamily()
      Create a new FontFamily.
  • Method Details

    • getType

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

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

      protected FontFamily asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getFace

      public @Nullable FontFace getFace(@Nullable String name)
      Gets the PangoFontFace of this FontFamily with the given name.
      Parameters:
      name - the name of a face. If the name is null, the family's default face (fontconfig calls it "Regular") will be returned.
      Returns:
      the PangoFontFace, or null if no face with the given name exists.
      Since:
      1.46
    • getName

      public String getName()

      Gets the name of the family.

      The name is unique among all fonts for the font backend and can be used in a PangoFontDescription to specify that a face from this family is desired.

      Returns:
      the name of the family. This string is owned by the family object and must not be modified or freed.
    • isMonospace

      public boolean isMonospace()

      A monospace font is a font designed for text display where the the characters form a regular grid.

      For Western languages this would mean that the advance width of all characters are the same, but this categorization also includes Asian fonts which include double-width characters: characters that occupy two grid cells. g_unichar_iswide() returns a result that indicates whether a character is typically double-width in a monospace font.

      The best way to find out the grid-cell size is to call FontMetrics.getApproximateDigitWidth(), since the results of FontMetrics.getApproximateCharWidth() may be affected by double-width characters.

      Returns:
      true if the family is monospace.
      Since:
      1.4
    • isVariable

      public boolean isVariable()

      A variable font is a font which has axes that can be modified to produce different faces.

      Such axes are also known as variations; see FontDescription.setVariations(String) for more information.

      Returns:
      true if the family is variable
      Since:
      1.44
    • listFaces

      public void listFaces(@Nullable Out<FontFace[]> faces)

      Lists the different font faces that make up family.

      The faces in a family share a common design, but differ in slant, weight, width and other aspects.

      Note that the returned faces are not in any particular order, and multiple faces may have the same name or characteristics.

      PangoFontFamily also implemented the ListModel interface for enumerating faces.

      Parameters:
      faces - location to store an array of pointers to PangoFontFace objects, or null. This array should be freed with g_free() when it is no longer needed.