HOWTO: Font Schrift in bestimmter Punktgröße erzeugen

Gilt ab 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));
}


Achtung: Sie benötigen das “-” als negatives Vorzeichen für den IfHeight member um die korrekte Schriftgröße zu benutzen.

IDKBTD000463 KBTD000463