Package com.teamten.typeset.element
Class Text
java.lang.Object
com.teamten.typeset.element.Element
com.teamten.typeset.element.NonDiscardableElement
com.teamten.typeset.element.Box
com.teamten.typeset.element.Text
- All Implemented Interfaces:
Dimensions
A sequence of characters.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEncodes a character direction according to the Unicode standard. -
Field Summary
Fields inherited from class com.teamten.typeset.element.Element
DRAW_DEBUG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendedWith(Text other) Returns a new Text object, the text of which is the concatenation of this text and the other text.voidbreakUpInto(Collection<Element> list) Add one Text object for each character in this object.booleanWhether any character in the text is right-to-left.booleanReturn the character direction of the Text.@NotNull SizedFontgetFont()The font the text should be displayed in.@NotNull StringgetText()The text that this element was constructed with.inthashCode()booleanisCompatibleWith(Text other) Whether this text can be appended to the other text.longlayOutHorizontally(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a horizontal sequence.longlayOutVertically(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a vertical sequence.voidprintln(PrintStream stream, String indent) Pretty prints the element to the PrintWriter with the given indent.toString()Return a text version of the element, ideally containing only the text of the element and its children.Methods inherited from class com.teamten.typeset.element.Box
drawDebugRectangle, getDepth, getDimensionString, getHeight, getShift, getWidthMethods inherited from class com.teamten.typeset.element.Element
getVerticalSize, println, shouldSkipElementAtStart, toTextString, visit
-
Constructor Details
-
Method Details
-
getText
The text that this element was constructed with. -
getFont
The font the text should be displayed in. -
isCompatibleWith
Whether this text can be appended to the other text. -
containsRightToLeftText
public boolean containsRightToLeftText()Whether any character in the text is right-to-left. -
getCharacterDirection
Return the character direction of the Text. The Text must contain only a single direction throughout.- Throws:
IllegalStateException- if the Text contains more than one direction.
-
breakUpInto
Add one Text object for each character in this object. -
appendedWith
Returns a new Text object, the text of which is the concatenation of this text and the other text.- Throws:
IllegalArgumentException- if the two text objects are not compatible.
-
layOutHorizontally
public long layOutHorizontally(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Description copied from class:ElementAdd the element to the contents as part of a horizontal sequence.- Overrides:
layOutHorizontallyin classBox- Parameters:
x- the left-most point of the element.y- the baseline of the element.contents- the stream to add the element to.- Returns:
- how much to move right afterward.
- Throws:
IOException
-
layOutVertically
public long layOutVertically(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Description copied from class:ElementAdd the element to the contents as part of a vertical sequence.- Overrides:
layOutVerticallyin classBox- Parameters:
x- the left-most point of the element.y- the upper-left point of the element.contents- the stream to add the element to.- Returns:
- how much to move down afterward.
- Throws:
IOException
-
println
Description copied from class:ElementPretty prints the element to the PrintWriter with the given indent. The method must print its own newline. -
toString
-
toTextString
Description copied from class:ElementReturn a text version of the element, ideally containing only the text of the element and its children.- Overrides:
toTextStringin classElement
-
equals
-
hashCode
public int hashCode()
-