Class AbstractTextRenderer
- java.lang.Object
-
- net.sf.jasperreports.engine.export.AbstractTextRenderer
-
- Direct Known Subclasses:
AbstractPdfTextRenderer,AwtTextRenderer
public abstract class AbstractTextRenderer extends Object
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractTextRenderer.TabSegment
-
Field Summary
Fields Modifier and Type Field Description protected StringallTextprotected intbottomPaddingprotected AttributedStringbulletChunkprotected StringbulletTextprotected floatdrawPosXprotected floatdrawPosYprotected intheightprotected inthtmlListIndentprotected booleanignoreMissingFontprotected booleanindentFirstLineprotected booleanisFirstParagraphprotected booleanisLastParagraphprotected booleanisMaxHeightReachedprotected JasperReportsContextjasperReportsContextprotected booleanjustifyLastLineprotected intleftPaddingstatic FontRenderContextLINE_BREAK_FONT_RENDER_CONTEXTprotected floatlineHeightprotected JRPropertiesUtilpropUtilprotected intrightPaddingprotected intsegmentIndexprotected List<AbstractTextRenderer.TabSegment>segmentsprotected JRStyledTextstyledTextprotected JRPrintTexttextprotected inttopPaddingprotected floatverticalAlignOffsetprotected intwidthprotected intxprotected inty
-
Constructor Summary
Constructors Constructor Description AbstractTextRenderer(JasperReportsContext jasperReportsContext, boolean isMinimizePrinterJobSize, boolean ignoreMissingFont, boolean defaultIndentFirstLine, boolean defaultJustifyLastLine)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voiddraw()protected AttributedStringgetAttributedString()intgetBottomPadding()FontRenderContextgetFontRenderContext()public static float getLineHeight(JRParagraph paragraph, float lineSpacingFactor, int maxFontSize) { float lineHeight = 0; switch(paragraph.getLineSpacing()) { case SINGLE: case ONE_AND_HALF: case DOUBLE: case PROPORTIONAL: { lineHeight = lineSpacingFactor * maxFontSize; break; } case AT_LEAST: { lineHeight = Math.max(lineSpacingFactor * maxFontSize, paragraph.getLineSpacingSize()); break; } case FIXED: { lineHeight = paragraph.getLineSpacingSize(); break; } default : { throw new JRRuntimeException("Invalid line space type: " + paragraph.getLineSpacing()); } } return lineHeight; } /**intgetHeight()intgetLeftPadding()static floatgetLineHeight(boolean isFirstLine, JRParagraph paragraph, float maxLeading, float maxAscent)protected StyledTextListWritergetListWriter()StringgetPlainText()intgetRightPadding()JRStyledTextgetStyledText()intgetTopPadding()intgetWidth()intgetX()intgetY()voidinitialize(JRPrintText text, JRStyledText styledText, int offsetX, int offsetY)voidrender()protected voidrenderParagraph(AttributedCharacterIterator allParagraphs, int paragraphStart, String paragraphText)
-
-
-
Field Detail
-
LINE_BREAK_FONT_RENDER_CONTEXT
public static final FontRenderContext LINE_BREAK_FONT_RENDER_CONTEXT
-
jasperReportsContext
protected final JasperReportsContext jasperReportsContext
-
propUtil
protected final JRPropertiesUtil propUtil
-
text
protected JRPrintText text
-
styledText
protected JRStyledText styledText
-
allText
protected String allText
-
x
protected int x
-
y
protected int y
-
width
protected int width
-
height
protected int height
-
topPadding
protected int topPadding
-
leftPadding
protected int leftPadding
-
bottomPadding
protected int bottomPadding
-
rightPadding
protected int rightPadding
-
verticalAlignOffset
protected float verticalAlignOffset
-
drawPosY
protected float drawPosY
-
drawPosX
protected float drawPosX
-
lineHeight
protected float lineHeight
-
isMaxHeightReached
protected boolean isMaxHeightReached
-
isFirstParagraph
protected boolean isFirstParagraph
-
isLastParagraph
protected boolean isLastParagraph
-
segments
protected List<AbstractTextRenderer.TabSegment> segments
-
segmentIndex
protected int segmentIndex
-
indentFirstLine
protected boolean indentFirstLine
-
justifyLastLine
protected boolean justifyLastLine
-
htmlListIndent
protected int htmlListIndent
-
bulletText
protected String bulletText
-
bulletChunk
protected AttributedString bulletChunk
-
ignoreMissingFont
protected final boolean ignoreMissingFont
-
-
Constructor Detail
-
AbstractTextRenderer
public AbstractTextRenderer(JasperReportsContext jasperReportsContext, boolean isMinimizePrinterJobSize, boolean ignoreMissingFont, boolean defaultIndentFirstLine, boolean defaultJustifyLastLine)
-
-
Method Detail
-
getX
public int getX()
-
getY
public int getY()
-
getWidth
public int getWidth()
-
getHeight
public int getHeight()
-
getTopPadding
public int getTopPadding()
-
getLeftPadding
public int getLeftPadding()
-
getBottomPadding
public int getBottomPadding()
-
getRightPadding
public int getRightPadding()
-
getStyledText
public JRStyledText getStyledText()
-
getPlainText
public String getPlainText()
-
initialize
public void initialize(JRPrintText text, JRStyledText styledText, int offsetX, int offsetY)
-
render
public void render()
-
getListWriter
protected StyledTextListWriter getListWriter()
-
renderParagraph
protected void renderParagraph(AttributedCharacterIterator allParagraphs, int paragraphStart, String paragraphText)
-
getAttributedString
protected AttributedString getAttributedString()
-
draw
public abstract void draw()
-
getLineHeight
public static float getLineHeight(boolean isFirstLine, JRParagraph paragraph, float maxLeading, float maxAscent)
-
getFontRenderContext
public FontRenderContext getFontRenderContext()
public static float getLineHeight(JRParagraph paragraph, float lineSpacingFactor, int maxFontSize) { float lineHeight = 0; switch(paragraph.getLineSpacing()) { case SINGLE: case ONE_AND_HALF: case DOUBLE: case PROPORTIONAL: { lineHeight = lineSpacingFactor * maxFontSize; break; } case AT_LEAST: { lineHeight = Math.max(lineSpacingFactor * maxFontSize, paragraph.getLineSpacingSize()); break; } case FIXED: { lineHeight = paragraph.getLineSpacingSize(); break; } default : { throw new JRRuntimeException("Invalid line space type: " + paragraph.getLineSpacing()); } } return lineHeight; } /**
-
-