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

PoDoFo::PdfDifferenceEncoding::PdfDifferenceEncoding ( PdfObject pObject,
bool  bAutoDelete = true 
)

Create a new PdfDifferenceEncoding from an existing object in a PDF file.

Parameters:
pObjectan existing differences encoding
bAutoDeleteif true the encoding is deleted by its owning font

Definition at line 2337 of file PdfDifferenceEncoding.cpp.

References PoDoFo::PdfEncodingDifference::AddDifference(), PoDoFo::PdfArray::begin(), CreateID(), eBaseEncoding_MacExpert, eBaseEncoding_MacRoman, eBaseEncoding_WinAnsi, PoDoFo::PdfArray::end(), PoDoFo::PdfVariant::GetArray(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDictionary::GetKey(), PoDoFo::PdfVariant::GetName(), PoDoFo::PdfElement::GetObject(), and m_baseEncoding.

    : PdfEncoding( 0x00, 0xff ), PdfElement( NULL, pObject ),
      m_bAutoDelete( bAutoDelete )
{
    CreateID();
    
    m_baseEncoding = eBaseEncoding_WinAnsi;

    if( this->GetObject()->GetDictionary().HasKey( PdfName("BaseEncoding") ) )
    {
        const PdfName & rBase = this->GetObject()->GetDictionary().GetKey( PdfName("BaseEncoding") )->GetName();
        
        if( rBase == PdfName("WinAnsiEncoding") )
            m_baseEncoding = eBaseEncoding_WinAnsi;
        else if( rBase == PdfName("MacRomanEncoding") )
            m_baseEncoding = eBaseEncoding_MacRoman;
        else if( rBase == PdfName("MacExpertEncoding") )
            m_baseEncoding = eBaseEncoding_MacExpert;
    }    

    // Read the differences key
    if( this->GetObject()->GetDictionary().HasKey( PdfName("Differences") ) )
    {
        const PdfArray & rDifferences = this->GetObject()->GetDictionary().GetKey( PdfName("Differences") )->GetArray();
        PdfArray::const_iterator it = rDifferences.begin();

        long long curCode = -1;

        while( it != rDifferences.end() ) 
        {
            if( (*it).IsNumber() ) 
                curCode = (*it).GetNumber();
            else if( (*it).IsName() ) 
            {
                m_differences.AddDifference( static_cast<int>(curCode), (*it).GetName() );
                ++curCode;
            }
            
            ++it;
        }
    }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index