public final class KnownFonts
extends java.lang.Object
implements com.badlogic.gdx.LifecycleListener
Font instances, with any important metric adjustments already applied. This uses a
singleton to ensure each font exists at most once, and implements LifecycleListener to ensure that when the
disposal stage of the lifecycle is called, then all Font instances here will be disposed and assigned null. This may
do more regarding its LifecycleListener code in the future, if Android turns out to need more work.
getCozette() or getGentiumSDF() to get a
particular Font. This knows a fair amount of fonts, but it doesn't require the image assets for all of those to be
present in a game -- only the files mentioned in the documentation for a method are needed, and only if you call that
method. It's likely that many games would only use one Font, and so would generally only need a .fnt file, a
.png file, and some kind of license file. They could ignore all other assets required by other fonts.| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
static Font[] |
getAll()
Returns a new array of Font instances, calling each getXyz() method in this class that returns any Font.
|
static Font[] |
getAllMSDF()
Returns a new array of Font instances, calling each getXyz() method in this class that returns any MSDF Font.
|
static Font[] |
getAllSDF()
Returns a new array of Font instances, calling each getXyz() method in this class that returns any SDF Font.
|
static Font[] |
getAllStandard()
Returns a new array of Font instances, calling each getXyz() method in this class that returns any
non-distance-field Font.
|
static Font |
getAStarry()
Returns a Font already configured to use a square font with 45-degree angled sections, based on the
typeface used on the Atari ST console, that should scale cleanly to many sizes.
|
static Font |
getCanada()
Returns a Font already configured to use a very-legible variable-width font with strong support for Canadian
Aboriginal Syllabic, that should scale pretty well from a height of about 86 down to a height of maybe 30.
|
static Font |
getCascadiaMono()
Returns a Font already configured to use a quirky fixed-width font with good Unicode support
and a humanist style, that should scale cleanly to even very large sizes (using an MSDF technique).
|
static Font |
getCozette()
Returns a Font configured to use a cozy fixed-width bitmap font,
Cozette by slavfox.
|
static Font |
getDejaVuSansMono()
A nice old standby font with very broad language support, DejaVu Sans Mono is fixed-width and can be clearly
readable but doesn't do anything unusual stylistically.
|
static Font |
getGentium()
Returns a Font already configured to use a variable-width serif font with excellent Unicode support, that should
scale well from a height of about 132 down to a height of 34.
|
static Font |
getGentiumSDF()
Returns a Font already configured to use a variable-width serif font with excellent Unicode support, that should
scale cleanly to even very large sizes (using an SDF technique).
|
static Font |
getIBM8x16()
Returns a Font configured to use a classic, nostalgic fixed-width bitmap font,
IBM 8x16 from the early, oft-beloved computer line.
|
static Font |
getInconsolata()
A customized version of Inconsolata LGC, a fixed-width geometric font that supports a large range of Latin,
Greek, and Cyrillic glyphs, plus box drawing and some dingbat characters (like zodiac signs).
|
static Font |
getInconsolataMSDF()
A customized version of Inconsolata LGC, a fixed-width geometric font that supports a large range of Latin,
Greek, and Cyrillic glyphs, plus box drawing and some dingbat characters (like zodiac signs).
|
static Font |
getIosevka()
Returns a Font already configured to use a highly-legible fixed-width font with good Unicode support
and a sans-serif geometric style.
|
static Font |
getIosevkaMSDF()
Returns a Font already configured to use a highly-legible fixed-width font with good Unicode support
and a sans-serif geometric style, that should scale cleanly to even very large sizes (using an MSDF technique).
|
static Font |
getIosevkaSDF()
Returns a Font already configured to use a highly-legible fixed-width font with good Unicode support
and a sans-serif geometric style, that should scale cleanly to fairly large sizes (using an SDF technique).
|
static Font |
getIosevkaSlab()
Returns a Font already configured to use a highly-legible fixed-width font with good Unicode support
and a slab-serif geometric style.
|
static Font |
getIosevkaSlabMSDF()
Returns a Font already configured to use a highly-legible fixed-width font with good Unicode support
and a slab-serif geometric style, that should scale cleanly to even very large sizes (using an MSDF technique).
|
static Font |
getIosevkaSlabSDF()
Returns a Font already configured to use a highly-legible fixed-width font with good Unicode support
and a slab-serif geometric style, that should scale cleanly to fairly large sizes (using an SDF technique).
|
static Font |
getKingthingsFoundation()
Returns a Font already configured to use a fairly-legible variable-width ornamental/medieval font, that should
scale pretty well from a height of about 90 down to a height of maybe 30.
|
static Font |
getLibertinusSerif()
Returns a Font already configured to use a variable-width serif font with good Unicode support, that should
scale cleanly to even very large sizes (using an MSDF technique).
|
static Font |
getOpenSans()
Returns a Font configured to use a clean variable-width font, Open Sans.
|
static Font |
getOxanium()
Returns a Font already configured to use a variable-width "science-fiction/high-tech" font, that should
scale pretty well down, but not up.
|
static Font |
getRobotoCondensed()
Returns a Font already configured to use a very-legible condensed variable-width font with excellent Unicode
support, that should scale pretty well from a height of about 62 down to a height of maybe 20.
|
static Font |
getYanoneKaffeesatz()
Returns a Font already configured to use a variable-width, narrow, humanist font, that should
scale pretty well down, but not up.
|
void |
pause() |
void |
resume() |
public static Font getAStarry()
public static Font getCanada()
public static Font getCascadiaMono()
public static Font getCozette()
public static Font getDejaVuSansMono()
public static Font getGentium()
KnownFonts.getGentium().scaleTo(55, 45).adjustLineHeight(0.8f)
usually works. Caches the result for later calls. The font used is Gentium, an open-source (SIL Open Font
License) typeface by SIL (see https://software.sil.org/gentium/ ). It supports a lot of glyphs, including quite a
bit of extended Latin, Greek, and Cyrillic, as well as some less-common glyphs from various real languages. This
does not use a distance field effect, as opposed to getGentiumSDF(). You may want to stick using just
fonts that avoid distance fields if you have a family of fonts.
public static Font getGentiumSDF()
KnownFonts.getGentium().scaleTo(55, 45).adjustLineHeight(0.8f)
usually works. Caches the result for later calls. The font used is Gentium, an open-source (SIL Open Font
License) typeface by SIL (see https://software.sil.org/gentium/ ). It supports a lot of glyphs, including quite a
bit of extended Latin, Greek, and Cyrillic, as well as some less-common glyphs from various real languages. This
uses the Signed Distance Field (SDF) technique, which may be slightly fuzzy when zoomed in heavily, but should be
crisp enough when zoomed out.
public static Font getIBM8x16()
getCozette() for a different bitmap font.
public static Font getInconsolata()
getInconsolataMSDF(). You may want to stick using just fonts
that avoid distance fields if you have a family of fonts.
public static Font getInconsolataMSDF()
public static Font getIosevka()
public static Font getIosevkaMSDF()
public static Font getIosevkaSDF()
getIosevkaMSDF() uses,
which isn't as sharp at large sizes but can look a little better at small sizes.
public static Font getIosevkaSlab()
public static Font getIosevkaSlabMSDF()
public static Font getIosevkaSlabSDF()
getIosevkaMSDF() uses,
which isn't as sharp at large sizes but can look a little better at small sizes.
public static Font getKingthingsFoundation()
public static Font getLibertinusSerif()
public static Font getOpenSans()
public static Font getOxanium()
public static Font getRobotoCondensed()
public static Font getYanoneKaffeesatz()
public void pause()
pause in interface com.badlogic.gdx.LifecycleListenerpublic void resume()
resume in interface com.badlogic.gdx.LifecycleListenerpublic static Font[] getAll()
public static Font[] getAllStandard()
public static Font[] getAllSDF()
public static Font[] getAllMSDF()
public void dispose()
dispose in interface com.badlogic.gdx.LifecycleListener