MCPcopy Create free account
hub / github.com/WinMerge/winmerge / Load

Function Load

Src/OptionsFont.cpp:115–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115LOGFONT 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
142void Save(COptionsMgr *pOptionsMgr, const String& name, const LOGFONT* lf, bool bUseCustom)
143{

Callers 15

InitDiffContextMethod · 0.70
BrowseColorAndSaveMethod · 0.70
CMergeStatusBarMethod · 0.70
InitInstanceMethod · 0.70
ReadOptionsMethod · 0.70
BrowseColorMethod · 0.70
OnViewUsedefaultfontMethod · 0.70
OnSettingChangeMethod · 0.70
CMergeDocMethod · 0.70
RefreshOptionsMethod · 0.70
ReadOptionsMethod · 0.70
BrowseColorMethod · 0.70

Calls 3

GetIntMethod · 0.45
GetBoolMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected