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 inherit
fontSizePt - font size in points (1/72 inch), or null to inherit
color - six-digit hexadecimal RGB text color, or null to inherit
bold - bold flag, or null to inherit
italic - italic flag, or null to inherit
underline - underline flag, or null to inherit
textAlign - horizontal paragraph alignment, or null to inherit
lineHeight - dimensionless multiplier of font size, or null to inherit
spaceBeforeMm - spacing before the block in millimeters, or null to inherit
spaceAfterMm - spacing after the block in millimeters, or null to inherit
keepTogether - page keep for this block, or null for its ordinary policy
keepWithNext - page keep with the next block, or null for its ordinary policy
widows - minimum trailing paragraph lines on a page, positive or null
orphans - minimum opening paragraph lines on a page, positive or null
styleName - optional reference to a named style in the document theme
baseStyle - 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.

  • 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 override
      fontSizePt - nullable size in points
      color - nullable RGB text color
      bold - nullable weight override
      italic - nullable slant override
      underline - nullable underline override
      textAlign - nullable alignment override
      lineHeight - nullable line-height multiplier
      spaceBeforeMm - nullable preceding spacing
      spaceAfterMm - nullable following spacing
      keepTogether - nullable block keep
      keepWithNext - nullable following-block keep
      widows - nullable minimum trailing lines
      orphans - nullable minimum opening lines
      styleName - 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 override
      fontSizePt - nullable size in points
      color - nullable RGB text color
      bold - nullable weight override
      italic - nullable slant override
      underline - nullable underline override
      textAlign - nullable alignment override
      lineHeight - nullable line-height multiplier
      spaceBeforeMm - nullable preceding spacing in millimeters
      spaceAfterMm - nullable following spacing in millimeters
      keepTogether - nullable block keep
      keepWithNext - nullable following-block keep
      widows - nullable minimum trailing lines
      orphans - 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 override
      fontSizePt - nullable font size in points
      color - nullable six-digit RGB text color
      bold - nullable weight override
      italic - nullable slant override
      underline - nullable underline override
      textAlign - nullable alignment override
      lineHeight - nullable line-height multiplier
      spaceBeforeMm - nullable spacing before the block, in millimeters
      spaceAfterMm - 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 a Style record class.
      Parameters:
      fontFamily - the value for the fontFamily record component
      fontSizePt - the value for the fontSizePt record component
      color - the value for the color record component
      bold - the value for the bold record component
      italic - the value for the italic record component
      underline - the value for the underline record component
      textAlign - the value for the textAlign record component
      lineHeight - the value for the lineHeight record component
      spaceBeforeMm - the value for the spaceBeforeMm record component
      spaceAfterMm - the value for the spaceAfterMm record component
      keepTogether - the value for the keepTogether record component
      keepWithNext - the value for the keepWithNext record component
      widows - the value for the widows record component
      orphans - the value for the orphans record component
      styleName - the value for the styleName record component
      baseStyle - the value for the baseStyle record component
  • Method Details

    • plain

      public static Style 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

      public static Style.Builder builder()
      Starts a mutable builder with every override omitted.
      Returns:
      a new independent style builder
    • overlay

      public Style overlay(Style override)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fontFamily

      public String fontFamily()
      Returns the value of the fontFamily record component.
      Returns:
      the value of the fontFamily record component
    • fontSizePt

      public Double fontSizePt()
      Returns the value of the fontSizePt record component.
      Returns:
      the value of the fontSizePt record component
    • color

      public String color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • bold

      public Boolean bold()
      Returns the value of the bold record component.
      Returns:
      the value of the bold record component
    • italic

      public Boolean italic()
      Returns the value of the italic record component.
      Returns:
      the value of the italic record component
    • underline

      public Boolean underline()
      Returns the value of the underline record component.
      Returns:
      the value of the underline record component
    • textAlign

      public TextAlign textAlign()
      Returns the value of the textAlign record component.
      Returns:
      the value of the textAlign record component
    • lineHeight

      public Double lineHeight()
      Returns the value of the lineHeight record component.
      Returns:
      the value of the lineHeight record component
    • spaceBeforeMm

      public Double spaceBeforeMm()
      Returns the value of the spaceBeforeMm record component.
      Returns:
      the value of the spaceBeforeMm record component
    • spaceAfterMm

      public Double spaceAfterMm()
      Returns the value of the spaceAfterMm record component.
      Returns:
      the value of the spaceAfterMm record component
    • keepTogether

      public Keep keepTogether()
      Returns the value of the keepTogether record component.
      Returns:
      the value of the keepTogether record component
    • keepWithNext

      public Keep keepWithNext()
      Returns the value of the keepWithNext record component.
      Returns:
      the value of the keepWithNext record component
    • widows

      public Integer widows()
      Returns the value of the widows record component.
      Returns:
      the value of the widows record component
    • orphans

      public Integer orphans()
      Returns the value of the orphans record component.
      Returns:
      the value of the orphans record component
    • styleName

      public String styleName()
      Returns the value of the styleName record component.
      Returns:
      the value of the styleName record component
    • baseStyle

      public Style baseStyle()
      Returns the value of the baseStyle record component.
      Returns:
      the value of the baseStyle record component