Enum Class Font.DistanceFieldType

java.lang.Object
java.lang.Enum<Font.DistanceFieldType>
com.github.tommyettinger.textra.Font.DistanceFieldType
All Implemented Interfaces:
Serializable, Comparable<Font.DistanceFieldType>, Constable
Enclosing class:
Font

public static enum Font.DistanceFieldType extends Enum<Font.DistanceFieldType>
Defines what types of distance field font this can use and render. STANDARD has no distance field. SDF is the signed distance field technique Hiero is compatible with, and uses only an alpha channel. MSDF is the multi-channel signed distance field technique, which is sharper but uses the RGB channels.
  • Enum Constant Details

    • STANDARD

      public static final Font.DistanceFieldType STANDARD
      Used by normal fonts with no distance field effect. If the font has a large image that is downscaled, you may want to call Font.setTextureFilter().
    • SDF

      public static final Font.DistanceFieldType SDF
      Used by Signed Distance Field fonts that are compatible with DistanceFieldFont, and may be created by Hiero with its Distance Field effect. You may want to set the Font.distanceFieldCrispness field to a higher or lower value depending on the range used to create the font in Hiero; this can take experimentation.
    • MSDF

      public static final Font.DistanceFieldType MSDF
      Used by Multi-channel Signed Distance Field fonts, which are harder to create but can be more crisp than SDF fonts, with hard corners where the corners were hard in the original font. If you want to create your own MSDF font, you can use the Glamer font generator tool, which puts a lot of padding for each glyph to ensure it renders evenly, or you can use one of several other MSDF font generators, which may have an uneven baseline and look shaky when rendered for some fonts. You may want to set the Font.distanceFieldCrispness field to a higher or lower value based on preference.
  • Method Details

    • values

      public static Font.DistanceFieldType[] 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 Font.DistanceFieldType 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