在最新的 Migradoc 6.0.0-preview-3 中,PDF 文件中的某些 unicode 字符在 Linux 中显示为不重音。 要重现,请在 Debian 中的 ASP.NET MVC 控制器中运行
static ReportTemplateBase()
{
GlobalFontSettings.FontResolver = new NewFontResolver();
}
var textFrame = Section.AddTextFrame();
var font = new Font("Arial", 12);
var par = textFrame.AddParagraph();
par.Format.Font = font;
par.AddFormattedText("õäöüÕÄÖÜ", font);
如果在 Debian Linux 中运行,äöü 将被替换为非重音字符。输出是
õaouÕAOU
如果从 Windows 中的 Visual Studio IDE 运行,输出正确:
õäöüÕäÖÜ
如何在 Debian Linux 中获取正确的字符?
创建您自己的 FontResolver 实现
IFontResolver
并包含包含您需要的所有字符的 TTF 文件。 Arial 会像在 Windows 下一样工作。