Class BitmapFontSupport

java.lang.Object
com.github.tommyettinger.textra.BitmapFontSupport

public class BitmapFontSupport extends Object
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

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Mainly for internal use; allows loading BitmapFontData from a Structured JSON Font instead of a .fnt file.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 needs
      flip - 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 (from jsonFont) 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 from jsonFont 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 (from jsonFont) 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 from jsonFont to the image file the JSON needs
      flip - true if this BitmapFont has been flipped for use with a y-down coordinate system
      Returns:
      a new BitmapFont loaded from jsonFont