如何在 Linux 中的 MigraDoc 中使用 unicode 字符

问题描述 投票:0回答:1

在最新的 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 中获取正确的字符?

asp.net-core pdf-generation pdfsharp migradoc pdfsharpcore
1个回答
0
投票

创建您自己的 FontResolver 实现

IFontResolver
并包含包含您需要的所有字符的 TTF 文件。 Arial 会像在 Windows 下一样工作。

© www.soinside.com 2019 - 2024. All rights reserved.