Hi

I'm looking at using PoDoFo to generate PDFs for OCR results in 
gImageReader. So far things are working pretty well, except for 
occasional encoding troubles. I.e. one char giving me headaches is fi 
(aka U+FB01).

If I don't specify and PdfEncoding in document.CreateFont, that 
character will not get printed. I noticed that if I use IdentityEncoding 
instead, the character is printed correctly, but the char spacing is 
wrong (i.e. spacing is about 150% the "normal" spacing). A small test 
application which demostrates this is appended below.

So my question is: How should I setup the font and encoding for correct 
results? I'll always be passing UTF-8 strings and it should also work 
for non-latin alphabets. I'm using PoDoFo 0.9.4 on Fedora.

Many thanks for any pointers.

Sandro

---------------------------------------

#include <podofo/podofo.h>

int main()
{
     PoDoFo::PdfStreamedDocument document("test.pdf");
     PoDoFo::PdfPainter painter;
painter.SetPage(document.CreatePage(PoDoFo::PdfPage::CreateStandardPageSize(PoDoFo::ePdfPageSize_A4)));

     PoDoFo::PdfString pdfString(reinterpret_cast<const 
PoDoFo::pdf_utf8*>("\uFB01ber"));
     painter.SetFont(document.CreateFont("Dejavu Sans", false, false, 
false, PoDoFo::PdfEncodingFactory::GlobalIdentityEncodingInstance()));
     painter.DrawText(10, 10, pdfString);
     painter.SetFont(document.CreateFont("Dejavu Sans"));
     painter.DrawText(10, 50, pdfString);
     painter.FinishPage();
     document.Close();
     return 0;
}


------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to