如何在 Apache FOP 2.3 中将字体呈现为形状

How to render fonts as shape in Apache FOP 2.3

我想将旧的 FOP 0.94 更新为新的 FOP 2.3。在旧的 FOP 中,字体呈现为形状。我想保留这种行为,所以我尝试将以下内容设置为 PDFTranscoder.:

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

但如果这样做,输出的 PDF 中将不会呈现任何字体。我如何告诉 FOP 将字体呈现为形状?

如果我删除:

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

然后文本在输出的 PDF 中,但未呈现为形状

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