{
PdfTextRenderer textRenderer = new PdfTextRenderer(false);//FIXMETAB optimize this
textRenderer.initialize(this, pdfContentByte, text, getOffsetX(), getOffsetY());
JRStyledText styledText = textRenderer.getStyledText();
if (styledText == null)
{
return;
}
int xFillCorrection = 0;
int yFillCorrection = 0;
double angle = 0;
switch (text.getRotationValue())
{
case LEFT :
{
xFillCorrection = 1;
angle = Math.PI / 2;
break;
}
case RIGHT :
{
yFillCorrection = -1;
angle = - Math.PI / 2;
break;
}
case UPSIDE_DOWN :
{
angle = Math.PI;
break;
}
case NONE :
default :
{
}
}
AffineTransform atrans = new AffineTransform();
atrans.rotate(angle, textRenderer.getX(), jasperPrint.getPageHeight() - textRenderer.getY());
pdfContentByte.transform(atrans);
if (text.getModeValue() == ModeEnum.OPAQUE)
{
Color backcolor = text.getBackcolor();
pdfContentByte.setRGBColorFill(
backcolor.getRed(),
backcolor.getGreen(),
backcolor.getBlue()
);
pdfContentByte.rectangle(
textRenderer.getX() + xFillCorrection,
jasperPrint.getPageHeight() - textRenderer.getY() + yFillCorrection,
textRenderer.getWidth(),
- textRenderer.getHeight()
);
pdfContentByte.fill();
}
if (styledText.length() > 0)
{
tagHelper.startText();
/* */
textRenderer.render();