Package com.github.tommyettinger.textra
Enum Class Justify
- All Implemented Interfaces:
Serializable,Comparable<Justify>,Constable
Determines line justification behavior in a Layout.
Besides
The simplest behavior is that of
The other constants cause Lines to justify only spaces.
NONE, which makes no changes, each constant applies justification to some glyphs on a typical
Line.
The simplest behavior is that of
FULL_ON_ALL_LINES; it adds extra space to every glyph so the text fills
all the way to the right edge. FULL_ON_PARAGRAPH acts the same except on the last Line (or only Line)
of a paragraph; it will not justify the last line at all.
The other constants cause Lines to justify only spaces.
SPACES_ON_ALL_LINES and SPACES_ON_PARAGRAPH
only increase the width of the ASCII space character ' ', or decimal 32, hex 0020, and so on. "ALL_LINES"
affects all Lines, while "PARAGRAPH" doesn't affect the last (or only) Line.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAdds extra x-advance to every glyph so the text fills all the way to the right edge.Adds extra space to every glyph so the text fills all the way to the right edge, except for the last Line (or only Line) of a paragraph.No justification will be applied; the x-advances of glyphs will not be changed.Adds extra x-advance to every space (the char' ') so the text fills all the way to the right edge.Adds extra x-advance to every space (the char' ') so the text fills all the way to the right edge, except for the last Line (or only Line) of a paragraph. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanfinal booleanfinal boolean -
Method Summary
Modifier and TypeMethodDescriptionstatic JustifyfromGdx(com.badlogic.gdx.utils.Justify gdx) Attempts to convert between a libGDX Justify enum and a TextraTypist Justify enum.static com.badlogic.gdx.utils.JustifyConverts between a TextraTypist Justify enum and a libGDX Justify enum.static JustifyReturns the enum constant of this class with the specified name.static Justify[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
No justification will be applied; the x-advances of glyphs will not be changed. -
SPACES_ON_ALL_LINES
Adds extra x-advance to every space (the char' ') so the text fills all the way to the right edge. -
FULL_ON_ALL_LINES
Adds extra x-advance to every glyph so the text fills all the way to the right edge. -
SPACES_ON_PARAGRAPH
Adds extra x-advance to every space (the char' ') so the text fills all the way to the right edge, except for the last Line (or only Line) of a paragraph. -
FULL_ON_PARAGRAPH
Adds extra space to every glyph so the text fills all the way to the right edge, except for the last Line (or only Line) of a paragraph.
-
-
Field Details
-
ignoreLastLine
public final boolean ignoreLastLine -
affectSpaces
public final boolean affectSpaces -
affectAllGlyphs
public final boolean affectAllGlyphs
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
fromGdx
Attempts to convert between a libGDX Justify enum and a TextraTypist Justify enum. Currently, TextraTypist doesn't distinguish wrapped lines from unwrapped ones, though it could in the future. The libGDX constantsJustify.WrappedLinesBySpaceis matched toSPACES_ON_PARAGRAPHhere, andJustify.WrappedLinesByGlyphis matched toFULL_ON_PARAGRAPH.- Parameters:
gdx- a Justify enum from recent libGDX versions- Returns:
- the closest TextraTypist Justify enum there is to the given libGDX Justify enum
-
toGdx
Converts between a TextraTypist Justify enum and a libGDX Justify enum. This matches the five possible enum constants here to direct analogs in libGDX, and cannot returnJustify.WrappedLinesByGlyphorJustify.WrappedLinesBySpace.- Parameters:
textra- a Justify enum from TextraTypist- Returns:
- the closest Justify enum from libGDX to the given TextraTypist Justify enum
-