+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

HOWTO: Create Font With Dedicated Point Size

designer
(combit Team) #1
Valid from List & Label 16
inline int PT2HMM(INT pt, BOOL bInch)
{
    if (bInch)
    return(MulDiv(pt,100,72));
    else
    return(MulDiv(pt,254,72));
}

HFONT CreateFontScaled(LOGFONT* pLogFont, UINT nSize, BOOL bInch)
{
    LOGFONT lf = *pLogFont;
    lf.lfHeight = -PT2HMM(nSize,bInch);
    return(::CreateFontIndirect(&lf));
}


Attention: you need a “-” (negation) for the lfHeight member to use the correct font size.

IDKBTE000460 KBTE000460