public class SimpleTextLayout extends Object
All coordinates are in the same space as the text is being drawn (typically pixels).
Modifier and Type | Class and Description |
---|---|
static class |
SimpleTextLayout.TextBoundingBox
When drawing using the JOGL
TextRenderer , the SimpleTextLayout.TextBoundingBox.leftX and
SimpleTextLayout.TextBoundingBox.baselineY should be used as the text origin. |
Constructor and Description |
---|
SimpleTextLayout(Font font,
FontRenderContext frc) |
SimpleTextLayout(Font font,
FontRenderContext frc,
BreakIterator breaker) |
Modifier and Type | Method and Description |
---|---|
void |
doLayout(String text,
float leftX,
float topY,
float maxWidth)
Takes the text and performs the layout.
|
double |
getAscent() |
boolean |
getBreakOnEol()
Whether to force a break on the end of line characters (\r \f \n).
|
double |
getDescent() |
SimpleTextLayout.TextBoundingBox |
getLine(int line) |
double |
getLineHeight() |
List<SimpleTextLayout.TextBoundingBox> |
getLines() |
float |
getLineSpacing()
The spacing between the bottom (descent) of one line of text to the top
(ascent) of the next line.
|
String |
getSourceText() |
int |
numberOfLines() |
void |
setAscent(float ascent) |
void |
setBreakOnEol(boolean breakOnEol) |
void |
setLineSpacing(float lineSpacing) |
public SimpleTextLayout(Font font, FontRenderContext frc)
font
- The font to use for the layoutfrc
- The FontRenderContext used to rasterize the font. This will
help define the character boundspublic SimpleTextLayout(Font font, FontRenderContext frc, BreakIterator breaker)
font
- The font to use for the layoutfrc
- The FontRenderContext used to rasterize the font. This will
help define the character boundsbreaker
- The BreakIterator that is used to break the text (also see
forceBreakAfter(int)
)public double getLineHeight()
public double getDescent()
public double getAscent()
public void setAscent(float ascent)
public void setBreakOnEol(boolean breakOnEol)
public boolean getBreakOnEol()
public void setLineSpacing(float lineSpacing)
public float getLineSpacing()
public void doLayout(String text, float leftX, float topY, float maxWidth)
numberOfLines()
, getLine(int)
and
#getBounds(int)
for the results of the layout.text
- The text to lay outleftX
- The leftmost X value of any pixel of texttopY
- The topmost Y value of any pixel of textmaxWidth
- The suggested maximum width of any line of the textpublic String getSourceText()
public int numberOfLines()
public SimpleTextLayout.TextBoundingBox getLine(int line)
public List<SimpleTextLayout.TextBoundingBox> getLines()
Copyright © 2016 Metron, Inc.. All rights reserved.