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 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 a Text record class.
      Parameters:
      id - the value for the id record component
      layer - the value for the layer record component
      frame - the value for the frame record component
      value - the value for the value record component
      family - the value for the family record component
      sizePt - the value for the sizePt record component
      lineHeightPt - the value for the lineHeightPt record component
      bold - the value for the bold record component
      rgb - the value for the rgb record component
      align - the value for the align record component
      mode - the value for the mode record component
      letterSpacingPt - the value for the letterSpacingPt record 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

      public FixedDocument.Text withLetterSpacing(double spacingPt)
      Parameters:
      spacingPt - 相鄰字元間的額外距離(pt)
      Returns:
      只改字距的新文字框
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • id

      public String id()
      Returns the value of the id record component.
      Specified by:
      id in interface FixedDocument.Element
      Returns:
      the value of the id record component
    • layer

      public FixedDocument.Layer layer()
      Returns the value of the layer record component.
      Specified by:
      layer in interface FixedDocument.Element
      Returns:
      the value of the layer record component
    • frame

      public FixedDocument.Frame frame()
      Returns the value of the frame record component.
      Returns:
      the value of the frame record component
    • value

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

      public String family()
      Returns the value of the family record component.
      Returns:
      the value of the family record component
    • sizePt

      public double sizePt()
      Returns the value of the sizePt record component.
      Returns:
      the value of the sizePt record component
    • lineHeightPt

      public double lineHeightPt()
      Returns the value of the lineHeightPt record component.
      Returns:
      the value of the lineHeightPt record component
    • bold

      public boolean bold()
      Returns the value of the bold record component.
      Returns:
      the value of the bold record component
    • rgb

      public int rgb()
      Returns the value of the rgb record component.
      Returns:
      the value of the rgb record component
    • align

      public FixedDocument.Align align()
      Returns the value of the align record component.
      Returns:
      the value of the align record component
    • mode

      public FixedDocument.TextMode mode()
      Returns the value of the mode record component.
      Returns:
      the value of the mode record component
    • letterSpacingPt

      public double letterSpacingPt()
      Returns the value of the letterSpacingPt record component.
      Returns:
      the value of the letterSpacingPt record component