Package com.github.tommyettinger.textra
Class BitmapFontSupport
java.lang.Object
com.github.tommyettinger.textra.BitmapFontSupport
A utility class for loading
BitmapFont
instances from Structured JSON files (which use .json or .dat).
Font
instances can already be loaded using
some of the constructors there
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Mainly for internal use; allows loading BitmapFontData from a Structured JSON Font instead of a .fnt file. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.badlogic.gdx.graphics.g2d.BitmapFont
loadStructuredJson
(com.badlogic.gdx.files.FileHandle jsonFont, com.badlogic.gdx.graphics.g2d.TextureRegion region) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool.static com.badlogic.gdx.graphics.g2d.BitmapFont
loadStructuredJson
(com.badlogic.gdx.files.FileHandle jsonFont, com.badlogic.gdx.graphics.g2d.TextureRegion region, boolean flip) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool.static com.badlogic.gdx.graphics.g2d.BitmapFont
loadStructuredJson
(com.badlogic.gdx.files.FileHandle jsonFont, String imagePath) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool.static com.badlogic.gdx.graphics.g2d.BitmapFont
loadStructuredJson
(com.badlogic.gdx.files.FileHandle jsonFont, String imagePath, boolean flip) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool.
-
Constructor Details
-
BitmapFontSupport
public BitmapFontSupport()
-
-
Method Details
-
loadStructuredJson
public static com.badlogic.gdx.graphics.g2d.BitmapFont loadStructuredJson(com.badlogic.gdx.files.FileHandle jsonFont, com.badlogic.gdx.graphics.g2d.TextureRegion region) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool. This overload takes a TextureRegion for the image the JSON needs; this region is often part of an atlas.- Parameters:
jsonFont
- a FileHandle with the path to a Structured JSON Font (typically a .json file)region
- a TextureRegion, often part of a shared atlas, holding the image the JSON needs- Returns:
- a new BitmapFont loaded from
jsonFont
-
loadStructuredJson
public static com.badlogic.gdx.graphics.g2d.BitmapFont loadStructuredJson(com.badlogic.gdx.files.FileHandle jsonFont, com.badlogic.gdx.graphics.g2d.TextureRegion region, boolean flip) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool. This overload takes a TextureRegion for the image the JSON needs; this region is often part of an atlas.- Parameters:
jsonFont
- a FileHandle with the path to a Structured JSON Font (typically a .json file)region
- a TextureRegion, often part of a shared atlas, holding the image the JSON needsflip
- true if this BitmapFont has been flipped for use with a y-down coordinate system- Returns:
- a new BitmapFont loaded from
jsonFont
-
loadStructuredJson
public static com.badlogic.gdx.graphics.g2d.BitmapFont loadStructuredJson(com.badlogic.gdx.files.FileHandle jsonFont, String imagePath) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool. This overload takes a relative path (fromjsonFont
) to the necessary image file, with the path as a String.- Parameters:
jsonFont
- a FileHandle with the path to a Structured JSON Font (typically a .json file)imagePath
- a String holding the relative path fromjsonFont
to the image file the JSON needs- Returns:
- a new BitmapFont loaded from
jsonFont
-
loadStructuredJson
public static com.badlogic.gdx.graphics.g2d.BitmapFont loadStructuredJson(com.badlogic.gdx.files.FileHandle jsonFont, String imagePath, boolean flip) Creates a BitmapFont by loading it from a Structured JSON Font, which is typically a .json file produced by FontWriter or a related tool. This overload takes a relative path (fromjsonFont
) to the necessary image file, with the path as a String.- Parameters:
jsonFont
- a FileHandle with the path to a Structured JSON Font (typically a .json file)imagePath
- a String holding the relative path fromjsonFont
to the image file the JSON needsflip
- true if this BitmapFont has been flipped for use with a y-down coordinate system- Returns:
- a new BitmapFont loaded from
jsonFont
-