OverlayBitmap::setFont Method |
||||||||||||||||||||
Sets the OverlayBitmaps object font to the specified font. | ||||||||||||||||||||
Syntax: | bool setFont(const char* faceName, int iSize = 10); bool setFont(const std::string& faceName, int iSize = 10); bool setFont(const std::wstring& szFaceName, int iSize = 10); bool setFont(IFont* pFont); |
|||||||||||||||||||
|
||||||||||||||||||||
Return value: | true on success, false otherwise. |
|||||||||||||||||||
Remarks: | This method is used to set a font for drawing text on the bitmap of the OverlayBitmap object. Once a font is set, it is used for all text drawings until a new font is set. The specified font is also used for the GDI TextOut() function. |
|||||||||||||||||||
Sample: | This example demonstrates how to set different font sizes. smart_ptr<DShowLib::OverlayBitmap> pOverlayBitmap; pOverlayBitmap = m_Grabber.getOverlay( ePP_DEVICE ); // Make sure, the overlay bitmap is enabled. pOverlayBitmap->setEnable(true); // Draw a big caption. pOverlayBitmap->setFont("Arial",20); pOverlayBitmap->drawText( RGB(255,0,0), 5, 0, "Caption" ); // Draw some text with a smaller font. pOverlayBitmap->setFont("Arial",10); pOverlayBitmap->drawText( RGB(255,0,0), 10, 35, "Text line 1" ); pOverlayBitmap->drawText( RGB(255,0,0), 10, 50, "Text line 2" ); |
|||||||||||||||||||
See also: | OverlayBitmap, OverlayBitmap::getFont, OverlayBitmap::drawText |