Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

const PdfEncoding * PoDoFo::PdfEncodingFactory::CreateEncoding ( PdfObject pObject ) [static]

Create a new PdfEncoding from either an encoding name or an encoding dictionary.

Parameters:
pObjectmust be a name or an encoding dictionary
Returns:
a PdfEncoding or NULL

Definition at line 43 of file PdfEncodingFactory.cpp.

References PoDoFo::ePdfError_InternalLogic, PoDoFo::PdfVariant::GetName(), PoDoFo::PdfVecObjects::GetObject(), PoDoFo::PdfObject::GetOwner(), PoDoFo::PdfVariant::GetReference(), GlobalMacExpertEncodingInstance(), GlobalMacRomanEncodingInstance(), GlobalStandardEncodingInstance(), GlobalSymbolEncodingInstance(), GlobalWinAnsiEncodingInstance(), GlobalZapfDingbatsEncodingInstance(), PoDoFo::PdfVariant::IsDictionary(), PoDoFo::PdfVariant::IsName(), PoDoFo::PdfVariant::IsReference(), and PODOFO_RAISE_ERROR_INFO.

Referenced by PoDoFo::PdfFontFactory::CreateFont().

{
    if( pObject->IsReference() )
    {
        // resolve any references
        pObject = pObject->GetOwner()->GetObject( pObject->GetReference() );
    }

    if( pObject->IsName() )
    {
        const PdfName & rName = pObject->GetName();
        if( rName == PdfName("WinAnsiEncoding") )
            return PdfEncodingFactory::GlobalWinAnsiEncodingInstance();
        else if( rName == PdfName("MacRomanEncoding") )
            return PdfEncodingFactory::GlobalMacRomanEncodingInstance();
        else if( rName == PdfName("StandardEncoding") ) // OC 13.08.2010
            return PdfEncodingFactory::GlobalStandardEncodingInstance();
        else if( rName == PdfName("MacExpertEncoding") ) // OC 13.08.2010 TODO solved
            return PdfEncodingFactory::GlobalMacExpertEncodingInstance();
        else if( rName == PdfName("SymbolEncoding") ) // OC 13.08.2010
            return PdfEncodingFactory::GlobalSymbolEncodingInstance();
        else if( rName == PdfName("ZapfDingbatsEncoding") ) // OC 13.08.2010
            return PdfEncodingFactory::GlobalZapfDingbatsEncodingInstance();
    }
    else if( pObject->IsDictionary() )
    {
        return new PdfDifferenceEncoding( pObject );
    }


    PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Unsupported encoding detected!" );

    //return NULL; Unreachable code
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index