Tech Support > Microsoft Windows > Drivers > Re: DrvTextOut -> font-size?
Re: DrvTextOut -> font-size?
Posted by Eric Brown on April 1st, 2004


MR,

Something like this will get you sizes in device coordinates. The emHeight is the height
of the
font selection by the font mapper (i.e., corresponds to the nHeight parameter to
CreateFont)

PIFIMETRICS pifi = FONTOBJ_pifi(pfo);
XFORMOBJ * xformObj = FONTOBJ_pxoGetXform(pfo);
if (xformObj)
{
XFORML xform;
if (DDI_ERROR != XFORMOBJ_iGetXform(xformObj, &xform))
{
float eXScale = (float)sqrt(xform.eM11 * xform.eM11 + xform.eM12 * xform.eM12);
float eYScale = (float)sqrt(xform.eM22 * xform.eM22 + xform.eM21 * xform.eM21);

int maxCharInc = pifi->fwdMaxCharInc * eXScale;
int aveCharWidth = pifi->fwdAveCharWidth * eXScale;
int emHeight = pifi->fwdUnitsPerEm * eYScale;
int ascent = pifi->fwdWinAscender * eYScale;
int descent = pifi->fwdWinDescender * eYScale;
int capHeight = pifi->fwdCapHeight * eYScale;

LPWSTR strFamilyName() = (LPWSTR)(((PBYTE)pifi) + pifi->dpwszFamilyName);
LPWSTR strStyleName() = (LPWSTR)(((PBYTE)pifi) + pifi->dpwszStyleName);
LPWSTR strFaceName() = (LPWSTR)(((PBYTE)pifi) + pifi->dpwszFaceName);
LPWSTR strUniqueName() = (LPWSTR)(((PBYTE)pifi) + pifi->dpwszUniqueName);
}
}

Eric

"Meier Rudolf" <meiru@gmx.net> wrote in message
news:%23VgiIAeFEHA.1396@TK2MSFTNGP11.phx.gbl...


Posted by Meier Rudolf on April 1st, 2004


Hi

thanks for your help. My fault was, that I didn't understand the
"em-height"... but now it's clear and it's working now.

MR



Similar Posts