Initial Commit
This commit is contained in:
37
common/FONT.CPP
Normal file
37
common/FONT.CPP
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <common/font.hpp>
|
||||
#include <common/purehdc.hpp>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user