IC Imaging Control C++

OverlayBitmap::setFont Method

OverlayBitmap::setFont Method

Sets the OverlayBitmaps object font to the specified font.
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);

Parameter Description

A null-terminated string that specifies the typeface name of the font. The length of this string must not exceed 30 characters.


Specifies the desired size (in logical units) of the font. It defaults to 10


Interface pointer to an IFont COM font object pointer.

Return value:

true on success, false otherwise.


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.


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.

// Draw a big caption.
pOverlayBitmap->drawText( RGB(255,0,0),  5, 0, "Caption" );

// Draw some text with a smaller font.
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

<< OverlayBitmap

Get in touch with us

About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us