Class FontSpecifier

java.lang.Object
de.xima.fc.common.text.shape.FontSpecifier

public final class FontSpecifier extends Object
A font specifier for the text shapers such as FontTextShaperBuilder.
Since:
8.4.0
  • Method Details

    • collectionIndex

      public int collectionIndex()
      Gets the collection index of the font. -1 when not a collection.
      Returns:
      The type of the font.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • id

      public String id()
      Gets the unique ID of the font.
      Returns:
      The type of the font.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • byFileName

      public static FontSpecifier.Builder byFileName(String fileName)
      Creates a new builder for a font specifier based on the file name. The file name should include the extension, e.g. "LiberationMono-BoldItalic.ttf". The base name is used as the font ID, and the extension is used to determine the font type.
      Parameters:
      fileName - The file name of the font file.
      Returns:
      A new builder for a font specifier.
    • openType

      public static FontSpecifier.Builder openType(String id)
      Creates a new builder for an OpenType font specifier.
      Parameters:
      id - The unique identifier of the font, including its style and variation, e.g. "LiberationMono-BoldItalic".
      Returns:
      A new builder for an OpenType font specifier.
    • trueType

      public static FontSpecifier.Builder trueType(String id)
      Creates a new builder for a TrueType font specifier.
      Parameters:
      id - The unique identifier of the font, including its style and variation, e.g. "LiberationMono-BoldItalic".
      Returns:
      A new builder for a TrueType font specifier.