Record Class Style
java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.model.style.Style
- Record Components:
fontFamily- built-in or registered family name, or null to inheritfontSizePt- font size in points (1/72 inch), or null to inheritcolor- six-digit hexadecimal RGB text color, or null to inheritbold- bold flag, or null to inherititalic- italic flag, or null to inheritunderline- underline flag, or null to inherittextAlign- horizontal paragraph alignment, or null to inheritlineHeight- dimensionless multiplier of font size, or null to inheritspaceBeforeMm- spacing before the block in millimeters, or null to inheritspaceAfterMm- spacing after the block in millimeters, or null to inheritkeepTogether- page keep for this block, or null for its ordinary policykeepWithNext- page keep with the next block, or null for its ordinary policywidows- minimum trailing paragraph lines on a page, positive or nullorphans- minimum opening paragraph lines on a page, positive or nullstyleName- optional reference to a named style in the document themebaseStyle- optional lower-priority layer, resolved before the named style and local fields; retains the order of nested styles until document-local names can be resolved
public record Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm, Keep keepTogether, Keep keepWithNext, Integer widows, Integer orphans, String styleName, Style baseStyle)
extends Record
Immutable set of nullable typography and spacing overrides. Null means inherit that property; an
explicit false disables an inherited boolean flag. During rendering, built-in text defaults are
overlaid by document, section, block, optional table-cell, and text-run styles in that order.
Fixed regions and signatures have no section style. A named reference selects per-document theme
overrides below this style's explicit properties.
Built-in text defaults are Helvetica, 11 pt (14 pt and bold for headings), black, left
alignment, a 1.2 line-height multiplier, and zero space before/after. The other flags are false.
plain() has no overrides and therefore preserves those or any inherited values; it does
not reset text to the built-in defaults.
Construction and builder methods do not validate values. Generation requires registered or
built-in font families and available bold/italic variants, positive finite font sizes and
line-height multipliers, finite nonnegative spacing, and colors in #RRGGBB form.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionStyle(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm) Creates typography/spacing overrides with no explicit pagination policy.Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm, Keep keepTogether, Keep keepWithNext, Integer widows, Integer orphans) Preserves the pagination-aware constructor without a named reference.Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm, Keep keepTogether, Keep keepWithNext, Integer widows, Integer orphans, String styleName) Creates ordinary overrides with an optional named reference and no retained lower layer.Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm, Keep keepTogether, Keep keepWithNext, Integer widows, Integer orphans, String styleName, Style baseStyle) Creates an instance of aStylerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebaseStylerecord component.bold()Returns the value of theboldrecord component.static Style.Builderbuilder()Starts a mutable builder with every override omitted.color()Returns the value of thecolorrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefontFamilyrecord component.Returns the value of thefontSizePtrecord component.final inthashCode()Returns a hash code value for this object.italic()Returns the value of theitalicrecord component.Returns the value of thekeepTogetherrecord component.Returns the value of thekeepWithNextrecord component.Returns the value of thelineHeightrecord component.orphans()Returns the value of theorphansrecord component.Combines these overrides with another style property by property.static Styleplain()Creates an empty set of overrides.Returns the value of thespaceAfterMmrecord component.Returns the value of thespaceBeforeMmrecord component.Returns the value of thestyleNamerecord component.Returns the value of thetextAlignrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theunderlinerecord component.widows()Returns the value of thewidowsrecord component.
-
Constructor Details
-
Style
public Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm, Keep keepTogether, Keep keepWithNext, Integer widows, Integer orphans, String styleName) Creates ordinary overrides with an optional named reference and no retained lower layer.- Parameters:
fontFamily- nullable font-family overridefontSizePt- nullable size in pointscolor- nullable RGB text colorbold- nullable weight overrideitalic- nullable slant overrideunderline- nullable underline overridetextAlign- nullable alignment overridelineHeight- nullable line-height multiplierspaceBeforeMm- nullable preceding spacingspaceAfterMm- nullable following spacingkeepTogether- nullable block keepkeepWithNext- nullable following-block keepwidows- nullable minimum trailing linesorphans- nullable minimum opening linesstyleName- nullable document-local named reference
-
Style
public Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm, Keep keepTogether, Keep keepWithNext, Integer widows, Integer orphans) Preserves the pagination-aware constructor without a named reference.- Parameters:
fontFamily- nullable font-family overridefontSizePt- nullable size in pointscolor- nullable RGB text colorbold- nullable weight overrideitalic- nullable slant overrideunderline- nullable underline overridetextAlign- nullable alignment overridelineHeight- nullable line-height multiplierspaceBeforeMm- nullable preceding spacing in millimetersspaceAfterMm- nullable following spacing in millimeterskeepTogether- nullable block keepkeepWithNext- nullable following-block keepwidows- nullable minimum trailing linesorphans- nullable minimum opening lines
-
Style
public Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm) Creates typography/spacing overrides with no explicit pagination policy.- Parameters:
fontFamily- nullable family overridefontSizePt- nullable font size in pointscolor- nullable six-digit RGB text colorbold- nullable weight overrideitalic- nullable slant overrideunderline- nullable underline overridetextAlign- nullable alignment overridelineHeight- nullable line-height multiplierspaceBeforeMm- nullable spacing before the block, in millimetersspaceAfterMm- nullable spacing after the block, in millimeters
-
Style
public Style(String fontFamily, Double fontSizePt, String color, Boolean bold, Boolean italic, Boolean underline, TextAlign textAlign, Double lineHeight, Double spaceBeforeMm, Double spaceAfterMm, Keep keepTogether, Keep keepWithNext, Integer widows, Integer orphans, String styleName, Style baseStyle) Creates an instance of aStylerecord class.- Parameters:
fontFamily- the value for thefontFamilyrecord componentfontSizePt- the value for thefontSizePtrecord componentcolor- the value for thecolorrecord componentbold- the value for theboldrecord componentitalic- the value for theitalicrecord componentunderline- the value for theunderlinerecord componenttextAlign- the value for thetextAlignrecord componentlineHeight- the value for thelineHeightrecord componentspaceBeforeMm- the value for thespaceBeforeMmrecord componentspaceAfterMm- the value for thespaceAfterMmrecord componentkeepTogether- the value for thekeepTogetherrecord componentkeepWithNext- the value for thekeepWithNextrecord componentwidows- the value for thewidowsrecord componentorphans- the value for theorphansrecord componentstyleName- the value for thestyleNamerecord componentbaseStyle- the value for thebaseStylerecord component
-
-
Method Details
-
plain
Creates an empty set of overrides. Every property is null and inherits its enclosing style or the renderer's defaults.- Returns:
- a style that leaves all inherited properties unchanged
-
builder
Starts a mutable builder with every override omitted.- Returns:
- a new independent style builder
-
overlay
Combines these overrides with another style property by property. Each nonnull value in the argument wins; its null values retain this style's values. Neither style is mutated. Unresolved names retain separate ordered layers so a child's named properties can override its parent's explicit values. Those layers are materialized during document preparation.- Parameters:
override- higher-priority style, or null to leave this style unchanged- Returns:
- combined overrides, or this instance when override is null
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
fontFamily
Returns the value of thefontFamilyrecord component.- Returns:
- the value of the
fontFamilyrecord component
-
fontSizePt
Returns the value of thefontSizePtrecord component.- Returns:
- the value of the
fontSizePtrecord component
-
color
Returns the value of thecolorrecord component.- Returns:
- the value of the
colorrecord component
-
bold
Returns the value of theboldrecord component.- Returns:
- the value of the
boldrecord component
-
italic
Returns the value of theitalicrecord component.- Returns:
- the value of the
italicrecord component
-
underline
Returns the value of theunderlinerecord component.- Returns:
- the value of the
underlinerecord component
-
textAlign
Returns the value of thetextAlignrecord component.- Returns:
- the value of the
textAlignrecord component
-
lineHeight
Returns the value of thelineHeightrecord component.- Returns:
- the value of the
lineHeightrecord component
-
spaceBeforeMm
Returns the value of thespaceBeforeMmrecord component.- Returns:
- the value of the
spaceBeforeMmrecord component
-
spaceAfterMm
Returns the value of thespaceAfterMmrecord component.- Returns:
- the value of the
spaceAfterMmrecord component
-
keepTogether
Returns the value of thekeepTogetherrecord component.- Returns:
- the value of the
keepTogetherrecord component
-
keepWithNext
Returns the value of thekeepWithNextrecord component.- Returns:
- the value of the
keepWithNextrecord component
-
widows
Returns the value of thewidowsrecord component.- Returns:
- the value of the
widowsrecord component
-
orphans
Returns the value of theorphansrecord component.- Returns:
- the value of the
orphansrecord component
-
styleName
Returns the value of thestyleNamerecord component.- Returns:
- the value of the
styleNamerecord component
-
baseStyle
Returns the value of thebaseStylerecord component.- Returns:
- the value of the
baseStylerecord component
-