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

void PoDoFo::NonPublic::PdfTTFWriter::Write ( PdfOutputDevice pDevice )

Write a TTF font from the current internal structures to an output device.

Parameters:
pDevicewrite the font to this device

Definition at line 909 of file PdfTTFWriter.cpp.

References CreateTag(), m_tTableDirectory, PoDoFo::NonPublic::PdfTTFWriter::TTableDirectory::numTables, PoDoFo::PdfOutputDevice::Seek(), PoDoFo::PdfOutputDevice::Write(), WriteHeadTable(), WriteMaxpTable(), WriteTable(), WriteTableDirectory(), and WriteTableDirectoryEntry().

{
    m_tTableDirectory.numTables = 9; // DS TMP

    TTableDirectoryEntry      entry;
    TVecTableDirectoryEntries vecToc;
    const long                lTableOffset = sizeof(TTableDirectory);
    const long                lNumTables   = m_tTableDirectory.numTables;

    this->WriteTableDirectory( pDevice );
    
    // write dummy table of contents
    memset( &entry, 0, sizeof(TTableDirectoryEntry) );
    for( unsigned int i=0; i<static_cast<unsigned int>(lNumTables); i++ )  
        pDevice->Write( reinterpret_cast<const char*>(&entry), sizeof(TTableDirectoryEntry) );

    // write contents
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'm', 'a', 'x', 'p' ), &PdfTTFWriter::WriteMaxpTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'h', 'e', 'a', 'd' ), &PdfTTFWriter::WriteHeadTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'g', 'l', 'y', 'f' ), &PdfTTFWriter::WriteGlyfTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'c', 'm', 'a', 'p' ), &PdfTTFWriter::WriteCMapTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'l', 'o', 'c', 'a' ), &PdfTTFWriter::WriteLocaTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'h', 'h', 'e', 'a' ), &PdfTTFWriter::WriteHHeaTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'O', 'S', '/', '2' ), &PdfTTFWriter::WriteOs2Table );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'n', 'a', 'm', 'e' ), &PdfTTFWriter::WriteNameTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'h', 'm', 't', 'x' ), &PdfTTFWriter::WriteHmtxTable );
    this->WriteTable( pDevice, vecToc, 
                      this->CreateTag( 'p', 'o', 's', 't' ), &PdfTTFWriter::WritePostTable );
    
    /*
    TCIVecTable it = m_vecTableData.begin();
    while( it != m_vecTableData.end() ) 
    {
        TTableDirectoryEntry entry;
        entry.tag      = (*it).tag;
        entry.checkSum = this->CalculateChecksum( reinterpret_cast<const pdf_ttf_ulong*>(&(*it).data), (*it).length );
        entry.offset   = pDevice->GetLength();
        entry.length   = (*it).length;
        
        vecToc.push_back( entry );

        pDevice->Write( (*it).data, (*it).length );
        free( (*it).data );
        ++it;
    }
    */

    // write actual table of contents
    pDevice->Seek( lTableOffset );
    TIVecTableDirectoryEntries itToc = vecToc.begin(); 
    while( itToc != vecToc.end() ) 
    {
        this->WriteTableDirectoryEntry( pDevice, &(*itToc) );
        ++itToc;
    }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index