Hello,

Sorry that it took me so long to answer. Maybe you (or someone else) is still 
interested in an answer.

I just updated the podofotxt2pdf tool to allow converting UTF8 input text into 
a PDF file. You can take a look at the source code how it is done. Passing UTF8 
to DrawText works fine for me and accented characters get printed correctly.

Best regards,
        Dom

Am Dienstag 05 Januar 2010 schrieb Gwenael Chailleu:
> Hello !
> 
> ...and happy new year ! (in France these kind of wishes stay legal all
>  through january ;-)
> 
> I was very interested in this thread :
>  http://www.mail-archive.com/[email protected]/msg00881.ht
> ml (Though I did not manage to reply on it.)
> 
> Did you solve Vincent den Boer problem ?
> 
> I am exactly in the same situation (trying to pass pdf_utf8 to DrawText)...
> 
> I tried things like that :
> 
> PdfString lz_pdfText( (pdf_utf8*) lz_text.data());
> mc_painter.DrawText( ld_x, ld_y, lz_pdfText);
> 
> --> accentuated characters are replaced by zeroes.
> 
> I saw some commented code in the source that seemed to match my needs :
> 
> I tested it ( in ../podofo-0.7.0/test/CreationTest/CreationTest.cpp (line
>  67 to 79 see below ))...
> 
> keeping  "new PdfIdentityEncoding( 0, 0xffff, true )" as encoding parameter
>  of doc->CreateFont --> the returned PdfFont is NULL.
> 
> changing it to PdfEncodingFactory::GlobalPdfDocEncodingInstance()
> --> accentuated characters are replaced by zeroes.
> 
> Thanks in advance !
> Regards
> 
> Gwen
> 
> Commented in CreationTest.cpp :    pFont = pDocument->CreateFont( "Arial
>  Unicode MS", new PdfIdentityEncoding( 0, 0xffff, true ) ); printf("GOT:
>  %s\n", pFont->GetFontMetrics()->GetFontname() );
>     PdfString sJap(reinterpret_cast<const
>  pdf_utf8*>("「Po\tDoFo��今�ら日本語も話���。"));
>  const long     lUtf8BufferLen = 256;
>     pdf_utf8 pUtf8Buffer[lUtf8BufferLen];
> 
> 
>     PdfString::ConvertUTF16toUTF8( sJap.GetUnicode(),
>  sJap.GetUnicodeLength(), pUtf8Buffer, lUtf8BufferLen  ); printf("UNIC:
>  %s\n", pUtf8Buffer );
> 
>     pFont->SetFontSize( 8.0 );
>     pPainter->SetFont( pFont );
>     pPainter->DrawText( 100.0, 100.0, sJap );
> 


-- 
**********************************************************************
Dominik Seichter - [email protected]
KRename  - http://www.krename.net  - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game,  for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to