Package arc.graphics.g2d
Class DistanceFieldFont
java.lang.Object
arc.graphics.g2d.Font
arc.graphics.g2d.DistanceFieldFont
- All Implemented Interfaces:
Disposable
Renders bitmap fonts using distance field textures, see the Distance Field Fonts wiki article for usage. Initialize
the SpriteBatch with the
createDistanceFieldShader()
shader.
Attention: The batch is flushed before and after each string is rendered.
-
Nested Class Summary
Nested classes/interfaces inherited from class arc.graphics.g2d.Font
Font.FontData, Font.Glyph
-
Constructor Summary
ConstructorDescriptionDistanceFieldFont
(Fi fontFile) DistanceFieldFont
(Fi fontFile, boolean flip) DistanceFieldFont
(Fi fontFile, Fi imageFile, boolean flip) DistanceFieldFont
(Fi fontFile, Fi imageFile, boolean flip, boolean integer) DistanceFieldFont
(Fi fontFile, TextureRegion region) DistanceFieldFont
(Fi fontFile, TextureRegion region, boolean flip) DistanceFieldFont
(Font.FontData data, TextureRegion region, boolean integer) DistanceFieldFont
(Font.FontData data, Seq<TextureRegion> pageRegions, boolean integer) -
Method Summary
Modifier and TypeMethodDescriptionstatic Shader
Returns a new instance of the distance field shader, see https://github.com/libgdx/libgdx/wiki/Distance-field-fonts if the u_smoothing uniform > 0.0.float
protected void
load
(Font.FontData data) Creates a new BitmapFontCache for this font.void
setDistanceFieldSmoothing
(float distanceFieldSmoothing) Methods inherited from class arc.graphics.g2d.Font
dispose, draw, draw, draw, draw, draw, draw, draw, getAscent, getCache, getCapHeight, getColor, getData, getDescent, getLineHeight, getRegion, getRegion, getRegions, getScaleX, getScaleY, getSpaceXadvance, getXHeight, isDisposed, isFlipped, ownsTexture, setColor, setColor, setFixedWidthGlyphs, setOwnsTexture, setUseIntegerPositions, toString, usesIntegerPositions
-
Constructor Details
-
DistanceFieldFont
-
DistanceFieldFont
-
DistanceFieldFont
-
DistanceFieldFont
-
DistanceFieldFont
-
DistanceFieldFont
-
DistanceFieldFont
-
DistanceFieldFont
-
-
Method Details
-
createDistanceFieldShader
Returns a new instance of the distance field shader, see https://github.com/libgdx/libgdx/wiki/Distance-field-fonts if the u_smoothing uniform > 0.0. Otherwise the same code as the default SpriteBatch shader is used. -
load
-
newFontCache
Description copied from class:Font
Creates a new BitmapFontCache for this font. Using this method allows the font to provide the BitmapFontCache implementation to customize rendering.Note this method is called by the BitmapFont constructors. If a subclass overrides this method, it will be called before the subclass constructors.
- Overrides:
newFontCache
in classFont
-
getDistanceFieldSmoothing
public float getDistanceFieldSmoothing()- Returns:
- The distance field smoothing factor for this font.
-
setDistanceFieldSmoothing
public void setDistanceFieldSmoothing(float distanceFieldSmoothing) - Parameters:
distanceFieldSmoothing
- Set the distance field smoothing factor for this font. SpriteBatch needs to have this shader set for rendering distance field fonts.
-