Quantcast
Channel: Active questions tagged fonts - Super User
Viewing all articles
Browse latest Browse all 300

Mixed UTF-16BE strings with ANSI in content stream of a PDF page object

$
0
0

I am working on generation of PDF on the fly tool, with custom chosen local font.Embeeding the font is not a problem, and been proven that font been found w/o problem.However, the font is Chinese, and so the text string to appear is Chinese.

My content stream of a page looks like this:

2.835 0 0 2.835 0 0 cmBT/F1 12.000 Tf15.000 TL50 350 Td(?氊) TjET

The "Tj" line has actually a BOM (fe ff) and a single Chinese character: "高" (just for test) encoded as UTF-16BE (9a d8).

The Font object I am using:

7 0 obj<</Type /Font/Subtype /TrueType/BaseFont /MicrosoftYaHei>>endobj

"/F1" also point to that Font Object in Page Resources.I've tried many things like "encoding", or mapping, I prefer to no go complicated and load "Cmap" from the font, also I understand I don't need to load it if the program could find the font.After trying many things, I got to conclusion that I have encoding problem in my content stream, as the PDF consumer app treating the string byte by byte and no multi-byte recognition.

The question here: How do I force the PDF to treat my string (the only string, and not the whole content stream) to be read as UTF-16BE? What is the settings I need to use in my Font object (or Font Decriptor) to achieve this?

Sample PDF file available here


Viewing all articles
Browse latest Browse all 300

Trending Articles