Hello everybody,

I re-post this e-mail as it seems to not be delivered last time.

I've just encountered this case where the DescendantFonts is an array
containing a Dictionary and not a Reference.

This is why I try to create a patch to fix this issue. But, I'm not sure of
my following source code:

    if (descendant[0].IsDictionary()) {
        pFontObject = (PdfObject*) &descendant[0];
        pFontObject->SetOwner(pObject->GetOwner());
        pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
    }

Is there a specialist here to have a look at my attached patch ? I've tried
to attached a PDF example but it is a bit too big and has been moderated.

Thank you in advance for your help

Regards,
Christophe
Index: PdfFontFactory.cpp
===================================================================
--- PdfFontFactory.cpp	(revision 1977)
+++ PdfFontFactory.cpp	(working copy)
@@ -218,11 +218,16 @@
             pObject->GetIndirectKey( "DescendantFonts" )->GetArray();
         PdfObject* pFontObject = NULL;
         
-        if (descendant.size() && descendant[0].IsReference())
-        {
-            pFontObject = pObject->GetOwner()->GetObject( descendant[0].GetReference() );
-
-            pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
+        if (descendant.size()) {
+			if (descendant[0].IsReference()) {
+				pFontObject = pObject->GetOwner()->GetObject( descendant[0].GetReference() );
+				pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
+			}
+			if (descendant[0].IsDictionary()) {
+				pFontObject = (PdfObject*) &descendant[0];
+				pFontObject->SetOwner(pObject->GetOwner());
+				pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
+			}
         }
         pEncoding   = pObject->GetIndirectKey( "Encoding" );
 
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to