java.lang.Object
java.lang.Record
io.github.chkrishnatej.rp3200.Style
- Record Components:
bold- emphasised (bold) textunderline- underlined textinvert- white text on a black backgroundsize- character size, never null
Character style: bold, underline, reverse (white on black) and size.
Immutable; the with... methods return modified copies. Most code only needs the
builder's EscPosBuilder.bold(boolean) / EscPosBuilder.size(TextSize) methods.
This type is needed when passing styled Style.Segments to
EscPosBuilder.row(Columns, java.util.List), or to set everything at once with
EscPosBuilder.style(Style).
Style boldTall = Style.PLAIN.withBold(true).withSize(TextSize.TALL);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA run of text printed in one style - the building block of mixed-style table cells. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbold()Returns the value of theboldrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleaninvert()Returns the value of theinvertrecord component.size()Returns the value of thesizerecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theunderlinerecord component.withBold(boolean on) Returns a copy with bold switched on or off.withInvert(boolean on) Returns a copy with reverse printing (white on black) switched on or off.Returns a copy with another character size.withUnderline(boolean on) Returns a copy with underline switched on or off.
-
Field Details
-
PLAIN
Plain, normal-size text - the printer's power-on state.
-
-
Constructor Details
-
Style
Creates a style.- Parameters:
bold- emphasised (bold) textunderline- underlined textinvert- white text on a black backgroundsize- character size- Throws:
NullPointerException- ifsizeis null
-
-
Method Details
-
withBold
Returns a copy with bold switched on or off.- Parameters:
on-truefor bold- Returns:
- the modified copy
-
withUnderline
Returns a copy with underline switched on or off.- Parameters:
on-trueto underline- Returns:
- the modified copy
-
withInvert
Returns a copy with reverse printing (white on black) switched on or off.- Parameters:
on-truefor white on black- Returns:
- the modified copy
-
withSize
Returns a copy with another character size.- Parameters:
s- the new size- Returns:
- the modified copy
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
bold
public boolean bold()Returns the value of theboldrecord component.- Returns:
- the value of the
boldrecord component
-
underline
public boolean underline()Returns the value of theunderlinerecord component.- Returns:
- the value of the
underlinerecord component
-
invert
public boolean invert()Returns the value of theinvertrecord component.- Returns:
- the value of the
invertrecord component
-
size
Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-