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

void PoDoFo::NonPublic::PdfTTFWriter::WriteTable ( PdfOutputDevice pDevice,
TVecTableDirectoryEntries &  rToc,
pdf_ttf_ulong  tag,
void(PdfTTFWriter::*)(PdfOutputDevice *)  WriteTableFunc 
) [private]

Write a table to an output device and create a table directory for it with a correctly calculated checksum.

pDevicethe output device on which the table should be written
rTocadd a table directory entry to this table directory.
tagthe tag of the table (e.g. 'name' or 'os/2').
WriteTableFunca member function pointer to the function that actually write the data
See also:

Definition at line 1303 of file PdfTTFWriter.cpp.

References CalculateChecksum(), PoDoFo::NonPublic::PdfTTFWriter::TTableDirectoryEntry::checkSum, PoDoFo::PdfRefCountedBuffer::GetBuffer(), PoDoFo::PdfOutputDevice::GetLength(), PoDoFo::NonPublic::PdfTTFWriter::TTableDirectoryEntry::length, m_pRefBuffer, PoDoFo::NonPublic::PdfTTFWriter::TTableDirectoryEntry::offset, PoDoFo::NonPublic::PdfTTFWriter::TTableDirectoryEntry::tag, PoDoFo::PdfOutputDevice::Tell(), and PoDoFo::PdfOutputDevice::Write().

Referenced by Write().

    if( !m_pRefBuffer ) 
        // start with a 4MB buffer
        const long l4MB = 4 * 1024 * 1024; 
        m_pRefBuffer = new PdfRefCountedBuffer( l4MB );

    PdfOutputDevice memDevice( m_pRefBuffer );

    TTableDirectoryEntry entry;
    entry.tag      = tag;
    entry.checkSum = 0;
    entry.length   = 0;
    entry.offset   = pDevice->Tell();

    (this->*WriteTableFunc)( &memDevice );

    // create toc entry
    entry.checkSum = this->CalculateChecksum( reinterpret_cast<pdf_ttf_ulong*>(m_pRefBuffer->GetBuffer()), memDevice.GetLength() );;
    entry.length   = memDevice.GetLength();
    rToc.push_back( entry );

    // write data to the real device
    pDevice->Write( m_pRefBuffer->GetBuffer(), memDevice.GetLength() );

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