Record Class TextStyle
java.lang.Object
java.lang.Record
io.leandev.appfuse.report.node.TextStyle
- Record Components:
fontFamily- 邏輯字型家族名稱(例如"sans"),對應的字型檔由 renderer 決定size- 字級weight- 字重italic- 是否斜體color- 文字顏色
public record TextStyle(String fontFamily, Length size, FontWeight weight, Boolean italic, ReportColor color)
extends Record
文字樣式覆寫值
每個欄位為 null 時繼承上一層;FontWeight.REGULAR、Boolean.FALSE 等是明確覆寫。
本 record 沒有預設值,完整樣式由 DocumentStyles 提供。
TextStyle emphasis = TextStyle.inherit().withWeight(FontWeight.BOLD); // 只改粗體,其餘沿用
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionTextStyle(String fontFamily, Length size, FontWeight weight, Boolean italic, ReportColor color) Creates an instance of aTextStylerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncolor()Returns the value of thecolorrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefontFamilyrecord component.final inthashCode()Returns a hash code value for this object.static TextStyleinherit()全部欄位繼承的空覆寫italic()Returns the value of theitalicrecord component.以override的非null欄位覆寫本樣式size()Returns the value of thesizerecord component.final StringtoString()Returns a string representation of this record class.weight()Returns the value of theweightrecord component.withColor(ReportColor color) withFontFamily(String fontFamily) withItalic(Boolean italic) withWeight(FontWeight weight)
-
Constructor Details
-
TextStyle
public TextStyle(String fontFamily, Length size, FontWeight weight, Boolean italic, ReportColor color) Creates an instance of aTextStylerecord class.- Parameters:
fontFamily- the value for thefontFamilyrecord componentsize- the value for thesizerecord componentweight- the value for theweightrecord componentitalic- the value for theitalicrecord componentcolor- the value for thecolorrecord component
-
-
Method Details
-
inherit
-
withFontFamily
-
withSize
-
withWeight
-
withItalic
-
withColor
-
overlay
-
toString
-
hashCode
-
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
-
size
-
weight
-
italic
-
color
-