return ct;
}
private Phrase createPhrase(final RenderableComplexText node)
{
Phrase p = new Phrase();
RichTextSpec text = node.getRichText();
for (RichTextSpec.StyledChunk c : text.getStyleChunks())
{
TypedMapWrapper<Attribute, Object> attributes = new TypedMapWrapper<Attribute, Object>(c.getAttributes());
final Number size = attributes.get(TextAttribute.SIZE, 10f, Number.class);
final PdfTextSpec pdfTextSpec = computeFont(c);
final int style = computeStyle(attributes, pdfTextSpec);
final Color paint = (Color) c.getStyleSheet().getStyleProperty(ElementStyleKeys.PAINT);
// add chunks
BaseFont baseFont = pdfTextSpec.getFontMetrics().getBaseFont();
Font font = new Font(baseFont, size.floatValue(), style, paint);
if (c.getOriginatingTextNode() instanceof RenderableReplacedContentBox)
{
RenderableReplacedContentBox content = (RenderableReplacedContentBox) c.getOriginatingTextNode();
com.lowagie.text.Image image = imageHandler.createImage(content);
if (image != null)
{
Chunk chunk = new Chunk(image, 0, 0);
// chunk.setFont(font);
p.add(chunk);
}
}
else
{
String textToPrint = c.getText();
Chunk chunk = new Chunk(textToPrint, font);
p.add(chunk);
}
}
return p;
}