OverlayBitmap::getFont Method

Retrieves a pointer to an IFont COM font object pointer.
Syntax:
IFont* getFont() const;
Return value:

A pointer to an IFont COM font object pointer.

Remarks:

An IFont COM font object is an object wrapper around a Windows font object. For more information about the IFont COM font please refer to the MSDN Library.

Important: The IFont COM object pointer retrieved by getFont() must be stored in a local IFont pointer variable. For example, getFont()->put_Underline(TRUE) is not allowed.

If the IFont interface is not used anymore, the IFont::Release() method must be called to avoid memory leaks.

Sample:

This example demonstrates how to draw underlined, bold text.

smart_ptr<DShowLib::OverlayBitmap> pOverlayBitmap;
IFont *piFont = NULL;
pOverlayBitmap = m_Grabber.getOverlay( ePP_DEVICE );
// Make sure, the overlay bitmap is enabled.
pOverlayBitmap->setEnable(true);
// Set a font.
pOverlayBitmap->setFont("Arial",20);
// Retrieve the IFont interface pointer.
piFont = pOverlayBitmap->getFont();
piFont->put_Underline( TRUE );
piFont->put_Bold( TRUE );
// If the retrieved IFont interface is no longer used,
// Release() must be called.
piFont->Release();
// Now, draw the text.
pOverlayBitmap->drawText( RGB(255,0,0),  5, 0, "Underlined text" );

See also: OverlayBitmap, OverlayBitmap::getFont, OverlayBitmap::drawText

<< OverlayBitmap