#include #include Font &Font::operator=(const Font &someFont) { if(someFont.isOkay()) { mPitchAndFamily=someFont.mPitchAndFamily; mWeight=someFont.mWeight; mFontStyle=someFont.mFontStyle; mFontSize=someFont.mFontSize; mCharSet=someFont.mCharSet; createFont(); } return *this; } void Font::createFont(void) { PureDevice screenDevice; TEXTMETRIC tm; int fontHeight; destroyFont(); screenDevice.screenDevice(); fontHeight=::MulDiv(((short)mFontSize),::GetDeviceCaps(screenDevice,LOGPIXELSY),72); mhFont=::CreateFont(fontHeight,0,0,0,mWeight,0,0,0, mCharSet,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,mPitchAndFamily,mFontStyle.str()); screenDevice.select(mhFont); ::GetTextMetrics(screenDevice,&tm); charHeight(tm.tmHeight+tm.tmExternalLeading); pureHeight(tm.tmHeight); avgCharWidth(tm.tmAveCharWidth); maxCharWidth(tm.tmMaxCharWidth); }