PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

the unicode font name is not supported
https://forum.pdfsharp.net/viewtopic.php?f=3&t=2200
Page 1 of 1

Author:  tracter [ Wed Oct 31, 2012 3:18 am ]
Post subject:  the unicode font name is not supported

In PDFSharp-MigraDocFoundation-1_32, for supporting Chinese chars, in the sample code project "Unicode", I changed the font name to a Chinese font name '微软雅黑'. After built and run, an assertion failed at PdfSharp.Pdf.IO\PdfWriter.cs line 231 in void Write(PdfName value) method, refer to the 3rd screenshot, and PdfSharp.Pdf.Internal\RawEncoding.cs file GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) method line 56, refer to the 2ed screenshot. And in the generated pdf file, the font name is not right, for each Chinese char, the hight byte is eaten off, refer to the 1st screenshot.

Looks like, the unicode(2 bytes) font name is NOT supported.

Attachments:
File comment: generated pdf file
33.png
33.png [ 40.22 KiB | Viewed 5315 times ]
File comment: PdfSharp.Pdf.Internal\RawEncoding.cs line 56
22.png
22.png [ 56.72 KiB | Viewed 5315 times ]
File comment: PdfSharp.Pdf.IO\PdfWriter.cs line 231
11.png
11.png [ 32.01 KiB | Viewed 5315 times ]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/