From 1c4fb70970b34dc6d1c294519e28f85f4970b3f9 Mon Sep 17 00:00:00 2001 From: Martijn Laan <1092369+martijnlaan@users.noreply.github.com> Date: Thu, 13 Jun 2024 11:23:07 +0200 Subject: [PATCH] Not related to isscint but: The editor's font now defaults to Consolas if available, consistent with most other editors. --- Projects/Src/CompForm.pas | 2 +- Projects/Src/CompFunc.pas | 12 ++++++++++++ whatsnew.htm | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Projects/Src/CompForm.pas b/Projects/Src/CompForm.pas index a2572be04..e7ae93832 100644 --- a/Projects/Src/CompForm.pas +++ b/Projects/Src/CompForm.pas @@ -671,7 +671,7 @@ function TCompileForm.InitializeMemoBase(const Memo: TCompScintEdit; const Popup Memo.Align := alClient; Memo.AutoCompleteFontName := Font.Name; Memo.AutoCompleteFontSize := Font.Size; - Memo.Font.Name := 'Courier New'; + Memo.Font.Name := GetPreferredMemoFont; Memo.Font.Size := 10; Memo.ShowHint := True; Memo.Styler := FMemosStyler; diff --git a/Projects/Src/CompFunc.pas b/Projects/Src/CompFunc.pas index 1089a27f6..88a59733e 100644 --- a/Projects/Src/CompFunc.pas +++ b/Projects/Src/CompFunc.pas @@ -71,6 +71,7 @@ function ReadScriptLines(const ALines: TStringList; const ReadFromFile: Boolean; function CreateBitmapInfo(const Width, Height, BitCount: Integer): TBitmapInfo; function GetWordOccurrenceFindOptions: TScintFindOptions; function GetSelTextOccurrenceFindOptions: TScintFindOptions; +function GetPreferredMemoFont: String; implementation @@ -725,10 +726,21 @@ function GetSelTextOccurrenceFindOptions: TScintFindOptions; Result := []; end; +var + PreferredMemoFont: String; + +function GetPreferredMemoFont: String; +begin + Result := PreferredMemoFont; +end; + initialization var OSVersionInfo: TOSVersionInfo; OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo); GetVersionEx(OSVersionInfo); WindowsVersion := (Byte(OSVersionInfo.dwMajorVersion) shl 24) or (Byte(OSVersionInfo.dwMinorVersion) shl 16) or Word(OSVersionInfo.dwBuildNumber); + PreferredMemoFont := 'Consolas'; + if not FontExists(PreferredMemoFont) then + PreferredMemoFont := 'Courier New'; end. diff --git a/whatsnew.htm b/whatsnew.htm index 096d30ccd..760a96ff4 100644 --- a/whatsnew.htm +++ b/whatsnew.htm @@ -45,6 +45,7 @@
Other changes: