Product Home Class IndexDownload

CK_WindowsFont

CK_Font
 |
 +----CK_WindowsFont

The CK_WindowsFont class represents a Windows font. Objects of this class are created from an HFONT, which is a handle to a Windows font obtained from the CreateFont or CreateFontIndirect Windows API functions. Fonts are used by the CK_Label and CK_LineEdit interface components to draw text. To use a font in a component, the CP_Font property should be set by calling setProp() and passing a pointer to a CK_Font object.

The code segment below shows an example of creating a CK_WindowsFont object.

    HDC	hdc = GetDC(0);

    LOGFONT lf;
    memset(&lf,'\0',sizeof lf);
    lf.lfHeight = -MulDiv(7,GetDeviceCaps(hdc,LOGPIXELSY),72);
    strcpy(lf.lfFaceName,"Arial");
    lf.lfWeight = FW_NORMAL;

    HFONT hfnt = CreateFontIndirect(&lf);

    ReleaseDC(0,hdc);

    CK_WindowsFont *font = new CK_WindowsFont(hfnt);

Constructors

CK_WindowsFont(HFONT font)
Construct a CK_WindowsFont from a handle to a Windows font.

Public Methods

getFont
Return the HFONT contained in this object.

The constructor stores the HFONT pointer within the object.

Returns the HFONT contained in the CK_WindowsFont object.