Record Class FixedDocument.Text
java.lang.Object
java.lang.Record
io.leandev.appfuse.pdf.FixedDocument.Text
- All Implemented Interfaces:
FixedDocument.Element
- Enclosing class:
FixedDocument
public static record FixedDocument.Text(String id, FixedDocument.Layer layer, FixedDocument.Frame frame, String value, String family, double sizePt, double lineHeightPt, boolean bold, int rgb, FixedDocument.Align align, FixedDocument.TextMode mode, double letterSpacingPt)
extends Record
implements FixedDocument.Element
CRLF/CR 正規化為 LF,Tab 展開成四個空格(非 tab stop);其他控制字元拒絕。
lineHeightPt 為基線間距;使用整個文字框所用字型的最大 ascent/descent 檢查上下界,不以裁切掩蓋超框。
letterSpacingPt 為同一行相鄰 code point 之間額外加的距離(非負,預設 0);行尾不加,
對齊、換行與超框檢查都以含字距的寬度計算。不做字距微調(kerning)。
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionText(String id, FixedDocument.Layer layer, FixedDocument.Frame frame, String value, String family, double sizePt, double lineHeightPt, boolean bold, int rgb, FixedDocument.Align align, FixedDocument.TextMode mode) 保留既有建構器,字距為 0。Text(String id, FixedDocument.Layer layer, FixedDocument.Frame frame, String value, String family, double sizePt, double lineHeightPt, boolean bold, int rgb, FixedDocument.Align align, FixedDocument.TextMode mode, double letterSpacingPt) Creates an instance of aTextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionalign()Returns the value of thealignrecord component.booleanbold()Returns the value of theboldrecord component.final booleanIndicates whether some other object is "equal to" this one.family()Returns the value of thefamilyrecord component.frame()Returns the value of theframerecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.layer()Returns the value of thelayerrecord component.doubleReturns the value of theletterSpacingPtrecord component.doubleReturns the value of thelineHeightPtrecord component.mode()Returns the value of themoderecord component.intrgb()Returns the value of thergbrecord component.doublesizePt()Returns the value of thesizePtrecord component.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.withLetterSpacing(double spacingPt)
-
Constructor Details
-
Text
public Text(String id, FixedDocument.Layer layer, FixedDocument.Frame frame, String value, String family, double sizePt, double lineHeightPt, boolean bold, int rgb, FixedDocument.Align align, FixedDocument.TextMode mode, double letterSpacingPt) Creates an instance of aTextrecord class.- Parameters:
id- the value for theidrecord componentlayer- the value for thelayerrecord componentframe- the value for theframerecord componentvalue- the value for thevaluerecord componentfamily- the value for thefamilyrecord componentsizePt- the value for thesizePtrecord componentlineHeightPt- the value for thelineHeightPtrecord componentbold- the value for theboldrecord componentrgb- the value for thergbrecord componentalign- the value for thealignrecord componentmode- the value for themoderecord componentletterSpacingPt- the value for theletterSpacingPtrecord component
-
Text
public Text(String id, FixedDocument.Layer layer, FixedDocument.Frame frame, String value, String family, double sizePt, double lineHeightPt, boolean bold, int rgb, FixedDocument.Align align, FixedDocument.TextMode mode) 保留既有建構器,字距為 0。
-
-
Method Details
-
withLetterSpacing
- Parameters:
spacingPt- 相鄰字元間的額外距離(pt)- Returns:
- 只改字距的新文字框
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
Returns the value of theidrecord component.- Specified by:
idin interfaceFixedDocument.Element- Returns:
- the value of the
idrecord component
-
layer
Returns the value of thelayerrecord component.- Specified by:
layerin interfaceFixedDocument.Element- Returns:
- the value of the
layerrecord component
-
frame
Returns the value of theframerecord component.- Returns:
- the value of the
framerecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
family
Returns the value of thefamilyrecord component.- Returns:
- the value of the
familyrecord component
-
sizePt
public double sizePt()Returns the value of thesizePtrecord component.- Returns:
- the value of the
sizePtrecord component
-
lineHeightPt
public double lineHeightPt()Returns the value of thelineHeightPtrecord component.- Returns:
- the value of the
lineHeightPtrecord component
-
bold
public boolean bold()Returns the value of theboldrecord component.- Returns:
- the value of the
boldrecord component
-
rgb
public int rgb()Returns the value of thergbrecord component.- Returns:
- the value of the
rgbrecord component
-
align
Returns the value of thealignrecord component.- Returns:
- the value of the
alignrecord component
-
mode
Returns the value of themoderecord component.- Returns:
- the value of the
moderecord component
-
letterSpacingPt
public double letterSpacingPt()Returns the value of theletterSpacingPtrecord component.- Returns:
- the value of the
letterSpacingPtrecord component
-