使用 Itextsharp 显示英文问题的波兰字符
Polish Character Displaying English Issue Using Itextsharp
我在我的 pdf 中使用了一些波兰语字符,我使用了一些外部字体。
我在 pdf 中使用短语来显示文本,所以当我在短语中写任何波兰语字符时,它会显示英文字符。我正在使用此代码。
table = new PdfPTable(1);
table.TotalWidth = 500f;
table.WidthPercentage = 100;
cell.Border = PdfPCell.NO_BORDER;
Color colorPurple = new Color(System.Drawing.ColorTranslator.FromHtml("#338B94"));
BaseFont custm_fnts = BaseFont.CreateFont(fontpath + "TitilliumWeb-Bold.ttf", BaseFont.CP1252, BaseFont.EMBEDDED); //Font font = new Font(customfont, 52);
Font newfntbldh2 = new Font(custm_fnts, 18, Font.NORMAL, colorPurple);
cell = PhraseCell(new Phrase("Najważniejsze zdarzenia", newfntbldh2), PdfPCell.ALIGN_CENTER);
table.AddCell(cell);
document.Add(table);
这一行 cell=PhraseCell 我使用波兰语单词 'Najważniejsze' 但它不会准确显示我通过了它将以英文文本显示。
如何保持波兰语字符不变?
将字体编码设置为BaseFont.IDENTITY_H
,它将起作用。 CP1252 没有所有需要的抛光字符。
我在我的 pdf 中使用了一些波兰语字符,我使用了一些外部字体。
我在 pdf 中使用短语来显示文本,所以当我在短语中写任何波兰语字符时,它会显示英文字符。我正在使用此代码。
table = new PdfPTable(1);
table.TotalWidth = 500f;
table.WidthPercentage = 100;
cell.Border = PdfPCell.NO_BORDER;
Color colorPurple = new Color(System.Drawing.ColorTranslator.FromHtml("#338B94"));
BaseFont custm_fnts = BaseFont.CreateFont(fontpath + "TitilliumWeb-Bold.ttf", BaseFont.CP1252, BaseFont.EMBEDDED); //Font font = new Font(customfont, 52);
Font newfntbldh2 = new Font(custm_fnts, 18, Font.NORMAL, colorPurple);
cell = PhraseCell(new Phrase("Najważniejsze zdarzenia", newfntbldh2), PdfPCell.ALIGN_CENTER);
table.AddCell(cell);
document.Add(table);
这一行 cell=PhraseCell 我使用波兰语单词 'Najważniejsze' 但它不会准确显示我通过了它将以英文文本显示。
如何保持波兰语字符不变?
将字体编码设置为BaseFont.IDENTITY_H
,它将起作用。 CP1252 没有所有需要的抛光字符。