How to render fonts as shape in Apache FOP 2.3

BuZZ-dEE :

I want to update an old FOP 0.94 to the new FOP 2.3. In the old FOP fonts are rendered as shapes. I would like to preserve this behavior, so I tried to set the following to the PDFTranscoder.:

PDFTranscoder pdfTranscoder = new PDFTranscoder();
pdfTranscoder.addTranscodingHint(PDFTranscoder.KEY_STROKE_TEXT, Boolean.TRUE);

but if do that, no fonts are rendered in the outcoming PDF. How can I tell FOP to render fonts as shapes?

If I remove:

pdfTranscoder.addTranscodingHint(PDFTranscoder.KEY_STROKE_TEXT, Boolean.TRUE);

then the text is in outcoming PDF, but not rendered as shape.

BuZZ-dEE :

Notes on text painting

There used to be an additional hint, AbstractFOPTranscoder.KEY_STROKE_TEXT (Content: java.lang.Boolean), but this hint has been disabled. It was used to force painting text as shapes.

The PDF Transcoder today uses PDF operations whenever possible to paint text. Only for cases like special effects or transformations Batik will convert the text into shapes. Text output as shapes will negatively affect performance and will result in a bigger PDF. There's currently no work-around other than investing some time in improving text output in the PDF Transcoder. Help is welcome.

https://cwiki.apache.org/confluence/display/XMLGRAPHICSBATIK/PdfTranscoder#space-menu-link-content

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=153877&siteId=1