Enum Class FontVariant

java.lang.Object
java.lang.Enum<FontVariant>
com.nsdev.lettergenerator.font.FontVariant
All Implemented Interfaces:
Serializable, Comparable<FontVariant>, Constable

public enum FontVariant extends Enum<FontVariant>
Physical font face selected from resolved bold and italic style flags. Custom families register their actual faces through LetterPdfGenerator.Builder.registerFont(String, FontVariant, java.nio.file.Path). A regular face is required for each custom family, and a requested bold/italic variant must also be registered; the generator does not synthesize missing custom faces.
  • Enum Constant Details

    • REGULAR

      public static final FontVariant REGULAR
      Upright, normal-weight face; required for every custom font family.
    • BOLD

      public static final FontVariant BOLD
      Bold, upright face.
    • ITALIC

      public static final FontVariant ITALIC
      Italic, normal-weight face.
    • BOLD_ITALIC

      public static final FontVariant BOLD_ITALIC
      Face combining bold weight and italic posture.
  • Method Details

    • values

      public static FontVariant[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FontVariant valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isBold

      public boolean isBold()
      Reports whether this physical face supplies bold weight.
      Returns:
      true for BOLD and BOLD_ITALIC
    • isItalic

      public boolean isItalic()
      Reports whether this physical face supplies italic posture.
      Returns:
      true for ITALIC and BOLD_ITALIC
    • fromStyle

      public static FontVariant fromStyle(boolean bold, boolean italic)
      Maps resolved style flags to the exact physical face required for rendering.
      Parameters:
      bold - whether the resolved text style requests bold weight
      italic - whether the resolved text style requests italic posture
      Returns:
      the matching variant, or REGULAR when both flags are false