diff --git a/OPTIONS.md b/OPTIONS.md
index 9d7c429..7e0c9b6 100644
--- a/OPTIONS.md
+++ b/OPTIONS.md
@@ -237,6 +237,20 @@ These keys are also stored in `QuickLook.config`.
- Example:
- `True`
+### ``
+- Default: default font of the current language
+- Type: `String`
+- Description: Allow setting of the font used in the text viewer.
+- Example:
+ - `Cascadia Mono SemiLight`
+
+### ``
+- Default: 14.0
+- Type: `Double`
+- Description: Allow setting of font size used in the text viewer.
+- Example:
+ - `13`
+
## Notes
- All option names are case-sensitive and stored as XML element names under ``.
diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs
index a07c6e6..7952559 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs
+++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs
@@ -72,7 +72,6 @@ public partial class TextViewerPanel : TextEditor, IDisposable
public TextViewerPanel()
{
- FontSize = 14;
ShowLineNumbers = true;
WordWrap = true;
IsReadOnly = true;
@@ -117,8 +116,13 @@ public partial class TextViewerPanel : TextEditor, IDisposable
PreviewMouseWheel += Viewer_MouseWheel;
- FontFamily = new FontFamily(TranslationHelper.Get("Editor_FontFamily",
- domain: Assembly.GetExecutingAssembly().GetName().Name));
+ // Read configured font size and validate it to avoid negative or unreasonable values
+ FontSize = Math.Max(1d, Math.Min(72d, SettingHelper.Get("FontSize", 14d, "QuickLook.Plugin.TextViewer")));
+ FontFamily = new FontFamily(
+ SettingHelper.Get("FontFamily",
+ failsafe: TranslationHelper.Get("Editor_FontFamily",
+ domain: Assembly.GetExecutingAssembly().GetName().Name),
+ "QuickLook.Plugin.TextViewer"));
// Add a custom element generator (e.g., to truncate extremely long lines).
TextArea.TextView.ElementGenerators.Add(new TruncateLongLines());