HOWTO: Create Font With Dedicated Point Size

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