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

PdfFont * PoDoFo::PdfFontCache::CreateFontObject ( TISortedFontList  itSorted,
TSortedFontList &  vecContainer,
PdfFontMetrics pMetrics,
bool  bEmbedd,
bool  bBold,
bool  bItalic,
const char *  pszFontName,
const PdfEncoding *const   pEncoding,
bool  bSubsetting = false 
) [private]

Create a font and put it into the fontcache

Parameters:
itSortediterator pointing to a location in vecContainer where a sorted insert can be made
vecContainercontainer where the font object should be added
pMetricsa font metrics
bEmbeddif true the font will be embedded in the pdf file
bBoldif true this font will be treated as bold font
bItalicif true this font will be treated as italic font
pszFontNamea font name for debug output
pEncodingthe encoding of the font. The font will not take ownership of this object.
bSubsettingif true the font will be subsetted in the pdf file
Returns:
a font handle or NULL in case of error

Definition at line 653 of file PdfFontCache.cpp.

References PoDoFo::PdfError::AddToCallstack(), PoDoFo::eLogSeverity_Error, PoDoFo::PdfFont::IsBold(), PoDoFo::PdfFont::IsItalic(), PoDoFo::PdfError::LogMessage(), m_pParent, PoDoFo::TFontCacheElement::m_sFontName, and PoDoFo::PdfError::PrintErrorMsg().

Referenced by GetFont(), and GetFontSubset().

{
    PdfFont* pFont;

    try {
        int nFlags = ePdfFont_Normal;

            if ( bSubsetting )
                  nFlags |= ePdfFont_Subsetting;

            if( bEmbedd )
            nFlags |= ePdfFont_Embedded;

        if( bBold ) 
            nFlags |= ePdfFont_Bold;

        if( bItalic )
            nFlags |= ePdfFont_Italic;

        pFont    = PdfFontFactory::CreateFontObject( pMetrics, nFlags, pEncoding, m_pParent );

        if( pFont ) 
        {
            TFontCacheElement element;
            element.m_pFont     = pFont;
            element.m_bBold     = pFont->IsBold();
            element.m_bItalic   = pFont->IsItalic();
            element.m_sFontName = pszFontName;
            element.m_pEncoding = pEncoding;

            // Do a sorted insert, so no need to sort again
            rvecContainer.insert( itSorted, element );
        }
    } catch( PdfError & e ) {
        e.AddToCallstack( __FILE__, __LINE__ );
        e.PrintErrorMsg();
        PdfError::LogMessage( eLogSeverity_Error, "Cannot initialize font: %s\n", pszFontName ? pszFontName : "" );
        return NULL;
    }

    return pFont;
}

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