简体   繁体   English

如何设置自定义字体以用于 mxGraph 的 pdf/图像导出功能以支持 UTF-8 编码的亚洲语言文本?

[英]How do I setup custom fonts for use in mxGraph's pdf/image export features to support UTF-8 encoded asian language text?

I'm successfully exporting from mxGraph (Java) using the approach presented in the mxGraph exportPdf example.我使用 mxGraph exportPdf 示例中介绍的方法成功地从 mxGraph (Java) 导出。

However I'd like to specify a font that can support more asian-languag utf-8 encoded text, as the default font does not seem to be able to do so.但是我想指定一种可以支持更多 asian-languag utf-8 编码文本的字体,因为默认字体似乎无法这样做。

I came across this other SO question .我遇到了另一个 SO 问题 An answer states the following "Note that you need to setup iText to map every font you need in the PDF" Can anyone provide any information as to the process involved to set up iText fonts for use by mxGraph java?答案指出以下内容“请注意,您需要设置 iText 以映射 PDF 中所需的每种字体” 任何人都可以提供有关设置 iText 字体以供 mxGraph java 使用的过程的任何信息吗?

I've never tried it, but my understanding is that you need to pull in iTextAsian.jar and follow the CJK example , the key part of which is:我从来没有尝试过,但我的理解是你需要拉入iTextAsian.jar并遵循CJK 示例,其中的关键部分是:

BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
Font FontChinese = new Font(bfChinese, 12, Font.NORMAL);
Paragraph p = new Paragraph(chinese, FontChinese);
document.add(p);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM