@@ -240,6 +240,8 @@ WCHAR xg_szCellFont[LF_FACESIZE] = L"";
240240LOGFONTW xg_lfCellLogFont = {};
241241// 小さな文字のフォント。
242242WCHAR xg_szSmallFont[LF_FACESIZE ] = L" " ;
243+ // 小さな文字のフォント(LOGFONTW形式)。サイズは固定で変更しない。
244+ LOGFONTW xg_lfSmallLogFont = {};
243245// UIフォント。
244246WCHAR xg_szUIFont[LF_FACESIZE ] = L" " ;
245247
@@ -913,6 +915,7 @@ void XgResetSettings(void)
913915 xg_szCellFont[0 ] = 0 ;
914916 ZeroMemory (&xg_lfCellLogFont, sizeof (xg_lfCellLogFont));
915917 xg_szSmallFont[0 ] = 0 ;
918+ ZeroMemory (&xg_lfSmallLogFont, sizeof (xg_lfSmallLogFont));
916919 xg_szUIFont[0 ] = 0 ;
917920 xg_bShowToolBar = true ;
918921 s_bShowStatusBar = true ;
@@ -1127,6 +1130,21 @@ bool __fastcall XgLoadSettings(void)
11271130 if (!app_key.QuerySz (L" SmallFont" , sz, _countof (sz))) {
11281131 StringCchCopy (xg_szSmallFont, _countof (xg_szSmallFont), sz);
11291132 }
1133+ {
1134+ // xg_lfSmallLogFont をレジストリから読み込む(サイズフィールドは除く)。
1135+ LOGFONTW lf;
1136+ if (!app_key.QueryStruct (L" SmallLogFont" , lf)) {
1137+ lf.lfHeight = xg_lfSmallLogFont.lfHeight ;
1138+ lf.lfWidth = xg_lfSmallLogFont.lfWidth ;
1139+ xg_lfSmallLogFont = lf;
1140+ // SmallFont(上で読み込み済み)のフォント名を優先する。
1141+ if (xg_szSmallFont[0 ])
1142+ StringCchCopy (xg_lfSmallLogFont.lfFaceName , _countof (xg_lfSmallLogFont.lfFaceName ), xg_szSmallFont);
1143+ } else {
1144+ // SmallLogFontがなければSmallFontから互換復元する。
1145+ StringCchCopy (xg_lfSmallLogFont.lfFaceName , _countof (xg_lfSmallLogFont.lfFaceName ), xg_szSmallFont);
1146+ }
1147+ }
11301148 if (!app_key.QuerySz (L" UIFont" , sz, _countof (sz))) {
11311149 StringCchCopy (xg_szUIFont, _countof (xg_szUIFont), sz);
11321150 }
@@ -1369,6 +1387,13 @@ bool __fastcall XgSaveSettings(void)
13691387 lf.lfWidth = 0 ;
13701388 app_key.SetStruct (L" CellLogFont" , lf);
13711389 }
1390+ {
1391+ // xg_lfSmallLogFont をレジストリに保存する(サイズフィールドは除く)。
1392+ LOGFONTW lf = xg_lfSmallLogFont;
1393+ lf.lfHeight = 0 ;
1394+ lf.lfWidth = 0 ;
1395+ app_key.SetStruct (L" SmallLogFont" , lf);
1396+ }
13721397
13731398 app_key.SetDword (L" ShowToolBar" , xg_bShowToolBar);
13741399 app_key.SetDword (L" ShowStatusBar" , s_bShowStatusBar);
@@ -2161,6 +2186,23 @@ BOOL XgImportLooks(HWND hwnd, LPCWSTR pszFileName)
21612186
21622187 GetPrivateProfileStringW (L" Looks" , L" SmallFont" , L" " , szText, _countof (szText), pszFileName);
21632188 StringCchCopyW (xg_szSmallFont, _countof (xg_szSmallFont), szText);
2189+ // SmallLogFontがあれば優先して復元する。
2190+ GetPrivateProfileStringW (L" Looks" , L" SmallLogFont" , L" " , szText, _countof (szText), pszFileName);
2191+ if (szText[0 ]) {
2192+ std::vector<BYTE > data;
2193+ XgHexToBin (data, szText);
2194+ if (data.size () == sizeof (LOGFONTW )) {
2195+ const LONG lfHeight = xg_lfSmallLogFont.lfHeight ;
2196+ const LONG lfWidth = xg_lfSmallLogFont.lfWidth ;
2197+ memcpy (&xg_lfSmallLogFont, data.data (), sizeof (LOGFONTW ));
2198+ xg_lfSmallLogFont.lfHeight = lfHeight;
2199+ xg_lfSmallLogFont.lfWidth = lfWidth;
2200+ StringCchCopyW (xg_szSmallFont, _countof (xg_szSmallFont), xg_lfSmallLogFont.lfFaceName );
2201+ }
2202+ } else {
2203+ // SmallLogFontがなければSmallFontから互換復元する。
2204+ StringCchCopyW (xg_lfSmallLogFont.lfFaceName , _countof (xg_lfSmallLogFont.lfFaceName ), xg_szSmallFont);
2205+ }
21642206
21652207 // スケルトンビューか?
21662208 if (XgIsUserJapanese ())
@@ -2242,6 +2284,11 @@ BOOL XgExportLooks(HWND hwnd, LPCWSTR pszFileName)
22422284
22432285 // 小さい文字のフォント。
22442286 WritePrivateProfileStringW (L" Looks" , L" SmallFont" , xg_szSmallFont, pszFileName);
2287+ // SmallLogFontを保存する(互換のためSmallFontとSmallLogFontの両方を書き出す)。
2288+ {
2289+ XGStringW str = XgBinToHex (&xg_lfSmallLogFont, sizeof (xg_lfSmallLogFont));
2290+ WritePrivateProfileStringW (L" Looks" , L" SmallLogFont" , str.c_str (), pszFileName);
2291+ }
22452292
22462293 // もし黒マス画像が指定されていれば
22472294 if (xg_strBlackCellImage.size () && xg_strBlackCellImage != XgLoadStringDx1 (IDS_NONE ))
0 commit comments