Python: CreateTextRun with unicode objects


Python 2.7 provides unicode string objects, but the CreateUnicodeTextRun sample doesn’t use them. Instead it passes in arrays of one character strings or integer code points. See:

When I swap out my CreateTextRun(‘hello’) calls for CreateUnicodeTextRun(map(ord,u’hello’), len(u’hello’)) calls, I get spaces between characters that I did not get with the normal CreateTextRun.

So: can you provide a CreateTextRun call that can accept Python 2.7 unicode objects and render them correctly?



When using the CreateUnicodeTextRun function the encoding is not the built in Python encoding, but PDF multibyte character code encoding, which then gets mapped to glyphs/unicode by the Font being used.

Is there an issue you are having with CreateTextRun?