Enum Font.DistanceFieldType

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

public static enum Font.DistanceFieldType
extends java.lang.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.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant Description
    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.
    SDF
    Used by Signed Distance Field fonts that are compatible with DistanceFieldFont, and may be created by Hiero with its Distance Field effect.
    STANDARD
    Used by normal fonts with no distance field effect.
  • Method Summary

    Modifier and Type Method Description
    static Font.DistanceFieldType valueOf​(java.lang.String name)
    Returns the enum constant of this type with the specified name.
    static Font.DistanceFieldType[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • 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 type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Font.DistanceFieldType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
      java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
      java.lang.NullPointerException - if the argument is null