Package com.github.tommyettinger.textra
Enum Class Font.DistanceFieldType
- All Implemented Interfaces:
Serializable
,Comparable<Font.DistanceFieldType>
,Constable
- Enclosing class:
- Font
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.
- SDF_OUTLINE can use the same font files as SDF, but draws them with a black outline.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionUsed by Multi-channel Signed Distance Field fonts, which are typically created by fontwriter or msdf-atlas-gen and can sometimes be more crisp than SDF fonts MSDF produces hard corners where the corners were hard in the original font.Used by Signed Distance Field fonts that are compatible withDistanceFieldFont
, and may be created by Hiero with its Distance Field effect, fontwriter or the tool it uses and builds upon, msdf-atlas-gen.Very similar toSDF
, except that this draws a moderately-thick black outline around all SDF glyphs.Used by normal fonts with no distance field effect. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Font.DistanceFieldType[]
final String
The part of a filename before the extension that is used to look up fonts with this DistanceFieldType.final String
The part of the typical name of a Font that says what distance field that Font has, if any. -
Method Summary
Modifier and TypeMethodDescriptionstatic Font.DistanceFieldType
Returns the enum constant of this class with the specified name.static Font.DistanceFieldType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STANDARD
Used by normal fonts with no distance field effect. If the font has a large image that is downscaled, you may want to callFont.setTextureFilter()
. You can optionally set a custom ShaderProgram this can use by settingFont.shader
. -
SDF
Used by Signed Distance Field fonts that are compatible withDistanceFieldFont
, and may be created by Hiero with its Distance Field effect, fontwriter or the tool it uses and builds upon, msdf-atlas-gen. You may want to set theFont.distanceFieldCrispness
field to a higher or lower value depending on how thick the stroke is in the font; this can take experimentation, but the default is 1 and higher values have sharper edges (risking getting pixelated if too high). -
MSDF
Used by Multi-channel Signed Distance Field fonts, which are typically created by fontwriter or msdf-atlas-gen and can sometimes be more crisp than SDF fonts MSDF produces hard corners where the corners were hard in the original font. Creating MSDF fonts can be done with fontwriter or the tool it uses and builds upon, msdf-atlas-gen. You may want to set theFont.distanceFieldCrispness
field to a higher or lower value than its default of 1 based on preference, with higher values making more crisp (possibly aliased) fonts and lower values making softer (possibly blurry) fonts. -
SDF_OUTLINE
Very similar toSDF
, except that this draws a moderately-thick black outline around all SDF glyphs. It won't necessarily draw the outline correctly for inline images without a distance field effect. The outline will respect the transparency of the glyph (unlikeFont.BLACK_OUTLINE
mode). This can use the same font files asSDF
; just setFont.distanceField
to SDF_OUTLINE.
-
-
Field Details
-
ALL
-
filePart
The part of a filename before the extension that is used to look up fonts with this DistanceFieldType. Always one of "-standard", "-sdf", or "-msdf". -
namePart
The part of the typical name of a Font that says what distance field that Font has, if any.
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-