Dear all,

I hit a font subsetting issue while starting discovering feature-set of PoDoFo 
over these last days.
Essentially it can summarised as this:
        
        ...CreateFontSubset("Consolas", false, false); // using default 
WinAnsiEncoding
        ...
        ...DrawText(56.69, top - 56.69, "Some text... 0123456789!");

leads to wrong PDF files being produced. It works with some fonts like 'Arial' 
and 'Courier new' (though limited testing, so not sure it really works 100%). 
It produces PDF files with display problems (varying effect depending on the 
reader program) with at least 'Consolas' and 'Cambria'.

I just found out that using:

        CreateFontSubset("Consolas", false, false, false, 
PdfEncodingFactory::GlobalIdentityEncodingInstance());

It apparently works just fine (again not yet 100% tested but at least I'm not 
seeing anymore issues with those tests). I can't anymore pass plain strings to 
DrawText() and AddText, because the WinAnsi encoding of those strings are then 
misinterpreted. But I found out that if I pass UTF-8 strings by taking care of 
presenting them as pdf_utf8*, I can print things like "Some text... école 
100,00€... 0123456789!" without problem.

It also works if I merely pass Windows wide chars (UTF-16) as L"Some text... 
école 100,00€... 0123456789!"... But only if using IdentityEncoding.

I will now be able to push my tests of the library further.

Though, what's the known status of font subsetting with PoDoFo?
Is it expected that it would only work (apparently) correctly (or more 
correctly) with IdentifyEncoding but not WinAnsiEncoding which is the default 
for PoDoFo?

Info: when displaying file properties with Adobe Reader, and using 
IdentityEnconding, the fonts are reported as:
        Type: TrueType (CID)
        Encoding: Identity-H

When using WinAnsiEncoding, which leads to my files being wrong, they are 
reported as:
        Type: TrueType    (no mention of CID)
        Encoding: ANSI

Don't know if that brings some light.
-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to