Class FontConfig.Builder

java.lang.Object
com.luciad.text.FontConfig.Builder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
FontConfig

public static final class FontConfig.Builder extends Object implements AutoCloseable
This builder allows you to create a FontConfig instance that can be registered using Fonts#registerFont.
Since:
2024.1
  • Constructor Details Link icon

  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
    • build Link icon

      @NotNull public FontConfig build() throws IllegalStateException
      Builds the FontConfig.
      Returns:
      A FontConfig object that can be registered for use.
      Throws:
      IllegalStateException - If not all mandatory parameters are set.
      IllegalStateException - If not all mandatory parameters are set.
    • name Link icon

      @NotNull public FontConfig.Builder name(@NotNull String name)
      Sets the unique identifier of the font, which is used in other functions to specify which font to use, for example in TextStyle.

      Registering a font name that is already in use overwrites it, this includes the fonts available by default.

      This function is mandatory.

      Parameters:
      name - identifier of the font.
      Returns:
      this builder.
    • file Link icon

      @NotNull public FontConfig.Builder file(@NotNull String path)
      Add a font file to the font configuration.

      In many cases only one file is needed.

      You can, for example, call this function multiple times if you have a bitmap font where each size is in a different file.

      This function is mandatory.

      Parameters:
      path - path to a font file.
      Returns:
      this builder.