| 113 | } |
| 114 | |
| 115 | LOGFONT Load(const COptionsMgr *pOptionsMgr, const String& name) |
| 116 | { |
| 117 | // Build a new LOGFONT with values from the 'actual' values of the in-memory Options::Font table. |
| 118 | // The Registry is not accessed. |
| 119 | LOGFONT lfnew = { 0 }; |
| 120 | HDC hDC = GetDC(nullptr); |
| 121 | lfnew.lfHeight = -MulDiv(pOptionsMgr->GetInt(name + OPT_FONT_POINTSIZE), GetDeviceCaps(hDC, LOGPIXELSY), 72); |
| 122 | if (lfnew.lfHeight == 0) |
| 123 | lfnew.lfHeight = pOptionsMgr->GetInt(name + OPT_FONT_HEIGHT); |
| 124 | lfnew.lfWidth = 0; |
| 125 | lfnew.lfEscapement = pOptionsMgr->GetInt(name + OPT_FONT_ESCAPEMENT); |
| 126 | lfnew.lfOrientation = pOptionsMgr->GetInt(name + OPT_FONT_ORIENTATION); |
| 127 | lfnew.lfWeight = pOptionsMgr->GetInt(name + OPT_FONT_WEIGHT); |
| 128 | lfnew.lfItalic = pOptionsMgr->GetBool(name + OPT_FONT_ITALIC); |
| 129 | lfnew.lfUnderline = pOptionsMgr->GetBool(name + OPT_FONT_UNDERLINE); |
| 130 | lfnew.lfStrikeOut = pOptionsMgr->GetBool(name + OPT_FONT_STRIKEOUT); |
| 131 | lfnew.lfCharSet = static_cast<BYTE>(pOptionsMgr->GetInt(name + OPT_FONT_CHARSET)); |
| 132 | lfnew.lfOutPrecision = static_cast<BYTE>(pOptionsMgr->GetInt(name + OPT_FONT_OUTPRECISION)); |
| 133 | lfnew.lfClipPrecision = static_cast<BYTE>(pOptionsMgr->GetInt(name + OPT_FONT_CLIPPRECISION)); |
| 134 | lfnew.lfQuality = static_cast<BYTE>(pOptionsMgr->GetInt(name + OPT_FONT_QUALITY)); |
| 135 | lfnew.lfPitchAndFamily = static_cast<BYTE>(pOptionsMgr->GetInt(name + OPT_FONT_PITCHANDFAMILY)); |
| 136 | lstrcpyn(lfnew.lfFaceName, |
| 137 | pOptionsMgr->GetString(name + OPT_FONT_FACENAME).c_str(), sizeof(lfnew.lfFaceName)/sizeof(lfnew.lfFaceName[0])); |
| 138 | ReleaseDC(nullptr, hDC); |
| 139 | return lfnew; |
| 140 | } |
| 141 | |
| 142 | void Save(COptionsMgr *pOptionsMgr, const String& name, const LOGFONT* lf, bool bUseCustom) |
| 143 | { |
no test coverage detected