Dear,

> Le 8 févr. 2018 à 13:18, Olivier Mascia <o...@integral.be> a écrit :
> 
>> Le 8 févr. 2018 à 11:33, Olivier Mascia <o...@integral.be> a écrit :
>> 
>> ...
>>      PdfFont* pFont = document.CreateFontSubset("Arial", false, false);
>> ...
>> the file looks good, Acrobat Reader and Mac Preview confirms ArialMT 
>> partially embedded, no substitution done for display.
>> ...
>> Using CreateFontSubset("Consolas", false, false);
>> It displays white (no text visible at all) on Acrobat and partially on the 
>> Mac Preview app (only the text "Accentués... Chiffres" but not the digits 
>> themselves), yet Acrobat confirms "Consolas, partial embedding, Truetype, no 
>> substitution", just as it did for Arial.
>> 
>> I don't know yet what goes wrong. Is it the subsetting which goes wrong? 
>> Does it go wrong due to whatever specifics in the Consolas font (which I 
>> don't know/suspect about)?
> 
> New facts, in case it would pop an idea, a déjà-vu, from one subscriber of 
> the list.
> 
> - rebuilt test case with code from subversion trunk : same results.
> - rerun same case with 'Courier New' instead of 'Consolas' : works fine, 
> nothing strange spotted (just as it was fine with 'Arial').
> - rerun (the equivalent code) with another PDF toolkit than PoDoFo : works 
> fine, nothing strange spotted (Arial, Courier New, Consolas, all fine).
> - checked on another one of my Windows VM (other Windows version), same 
> results (only fails with 'Consolas'; maybe fails with some others too but I 
> played only with Arial, Consolas, Courier New).
> 
> I tend to think this rules out the state of my Consolas TTF font (which were 
> not added / installed but are default provided on recent Windows versions, 
> for years): that should not be originated in a bad / damaged file.  Yet that 
> could be something peculiar to that font (but what?) which leads PoDoFo doing 
> something wrong (while some other toolkit seem not to have issue with that 
> font).
> 
> I'll have to get in and understand the code that drives the subsetting and 
> injection of a TTF font into the PDF, tracing it with Arial and Consolas to 
> maybe spot where it diverges.

I'm running in circles with this.
I have since found that using "Cambria" instead of "Consolas" also trigger 
issues.
I have posted a small sample file (3 lines of text) :

(test.pdf)      https://sea.tipintegral.net/f/41a14f24038947b6aa36/

The web display of the PDF on that interface (Seafile) looks nearly fine, but 
it misses the "!" right after the digits on the line in Cambria.
If I download it and open it with Adobe Reader on Mac, it is the whole line in 
Cambria which does not display.
With the Preview app on Mac, the result is similar to the one through the web 
preview of Seafile.
So there is a problem, for sure.

My hope is that if some of you are kind enough and willing to download this 
test.pdf file, he/she might confirm the display is also incorrect for them, and 
maybe someone will pinpoint some technical detail in the file itself (the 
internals of PDF are still remote for me) that could hint at a direction for me 
to debug this. I'm trying to think backward: going from facts in the resulting 
file to walk up to the possible source of it.

The line with "Arial" is set for NO embedding (if it's wrong for display for 
you because Arial is not available to your viewer, please ignore, this is not 
what I'm after).

        PdfFont* pFont1 = document.CreateFont("Arial", false,
                        PdfEncodingFactory::GlobalWinAnsiEncodingInstance(),
                        PdfFontCache::eFontCreationFlags_AutoSelectBase14,
                        false);

The lines with "Cambria" and "Courier New" are set for subsetting.

        PdfFont* pFont2 = document.CreateFontSubset("Cambria", false, false);
        PdfFont* pFont3 = document.CreateFontSubset("Courier New", false, 
false);

And here are the lines of code producing those small text samples:

        ...
        pFont1->SetFontSize(15.0);
        painter.SetFont(pFont1);
        painter.DrawText(56.69, top - 56.69, "Arial not embedded... Chiffres 
0123456789!");

        pFont2->SetFontSize(15.0);
        painter.SetFont(pFont2);
        painter.DrawText(56.69, top - 2*56.69, "Cambria partial... Chiffres 
0123456789!");

        pFont3->SetFontSize(15.0);
        painter.SetFont(pFont3);
        painter.DrawText(56.69, top - 4 * 56.69, "Courier New partial... 
Chiffres 0123456789!");
        ...

I'm willing and generally not bad at debugging things in code I'm not familiar 
with, but need a hint, a starting point, a clue to focus the search... :)

By all means, thanks!

-- 
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