Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support

All forums · Statistics · Search ·

Two Pilots forum / For software developers / Problem with TextOut and ANSI-Chars above 0x7F
Author Message
# Posted: 26 Jul 2010 06:31 · Edited by: Theunissen

Sorry for disturbing again ;-(

We are still using TextOut with the DC of PDFDocument4 and "FontEmbedStyle = esNotEmbed", because we only need "Arial" or some other default font.

In preparation of printing we do a CreateFont with the parameter fdwCharSet set to the value 1 (DEFAULT_CHARSET).

When printing some Text like "Test ?????????..." (???? standing for international characters from ANSI like a, e, i, o, u with accents) we get the right output on the printer, but some other characters in the PDF-file.

With piPDFDocument (Lib version 2.70) everything was fine. When using FreePDF we also get the correct result.

Maybe there is a characterset problem in the library when the font is selected into the DC: "hOldFont = SelectObject(hDC, hFont)" ?

Hans-Gerd Theunissen

PS: I just tried CreateFont with ANSI_CHARSET instead of DEFAULT_CHARSET, but it produces the same result :-(

# Posted: 28 Jul 2010 16:18

As I understand, you use PDF's context to draw you document (GetDC method)?
I tried to do the same. I got DC and draw 2 text lines:
a) ::TextOutA(dc, 10, 100, "Test ?????.", 11);
b) ::TextOutW(dc, 10, 120, L"Test ?????.", 11);
I also saved this painting to EMF file and there I could see, that in the case a) the text string is represented like "Test ?????" (all chars after 'test' are symbols with code 63). So that is why they are painted in PDF like '?'. Maybe the problem is in the font you chose.
In the case b) all chars are in unicode, so they are drawn correctly.
I can't help you with GDI (our library gets EMF from device context that already has text "Test ???", so library draws what it is told to draw), the recomendation is to use unicode versions of methods/functions when you have unicode data. Try, please, to replace all your TextOut with TextOutW, or define UNICODE in your project.

Max Filimonov,



Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.015


Page top