Class KnownFonts

java.lang.Object
com.github.tommyettinger.textra.KnownFonts
All Implemented Interfaces:
com.badlogic.gdx.LifecycleListener

public final class KnownFonts
extends java.lang.Object
implements com.badlogic.gdx.LifecycleListener
Preconfigured static 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.
Typical usage involves calling one of the static methods like 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. The files this class needs are looked for in the assets root folder by default, but you can change the names or locations of asset files with setAssetPrefix(String).
There's some documentation for every known Font, including a link to a preview image and a listing of all required files to use a Font. The required files include any license you need to abide by; this doesn't necessarily belong in the assets folder like the rest of the files! Most of these fonts are either licensed under the OFL or some Creative Commons license; the CC ones typically require attribution, but none of the fonts restrict usage to noncommercial projects, and all are free as in beer as well.
There are some special features in Font that are easier to use with parts of this class. getStandardFamily() pre-populates a FontFamily so you can switch between different fonts with the [@Sans] syntax. addEmoji(Font) adds all of Twitter's emoji from the Twemoji project to a given font, which lets you enter emoji with the [+man scientist, dark skin tone] syntax or the generally-easier [+👨🏿‍🔬] syntax. If you want to use names for emoji, you may want to consult "Twemoji.atlas" for the exact names used; some names changed from the standard because of technical restrictions.
  • Method Summary

    Modifier and Type Method Description
    static Font addEmoji​(Font changing)
    Takes a Font and adds the Twemoji icon set to it, making the glyphs available using [+name] syntax.
    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 very large fixed-width Font already configured to use a square font with 45-degree angled sections, based on the typeface used on the Atari ST console.
    static Font getAStarryMSDF()
    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 getBitter()
    Returns a Font already configured to use a light-weight variable-width slab serif font with good Latin and Cyrillic script support, that should scale pretty well from a height of about 160 down to a height of maybe 30.
    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 well from a height of about 60 pixels to about 15 pixels.
    static Font getCascadiaMonoMSDF()
    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 getCaveat()
    Returns a Font already configured to use a variable-width handwriting font with support for extended Latin and Cyrillic, that should scale pretty well from a height of about 160 down to a height of maybe 20.
    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 getHanazono()
    Returns a Font already configured to use a variable-width, narrow font with nearly-complete CJK character coverage, plus Latin, Greek, and Cyrillic, that shouldm scale pretty well down, but not up.
    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 fairly large sizes or down to about 20 pixels.
    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 getQuanPixel()
    Returns a Font configured to use a small variable-width bitmap font with extensive coverage of Asian scripts, QuanPixel.
    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 getStandardFamily()
    Returns a Font (getGentium()) with a FontFamily configured so that all non-distance-field Fonts can be used with syntax like [@Sans].
    static Font getTangerine()
    Returns a Font already configured to use a variable-width script font, that should scale pretty well down, but not up.
    static Font getTangerineSDF()
    Returns a Font already configured to use a variable-width script font, that should scale pretty well down, but not up.
    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.
    static com.badlogic.gdx.graphics.g2d.TextureAtlas loadUnicodeAtlas​(com.badlogic.gdx.files.FileHandle packFile, com.badlogic.gdx.files.FileHandle imagesDir, boolean flip)
    This is exactly like TextureAtlas(FileHandle, FileHandle, boolean), except it jumps through some hoops to ensure the atlas is loaded with UTF-8 encoding.
    void pause()  
    void resume()  
    static void setAssetPrefix​(java.lang.String prefix)
    Changes the String prepended to each filename this looks up.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setAssetPrefix

      public static void setAssetPrefix​(java.lang.String prefix)
      Changes the String prepended to each filename this looks up. This should end in "/" if the files have the same name but are in a subdirectory (don't use backslashes for paths; they aren't cross-platform compatible). It can end without a "/" to prepend a String to the name of each file this looks up. The default prefix is "".
      Parameters:
      prefix - the new prefix to use before each filename, such as a subdirectory ending in "/"
    • getAStarry

      public static Font getAStarry()
      Returns a very large fixed-width Font already configured to use a square font with 45-degree angled sections, based on the typeface used on the Atari ST console. This font only supports ASCII, but it supports all of it. Caches the result for later calls. The font is "a-starry", based on "Atari ST (low-res)" by Damien Guard; it is available under a CC-BY-SA-3.0 license, which requires attribution to Damien Guard (and technically Tommy Ettinger, because he made changes in a-starry) if you use it.
      Preview: Image link (uses width=8, height=8)
      This also looks good if you scale it so its height is twice its width. For small sizes, you should stick to multiples of 8. This "A Starry Tall" version is present in getAll() and getAllStandard(). Preview: Image link (uses width=8, height=16)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font A Starry
    • getAStarryMSDF

      public static Font getAStarryMSDF()
      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. This font only supports ASCII, but it supports all of it. Caches the result for later calls. The font is "a-starry", based on "Atari ST (low-res)" by Damien Guard; it is available under a CC-BY-SA-3.0 license, which requires attribution to Damien Guard (and technically Tommy Ettinger, because he made changes in a-starry) if you use it. This uses the Multi-channel Signed Distance Field (MSDF) technique as opposed to the normal Signed Distance Field technique, which gives the rendered font sharper edges and precise corners instead of rounded tips on strokes.
      If you only need sizes in small integer multiples of 8 pixels, you might get sharper-looking results from getAStarry().
      Preview: Image link (uses width=10, height=10)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font A Starry using MSDF
    • getBitter

      public static Font getBitter()
      Returns a Font already configured to use a light-weight variable-width slab serif font with good Latin and Cyrillic script support, that should scale pretty well from a height of about 160 down to a height of maybe 30. Caches the result for later calls. The font used is Bitter, a free (OFL) typeface by The Bitter Project. It supports quite a lot of Latin-based scripts and Cyrillic, but does not really cover Greek or any other scripts. This font can look good at its natural size, which uses width roughly equal to height, or squashed so height is slightly smaller. Bitter looks very similar to getGentium(), except that Bitter is quite a bit lighter, with thinner strokes and stylistic flourishes on some glyphs. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect. Unlike most other fonts here, this does not use makeGridGlyphs, because it would make underline and strikethrough much thicker than other strokes in the font. This does mean that strikethrough starts too far to the left, and extends too far to the right, unfortunately, but its weight matches.
      Preview: Image link (uses width=33, height=30)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Bitter-Light.ttf
    • getCanada

      public 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. Caches the result for later calls. The font used is Canada1500, a free (public domain, via CC0) typeface by Ray Larabie. It supports quite a lot of Latin-based scripts, Greek, Cyrillic, Canadian Aboriginal Syllabic, arrows, many dingbats, and more. This font can look good at its natural size, which uses width roughly equal to height, or narrowed down so width is smaller. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=30, height=35)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Canada1500.ttf
    • getCascadiaMono

      public 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 well from a height of about 60 pixels to about 15 pixels. Caches the result for later calls. The font used is Cascadia Code Mono, an open-source (SIL Open Font License) typeface by Microsoft (see Microsoft's page). It supports a lot of glyphs, including most extended Latin, Greek, Braille, and Cyrillic. This uses a fairly-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=10, height=20)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Cascadia Code Mono
    • getCascadiaMonoMSDF

      public static Font getCascadiaMonoMSDF()
      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). Caches the result for later calls. The font used is Cascadia Code Mono, an open-source (SIL Open Font License) typeface by Microsoft (see Microsoft's page). It supports a lot of glyphs, including most extended Latin, Greek, Braille, and Cyrillic. This uses the Multi-channel Signed Distance Field (MSDF) technique as opposed to the normal Signed Distance Field technique, which gives the rendered font sharper edges and precise corners instead of rounded tips on strokes.
      Preview: Image link (uses width=9, height=16)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Cascadia Code Mono using MSDF
    • getCaveat

      public static Font getCaveat()
      Returns a Font already configured to use a variable-width handwriting font with support for extended Latin and Cyrillic, that should scale pretty well from a height of about 160 down to a height of maybe 20. It will look sharper and more aliased at smaller sizes, but should be relatively smooth at a height of 32 or so. This is a sort of natural handwriting, as opposed to the formal script in getTangerine(). Caches the result for later calls. The font used is Caveat, a free (OFL) typeface designed by Pablo Impallari. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=32, height=32)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Caveat.ttf
    • getCozette

      public static Font getCozette()
      Returns a Font configured to use a cozy fixed-width bitmap font, Cozette by slavfox. Cozette has broad coverage of Unicode, including Greek, Cyrillic, Braille, and tech-related icons. This does not scale well except to integer multiples, but it should look very crisp at its default size of 7x13 pixels. This defaults to having Font.integerPosition set to true, which helps keep it pixel-perfect if 1 world unit is 1 pixel, but can cause major visual issues if 1 world unit corresponds to much more than 1 pixel. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=7, height=13, useIntegerPositions(true); this size is small enough to make the scaled text unreadable in some places)
      Needs files:
      Returns:
      the Font object that represents the 7x13px font Cozette
    • getDejaVuSansMono

      public 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. It really does handle a lot of glyphs; not only does this have practically all Latin glyphs in Unicode (enough to support everything from Icelandic to Vietnamese), it has Greek (including Extended), Cyrillic (including some optional glyphs), IPA, Armenian (maybe the only font here to do so), Georgian (which won't be treated correctly by some case-insensitive code, so it should only be used if case doesn't matter), and Lao. It has full box drawing and Braille support, handles a wide variety of math symbols, technical marks, and dingbats, etc. This uses the Multi-channel Signed Distance Field (MSDF) technique as opposed to the normal Signed Distance Field technique, which gives the rendered font sharper edges and precise corners instead of rounded tips on strokes.
      Preview: Image link (uses width=9, height=20)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font DejaVu Sans Mono using MSDF
    • getGentium

      public 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. Caches the result for later calls. The font used is Gentium, an open-source (SIL Open Font License) typeface by SIL (see SIL's page on Gentium here). 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.
      Preview: Image link (uses width=31, height=35)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Gentium.ttf
    • getGentiumSDF

      public 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). You usually will want to reduce the line height of this Font after you scale it; using 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 SIL's page on Gentium here). 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.
      Preview: Image link (uses width=50, height=45, adjustLineHeight(0.625f))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Gentium.ttf using SDF
    • getHanazono

      public static Font getHanazono()
      Returns a Font already configured to use a variable-width, narrow font with nearly-complete CJK character coverage, plus Latin, Greek, and Cyrillic, that shouldm scale pretty well down, but not up. Caches the result for later calls. The font used is Hanazono (HanMinA, specifically), a free (OFL) typeface. This uses a somewhat-small standard bitmap font because of how many glyphs are present (over 34000); it might not scale as well as other standard bitmap fonts here. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=16, height=20)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font HanMinA.ttf
    • getIBM8x16

      public 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. This font is notably loaded from a SadConsole format file, which shouldn't affect how it looks (but in reality, it might). This does not scale except to integer multiples, but it should look very crisp at its default size of 8x16 pixels. This supports some extra characters, but not at the typical Unicode codepoints. This may work well in a font family with other fonts that do not use a distance field effect.
      This does not include a license because the source, SadConsole's fonts, did not include one. It is doubtful that IBM would have any issues with respectful use of their signature font throughout the 1980s, but if the legality is concerning, you can use getCozette() or quanPixel for a different bitmap font. There is also getAStarry() for a non-pixel font styled after a font from the same era.
      Preview: Image link (uses width=8, height=16)
      Needs files:
      Returns:
      the Font object that represents an 8x16 font included with early IBM computers
    • getInconsolata

      public 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). The original font Inconsolata is by Raph Levien, and various other contributors added support for other languages. This does not use a distance field effect, as opposed to getInconsolataMSDF(). This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=10, height=26)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Inconsolata LGC Custom
    • getInconsolataMSDF

      public 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). The original font Inconsolata is by Raph Levien, and various other contributors added support for other languages. This uses the Multi-channel Signed Distance Field (MSDF) technique as opposed to the normal Signed Distance Field technique, which gives the rendered font sharper edges and precise corners instead of rounded tips on strokes.
      Preview: Image link (uses width=10, height=26)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Inconsolata LGC Custom using MSDF
    • getIosevka

      public 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. Does not use a distance field effect, and is sized best at 9x25 pixels. Caches the result for later calls. The font used is Iosevka, an open-source (SIL Open Font License) typeface by Belleve Invis, and it uses several customizations thanks to Iosevka's special build process. It supports a lot of glyphs, including quite a bit of extended Latin, Greek, and Cyrillic. This Font is already configured with Font.fitCell(float, float, boolean), and repeated calls to fitCell() have an unknown effect; you may want to stick to scaling this and not re-fitting if you encounter issues. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses .scaleTo(10, 24).fitCell(10, 24, false))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Iosevka.ttf
    • getIosevkaMSDF

      public 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). Caches the result for later calls. The font used is Iosevka, an open-source (SIL Open Font License) typeface by Belleve Invis, and it uses several customizations thanks to Iosevka's special build process. It supports a lot of glyphs, including quite a bit of extended Latin, Greek, and Cyrillic. This Font is already configured with Font.fitCell(float, float, boolean), and repeated calls to fitCell() have an unknown effect; you may want to stick to scaling this and not re-fitting if you encounter issues. This uses the Multi-channel Signed Distance Field (MSDF) technique as opposed to the normal Signed Distance Field technique, which gives the rendered font sharper edges and precise corners instead of rounded tips on strokes. However, using a distance field makes it effectively impossible to mix fonts using a FontFamily (any variation in distance field settings would make some fonts in the family blurry and others too sharp).
      Preview: Image link (uses .scaleTo(12, 26).fitCell(10, 25, false))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Iosevka.ttf using MSDF
    • getIosevkaSDF

      public 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). Caches the result for later calls. The font used is Iosevka, an open-source (SIL Open Font License) typeface by Belleve Invis, and it uses several customizations thanks to Iosevka's special build process. It supports a lot of glyphs, including quite a bit of extended Latin, Greek, and Cyrillic. This Font is already configured with Font.fitCell(float, float, boolean), and repeated calls to fitCell() have an unknown effect; you may want to stick to scaling this and not re-fitting if you encounter issues. This uses the Signed Distance Field (SDF) technique as opposed to the Multi-channel Signed Distance Field technique that getIosevkaMSDF() uses, which isn't as sharp at large sizes but can look a little better at small sizes. However, using a distance field makes it effectively impossible to mix fonts using a FontFamily (any variation in distance field settings would make some fonts in the family blurry and others too sharp).
      Preview: Image link (uses .scaleTo(12, 26).fitCell(10, 25, false))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Iosevka.ttf using SDF
    • getIosevkaSlab

      public 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. Does not use a distance field effect, and is sized best at 9x25 pixels. Caches the result for later calls. The font used is Iosevka with Slab style, an open-source (SIL Open Font License) typeface by Belleve Invis, and it uses several customizations thanks to Iosevka's special build process. It supports a lot of glyphs, including quite a bit of extended Latin, Greek, and Cyrillic. This Font is already configured with Font.fitCell(float, float, boolean), and repeated calls to fitCell() have an unknown effect; you may want to stick to scaling this and not re-fitting if you encounter issues. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses .scaleTo(10, 24).fitCell(10, 24, false))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Iosevka-Slab.ttf
    • getIosevkaSlabMSDF

      public 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). Caches the result for later calls. The font used is Iosevka with Slab style, an open-source (SIL Open Font License) typeface by Belleve Invis, and it uses several customizations thanks to Iosevka's special build process. It supports a lot of glyphs, including quite a bit of extended Latin, Greek, and Cyrillic. This Font is already configured with Font.fitCell(float, float, boolean), and repeated calls to fitCell() have an unknown effect; you may want to stick to scaling this and not re-fitting if you encounter issues. This uses the Multi-channel Signed Distance Field (MSDF) technique as opposed to the normal Signed Distance Field technique, which gives the rendered font sharper edges and precise corners instead of rounded tips on strokes.
      Preview: Image link (uses .scaleTo(12, 26).fitCell(10, 25, false))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Iosevka-Slab.ttf using MSDF
    • getIosevkaSlabSDF

      public 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). Caches the result for later calls. The font used is Iosevka with Slab style, an open-source (SIL Open Font License) typeface by Belleve Invis, and it uses several customizations thanks to Iosevka's special build process. It supports a lot of glyphs, including quite a bit of extended Latin, Greek, and Cyrillic. This Font is already configured with Font.fitCell(float, float, boolean), and repeated calls to fitCell() have an unknown effect; you may want to stick to scaling this and not re-fitting if you encounter issues. This uses the Signed Distance Field (SDF) technique as opposed to the Multi-channel Signed Distance Field technique that getIosevkaSlabMSDF() uses, which isn't as sharp at large sizes but can look a little better at small sizes.
      Preview: Image link (uses scaleTo(12, 26).fitCell(10, 25, false))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Iosevka-Slab.ttf using SDF
    • getKingthingsFoundation

      public 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. Caches the result for later calls. The font used is Kingthings Foundation, a free (custom permissive license) typeface; this has faux-bold applied already in order to make some ornamental curls visible at more sizes. You can still apply bold again using markup. It supports only ASCII. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses scaleTo(23, 30).adjustLineHeight(1.125f))
      Needs files: You may instead want the non-bold version, but this doesn't have a pre-made instance in KnownFonts:
      Returns:
      the Font object that can represent many sizes of the font KingthingsFoundation.ttf
    • getLibertinusSerif

      public static Font getLibertinusSerif()
      Returns a Font already configured to use a variable-width serif font with good Unicode support, that should scale cleanly to fairly large sizes or down to about 20 pixels. Caches the result for later calls. The font used is Libertinus Serif, an open-source (SIL Open Font License) typeface. It supports a lot of glyphs, including quite a bit of extended Latin, Greek, and Cyrillic. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect. Earlier versions of this font used an MSDF effect, but that doesn't work well with kerning, so the spacing between letters was odd, and in general the font just didn't look as good as the similar getGentiumSDF() or even getGentium(). The MSDF files are still present in the same directory where they were, but they are no longer used by TextraTypist.
      Preview: Image link (uses width=40, height=34)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font LibertinusSerif.ttf
    • getOpenSans

      public static Font getOpenSans()
      Returns a Font configured to use a clean variable-width font, Open Sans. It has good extended-Latin coverage, but does not support Greek, Cyrillic, or other scripts. This makes an especially large font by default, but can be scaled down nicely. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=20, height=28, adjustLineHeight(0.9f))
      Needs files:
      Returns:
      the Font object that represents the variable-width font OpenSans
    • getOxanium

      public 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. Caches the result for later calls. The font used is Oxanium, a free (OFL) typeface. It supports a lot of Latin and extended Latin, but not Greek or Cyrillic. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=31, height=35)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Oxanium.ttf
    • getQuanPixel

      public static Font getQuanPixel()
      Returns a Font configured to use a small variable-width bitmap font with extensive coverage of Asian scripts, QuanPixel. QuanPixel has good coverage of Unicode, including all of Greek, at least most of Cyrillic, a good amount of extended Latin, all of Katakana and Hiragana, many Hangul syllables, and literally thousands of CJK ideograms. This does not scale well except to integer multiples, but it should look very crisp at its default size of about 8 pixels tall with variable width. This defaults to having Font.integerPosition set to true, which helps keep it pixel-perfect if 1 world unit is 1 pixel, but can cause major visual issues if 1 world unit corresponds to much more than 1 pixel. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=(not set), height=8, useIntegerPositions(true); this size is small enough to make the scaled text unreadable in some places)
      Needs files:
      Returns:
      the Font object that represents the 8px tall font QuanPixel
    • getRobotoCondensed

      public 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. Caches the result for later calls. The font used is Roboto Condensed, a free (Apache 2.0) typeface by Christian Robertson. It supports Latin-based scripts almost entirely, plus Greek, (extended) Cyrillic, and more. This font is meant to be condensed in its natural appearance, but can be scaled to be wider if desired. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=25, height=30, adjustLineHeight(0.9f))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font RobotoCondensed.ttf
    • getTangerine

      public static Font getTangerine()
      Returns a Font already configured to use a variable-width script font, that should scale pretty well down, but not up. Caches the result for later calls. The font used is Tangerine, a free (OFL) typeface. It supports Latin only, with a little support for Western European languages, but not really anything else. It looks elegant, though. This uses a very-large standard bitmap font, which lets it be scaled down OK but not scaled up very well. Some sizes may look very sharply-aliased with this version of Tangerine, but getTangerineSDF() doesn't seem to have that problem. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=48, height=32)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Tangerine.ttf
    • getTangerineSDF

      public static Font getTangerineSDF()
      Returns a Font already configured to use a variable-width script font, that should scale pretty well down, but not up. Caches the result for later calls. The font used is Tangerine, a free (OFL) typeface. It supports Latin only, with a little support for Western European languages, but not really anything else. It looks elegant, though. 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. If you need to mix in images such as with addEmoji(Font), you may be better off with getTangerine(), the standard-bitmap-font version.
      Preview: Image link (uses width=48, height=32, setCrispness(0.375f))
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font Tangerine.ttf
    • getYanoneKaffeesatz

      public 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. Caches the result for later calls. The font used is Yanone Kaffeesatz, a free (OFL) typeface. It supports a lot of Latin, Cyrillic, and some extended Latin, but not Greek. This uses a very-large standard bitmap font, which lets it be scaled down nicely but not scaled up very well. This may work well in a font family with other fonts that do not use a distance field effect.
      Preview: Image link (uses width=30, height=35)
      Needs files:
      Returns:
      the Font object that can represent many sizes of the font YanoneKaffeesatz.ttf
    • loadUnicodeAtlas

      public static com.badlogic.gdx.graphics.g2d.TextureAtlas loadUnicodeAtlas​(com.badlogic.gdx.files.FileHandle packFile, com.badlogic.gdx.files.FileHandle imagesDir, boolean flip)
      This is exactly like TextureAtlas(FileHandle, FileHandle, boolean), except it jumps through some hoops to ensure the atlas is loaded with UTF-8 encoding. Loading an atlas that uses Unicode names for its TextureRegions can have those names be unusable if TextureAtlas' normal default platform encoding is used; this primarily affects Java versions before 18 where the JVM flag -Dfile.encoding=UTF-8 was missing when a JAR is launched.
      Parameters:
      packFile - the FileHandle for the atlas file
      imagesDir - the FileHandle for the folder that holds the images used by the atlas file
      flip - If true, all regions loaded will be flipped for use with a perspective where 0,0 is the upper left corner.
      Returns:
      a new TextureAtlas loaded from the given files.
    • addEmoji

      public static Font addEmoji​(Font changing)
      Takes a Font and adds the Twemoji icon set to it, making the glyphs available using [+name] syntax. You can use the name of an emoji, such as [+clown face], or equivalently use the actual emoji, such as [+🤡], with the latter preferred because the names can be unwieldy or hard to get right. This caches the Twemoji atlas for later calls. This tries to load the files "Twemoji.atlas" and "Twemoji.png" from the internal storage first, and if that fails, it tries to load them from local storage in the current working directory.
      Preview: Image link (uses the font getYanoneKaffeesatz())
      Needs files:
      Parameters:
      changing - a Font that will have over 3000 emoji added to it, with more aliases
      Returns:
      changing, after the emoji atlas has been added
    • pause

      public void pause()
      Specified by:
      pause in interface com.badlogic.gdx.LifecycleListener
    • resume

      public void resume()
      Specified by:
      resume in interface com.badlogic.gdx.LifecycleListener
    • getAll

      public static Font[] getAll()
      Returns a new array of Font instances, calling each getXyz() method in this class that returns any Font. This will only function at all if all the assets (for every known Font) are present and load-able. You should store the result of this method, rather than calling it often, because each call copies many Fonts.
      Returns:
      a new array containing all Font instances this knows
    • getAllStandard

      public static Font[] getAllStandard()
      Returns a new array of Font instances, calling each getXyz() method in this class that returns any non-distance-field Font. This will only function at all if all the assets (for every known standard Font) are present and load-able. You should store the result of this method, rather than calling it often, because each call copies many Fonts.
      Returns:
      a new array containing all non-distance-field Font instances this knows
    • getStandardFamily

      public static Font getStandardFamily()
      Returns a Font (getGentium()) with a FontFamily configured so that all non-distance-field Fonts can be used with syntax like [@Sans]. The names this supports can be accessed with code using getStandardFamily().family.fontAliases.keys(). These names so far are: You can also always use the full name of one of these fonts, which can be obtained using Font.getName(). Serif, which is getGentium(), will always be the default font used after a reset. For backwards compatibility, Bitter is an alias for getGentium() (not getBitter()), because Bitter and Gentium look very similar and because a slot was needed for Handwriting, which seemed useful in more situations.
      This will only function at all if all the assets (for every known standard Font) are present and load-able. You should store the result of this method, rather than calling it often, because each call copies many Fonts.
      Returns:
      a Font that can switch between 15 different Fonts in its FontFamily, to any non-distance-field Font this knows
    • getAllSDF

      public static Font[] getAllSDF()
      Returns a new array of Font instances, calling each getXyz() method in this class that returns any SDF Font. This will only function at all if all the assets (for every known SDF Font) are present and load-able. You should store the result of this method, rather than calling it often, because each call copies 4 Fonts.
      Returns:
      a new array containing all SDF Font instances this knows
    • getAllMSDF

      public static Font[] getAllMSDF()
      Returns a new array of Font instances, calling each getXyz() method in this class that returns any MSDF Font. This will only function at all if all the assets (for every known MSDF Font) are present and load-able. You should store the result of this method, rather than calling it often, because each call copies 6 Fonts.
      Returns:
      a new array containing all MSDF Font instances this knows
    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.LifecycleListener