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

void PoDoFo::PdfPainter::DrawTextAligned ( double  dX,
double  dY,
double  dWidth,
const PdfString rsText,
EPdfAlignment  eAlignment 
) [inherited]

Draw a single line of text horizontally aligned.

dXthe x coordinate of the text line
dYthe y coordinate of the text line
dWidththe width of the text line
rsTextthe text to draw
eAlignmentalignment of the text line

Definition at line 982 of file PdfPainter.cpp.

References PoDoFo::PdfPainter::DrawText(), PoDoFo::PdfFont::EmbedFont(), PoDoFo::ePdfError_InvalidHandle, PoDoFo::PdfFont::GetFontMetrics(), PoDoFo::PdfString::IsValid(), PoDoFo::PdfPainter::m_pCanvas, PoDoFo::PdfPainter::m_pFont, PoDoFo::PdfPainter::m_pPage, and PoDoFo::PdfFontMetrics::StringWidth().

Referenced by PoDoFo::PdfTable::Draw(), and PoDoFo::PdfPainter::DrawMultiLineText().

    PODOFO_RAISE_LOGIC_IF( !m_pCanvas, "Call SetPage() first before doing drawing operations." );

    if( !m_pFont || !m_pPage || !rsText.IsValid() )
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );

    // Peter Petrov 25 Septemer 2008

    if( dWidth <= 0.0 ) // nonsense arguments

    switch( eAlignment ) 
        case ePdfAlignment_Left:
        case ePdfAlignment_Center:
            dX += (dWidth - m_pFont->GetFontMetrics()->StringWidth( rsText ) ) / 2.0;
        case ePdfAlignment_Right:
            dX += (dWidth - m_pFont->GetFontMetrics()->StringWidth( rsText ) );

    this->DrawText( dX, dY, rsText );

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