Browse Source

Bug 1774: Configurable console/terminal font

https://winscp.net/tracker/1774

Source commit: 25ea34f4b12d8a9f25335d3514aa236aed9a575d
Martin Prikryl 6 years ago
parent
commit
451a280992
2 changed files with 16 additions and 2 deletions
  1. 14 2
      source/windows/CustomWinConfiguration.cpp
  2. 2 0
      source/windows/CustomWinConfiguration.h

+ 14 - 2
source/windows/CustomWinConfiguration.cpp

@@ -123,6 +123,8 @@ void __fastcall TCustomWinConfiguration::Default()
   FFontColors = L"";
   FCopyShortCutHintShown = false;
   FHttpForWebDAV = false;
+  FDefaultFixedWidthFontName = L"";
+  FDefaultFixedWidthFontSize = 0;
 
   DefaultHistory();
 }
@@ -153,6 +155,8 @@ void __fastcall TCustomWinConfiguration::Saved()
     KEY(String,   FontColors); \
     KEY(Bool,     CopyShortCutHintShown); \
     KEY(Bool,     HttpForWebDAV); \
+    KEY(String,   FDefaultFixedWidthFontName); \
+    KEY(Integer,  FDefaultFixedWidthFontSize); \
   ) \
   BLOCK(L"Interface\\SynchronizeChecklist", CANCREATE, \
     KEY(String,   SynchronizeChecklist.WindowParams); \
@@ -511,7 +515,11 @@ UnicodeString __fastcall TCustomWinConfiguration::GetDefaultFixedWidthFontName()
 {
   // These are defaults for respective version of Windows Notepad
   UnicodeString Result;
-  if (IsWin8())
+  if (!FDefaultFixedWidthFontName.IsEmpty())
+  {
+    Result = FDefaultFixedWidthFontName;
+  }
+  else if (IsWin8())
   {
     Result = L"Consolas";
   }
@@ -526,7 +534,11 @@ int __fastcall TCustomWinConfiguration::GetDefaultFixedWidthFontSize()
 {
   // These are defaults for respective version of Windows Notepad
   int Result;
-  if (IsWin8())
+  if (FDefaultFixedWidthFontSize != 0)
+  {
+    Result = FDefaultFixedWidthFontSize;
+  }
+  else if (IsWin8())
   {
     Result = 11;
   }

+ 2 - 0
source/windows/CustomWinConfiguration.h

@@ -62,6 +62,8 @@ private:
   bool FCopyShortCutHintShown;
   bool FHttpForWebDAV;
   TNotifyEvent FOnMasterPasswordRecrypt;
+  UnicodeString FDefaultFixedWidthFontName;
+  int FDefaultFixedWidthFontSize;
 
   void __fastcall SetInterface(TInterface value);
   void __fastcall SetHistory(const UnicodeString Index, TStrings * value);