From: Francesco Pretto <[email protected]>
---
src/doc/PdfFontFactory.cpp | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/doc/PdfFontFactory.cpp b/src/doc/PdfFontFactory.cpp
index a065b83..a8044b8 100644
--- a/src/doc/PdfFontFactory.cpp
+++ b/src/doc/PdfFontFactory.cpp
@@ -212,17 +212,28 @@ PdfFont* PdfFontFactory::CreateFont( FT_Library*, PdfObject* pObject )
const PdfName & rSubType = pSubTypeKey->GetName();
if( rSubType == PdfName("Type0") )
{
+ // TABLE 5.18 Entries in a Type 0 font dictionary
+
// The PDF reference states that DescendantFonts must be an array,
// some applications (e.g. MS Word) put the array into an indirect object though.
- const PdfArray & descendant =
+ PdfArray & descendants =
pObject->GetIndirectKey( "DescendantFonts" )->GetArray();
PdfObject* pFontObject = NULL;
- if (descendant.size() && descendant[0].IsReference())
+ if ( descendants.size() )
{
- pFontObject = pObject->GetOwner()->GetObject( descendant[0].GetReference() );
-
- pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
+ // DescendantFonts is an one-element array
+ PdfObject &descendant = descendants[0];
+ if ( descendant.IsReference() )
+ {
+ pFontObject = pObject->GetOwner()->GetObject( descendant.GetReference() );
+ pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
+ }
+ else
+ {
+ pFontObject = &descendant;
+ pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
+ }
}
pEncoding = pObject->GetIndirectKey( "Encoding" );
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users