Package com.teamten.typeset.element
Class Discretionary
java.lang.Object
com.teamten.typeset.element.Element
com.teamten.typeset.element.NonDiscardableElement
com.teamten.typeset.element.Discretionary
- All Implemented Interfaces:
Dimensions
Represents a discretionary line break, storing both the split and unsplit versions of the text.
-
Field Summary
FieldsFields inherited from class com.teamten.typeset.element.Element
DRAW_DEBUG
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
long
getDepth()
Return the depth (below the baseline) of the element.long
Return the height (above the baseline) of the element.int
long
getWidth()
Return the width of the element.int
hashCode()
long
layOutHorizontally
(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a horizontal sequence.long
layOutVertically
(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a vertical sequence.void
println
(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.Element
getVerticalSize, println, shouldSkipElementAtStart, toTextString, visit
-
Field Details
-
HYPHEN_PENALTY
public static final int HYPHEN_PENALTY- See Also:
-
-
Constructor Details
-
Discretionary
-
-
Method Details
-
getPreBreak
-
getPostBreak
-
getNoBreak
-
getPenalty
public int getPenalty() -
getWidth
public long getWidth()Description copied from class:Element
Return the width of the element.- Specified by:
getWidth
in interfaceDimensions
- Specified by:
getWidth
in classElement
-
getHeight
public long getHeight()Description copied from class:Element
Return the height (above the baseline) of the element.- Specified by:
getHeight
in interfaceDimensions
- Specified by:
getHeight
in classElement
-
getDepth
public long getDepth()Description copied from class:Element
Return the depth (below the baseline) of the element.- Specified by:
getDepth
in interfaceDimensions
- Specified by:
getDepth
in classElement
-
layOutHorizontally
public long layOutHorizontally(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Description copied from class:Element
Add the element to the contents as part of a horizontal sequence.- Specified by:
layOutHorizontally
in classElement
- 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:Element
Add the element to the contents as part of a vertical sequence.- Specified by:
layOutVertically
in classElement
- 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:Element
Pretty prints the element to the PrintWriter with the given indent. The method must print its own newline. -
toTextString
Description copied from class:Element
Return a text version of the element, ideally containing only the text of the element and its children.- Overrides:
toTextString
in classElement
-
toString
-
equals
-
hashCode
public int hashCode()
-