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 [ 40.22 KiB | Viewed 6524 times ]
|
File comment: PdfSharp.Pdf.Internal\RawEncoding.cs line 56
22.png [ 56.72 KiB | Viewed 6524 times ]
|
File comment: PdfSharp.Pdf.IO\PdfWriter.cs line 231
11.png [ 32.01 KiB | Viewed 6524 times ]
|
|