Package squidpony.squidgrid.gui.gdx
Class TextFamily
java.lang.Object
squidpony.squidgrid.gui.gdx.TextCellFactory
squidpony.squidgrid.gui.gdx.TextFamily
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
public class TextFamily extends TextCellFactory
A variant of
You may want to use
Created by Tommy Ettinger on 10/26/2017.
TextCellFactory
that allows switching between regular, bold, italic, and bold italic styles.
It adds only one field to TextCellFactory, and is interchangeable except that (potentially importantly) it does not
correctly render chars above '\\u3fff'
due to using some of the bits that normally represent late-in-Unicode
character codes to instead represent bold and italic modes. Two TextFamily values are present in DefaultResources,
DefaultResources.getLeanFamily()
and DefaultResources.getSlabFamily()
; using them is currently the
recommended way to use this class.
You may want to use
GDXMarkup.colorString(CharSequence)
to produce an IColoredString
that contains the specially-altered chars that store bold and italic mode data.
Created by Tommy Ettinger on 10/26/2017.
-
Nested Class Summary
Nested classes/interfaces inherited from class squidpony.squidgrid.gui.gdx.TextCellFactory
TextCellFactory.Glyph
-
Field Summary
Fields Modifier and Type Field Description static int
BOLD
static int
BOLD_ITALIC
static int
ITALIC
static int
REGULAR
Fields inherited from class squidpony.squidgrid.gui.gdx.TextCellFactory
actualCellHeight, actualCellWidth, assetManager, block, bmpFont, bottomPadding, DEFAULT_FITTING, descent, directionGlyph, dirMarker, distanceField, distanceFieldScaleX, distanceFieldScaleY, fitting, glyphTextures, height, initialized, initializedByFont, initializedBySize, leftPadding, lineHeight, msdf, mut, rightPadding, scc, shader, smoothingMultiplier, SQUID_FITTING, style, swap, topPadding, width
-
Constructor Summary
Constructors Constructor Description TextFamily()
Creates a default valued factory.TextFamily(com.badlogic.gdx.assets.AssetManager assetManager)
A default valued factory that uses the givenAssetManager
to load the font file. -
Method Summary
Modifier and Type Method Description TextFamily
copy()
TextFamily
defaultFamilyLeanDistance()
TextFamily
defaultFamilySlabDistance()
int
supportedStyles()
How many styles are supported by this TextCellFactory; always 4 in TextFamily.Methods inherited from class squidpony.squidgrid.gui.gdx.TextCellFactory
addFit, addSwap, addSwap, addSwaps, antialias, antialias, bottomPadding, bottomPadding, clearSwaps, configureShader, defaultDistanceFieldFont, defaultFont, defaultNarrowDistanceFieldFont, defaultNarrowFont, defaultSquareFont, dispose, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, fit, fit, font, font, font, fontDistanceField, fontMultiDistanceField, getAllSwaps, getDescent, getDirectionGlyph, getDistanceFieldScaleX, getDistanceFieldScaleY, getSmoothingMultiplier, getSolid, glyph, glyph, height, height, includedFont, initByFont, initBySize, initialized, initVerbatim, isDistanceField, isMultiDistanceField, leftPadding, leftPadding, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeActor, makeDirectionMarker, makeDirectionMarker, makeGlyphImage, makeGlyphImage, makeGlyphImage, makeWrappingString, padding, removeSwap, removeSwap, resetSize, resetSize, rightPadding, rightPadding, setAllSwaps, setColorCenter, setDirectionGlyph, setSmoothingMultiplier, setStyle, topPadding, topPadding, tweakHeight, tweakWidth, width, width, willFit
-
Field Details
-
REGULAR
- See Also:
- Constant Field Values
-
BOLD
- See Also:
- Constant Field Values
-
ITALIC
- See Also:
- Constant Field Values
-
BOLD_ITALIC
- See Also:
- Constant Field Values
-
-
Constructor Details
-
TextFamily
public TextFamily()Creates a default valued factory. One of the initialization methods must be called before this factory can be used! -
TextFamily
A default valued factory that uses the givenAssetManager
to load the font file. Use this constructor if you are likely to load the same font over and over (recall that, without anAssetManager
, each instance ofTextCellFactory
will load its font from disk). This primarily matters if you are using fonts not bundled with SquidLib, since accessing a BitmapFont with a method (not a String) from DefaultResources caches the BitmapFont already.- Parameters:
assetManager
- an ordinary libGDX AssetManager
-
-
Method Details
-
supportedStyles
How many styles are supported by this TextCellFactory; always 4 in TextFamily.- Overrides:
supportedStyles
in classTextCellFactory
-
copy
- Overrides:
copy
in classTextCellFactory
-
defaultFamilyLeanDistance
-
defaultFamilySlabDistance
-