diff --git a/functions/private/Invoke-WinUtilFontScaling.ps1 b/functions/private/Invoke-WinUtilFontScaling.ps1
new file mode 100644
index 00000000..16a9bbd3
--- /dev/null
+++ b/functions/private/Invoke-WinUtilFontScaling.ps1
@@ -0,0 +1,72 @@
+function Invoke-WinUtilFontScaling {
+ <#
+
+ .SYNOPSIS
+ Applies UI and font scaling for accessibility
+
+ .PARAMETER ScaleFactor
+ Sets the scaling from 0.75 and 2.0.
+ Default is 1.0 (100% - no scaling)
+
+ .EXAMPLE
+ Invoke-WinUtilFontScaling -ScaleFactor 1.25
+ # Applies 125% scaling
+ #>
+
+ param (
+ [double]$ScaleFactor = 1.0
+ )
+
+ # Validate if scale factor is within the range
+ if ($ScaleFactor -lt 0.75 -or $ScaleFactor -gt 2.0) {
+ Write-Warning "Scale factor must be between 0.75 and 2.0. Using 1.0 instead."
+ $ScaleFactor = 1.0
+ }
+
+ # Define an array for resources to be scaled
+ $fontResources = @(
+ "FontSize",
+ "ButtonFontSize",
+ "HeaderFontSize",
+ "TabButtonFontSize",
+ "IconFontSize",
+ "SettingsIconFontSize",
+ "CloseIconFontSize",
+ "AppEntryFontSize",
+ "SearchBarTextBoxFontSize",
+ "SearchBarClearButtonFontSize",
+ "CustomDialogFontSize",
+ "CustomDialogFontSizeHeader",
+ "ConfigUpdateButtonFontSize",
+ "CheckBoxBulletDecoratorSize"
+ )
+
+ # Apply scaling to each resource
+ foreach ($resourceName in $fontResources) {
+ try {
+ # Get the default font size from the theme configuration
+ $originalValue = $sync.configs.themes.shared.$resourceName
+ if ($originalValue) {
+ # Convert string to double since values are stored as strings
+ $originalValue = [double]$originalValue
+ # Calculates and applies the new font size
+ $newValue = [math]::Round($originalValue * $ScaleFactor, 1)
+ $sync.Form.Resources[$resourceName] = $newValue
+ Write-Debug "Scaled $resourceName from original $originalValue to $newValue (factor: $ScaleFactor)"
+ }
+ }
+ catch {
+ Write-Warning "Failed to scale resource $resourceName : $_"
+ }
+ }
+
+ # Update the font scaling percentage displayed on the UI
+ if ($sync.FontScalingValue) {
+ $percentage = [math]::Round($ScaleFactor * 100)
+ $sync.FontScalingValue.Text = "$percentage%"
+ }
+
+ Write-Debug "Font scaling applied with factor: $ScaleFactor"
+}
+
+
diff --git a/scripts/main.ps1 b/scripts/main.ps1
index 5e0099f1..9fb3773d 100644
--- a/scripts/main.ps1
+++ b/scripts/main.ps1
@@ -261,7 +261,7 @@ $commonKeyEvents = {
$sync["Form"].Add_PreViewKeyDown($commonKeyEvents)
$sync["Form"].Add_MouseLeftButtonDown({
- Invoke-WPFPopup -Action "Hide" -Popups @("Settings", "Theme")
+ Invoke-WPFPopup -Action "Hide" -Popups @("Settings", "Theme", "FontScaling")
$sync["Form"].DragMove()
})
@@ -279,7 +279,7 @@ $sync["Form"].Add_MouseDoubleClick({
$sync["Form"].Add_Deactivated({
Write-Debug "WinUtil lost focus"
- Invoke-WPFPopup -Action "Hide" -Popups @("Settings", "Theme")
+ Invoke-WPFPopup -Action "Hide" -Popups @("Settings", "Theme", "FontScaling")
})
$sync["Form"].Add_ContentRendered({
@@ -441,7 +441,7 @@ $sync["Form"].Add_Activated({
$sync["ThemeButton"].Add_Click({
Write-Debug "ThemeButton clicked"
- Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Hide"; "Theme" = "Toggle" }
+ Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Hide"; "Theme" = "Toggle"; "FontScaling" = "Hide" }
})
$sync["AutoThemeMenuItem"].Add_Click({
Write-Debug "About clicked"
@@ -461,7 +461,7 @@ $sync["LightThemeMenuItem"].Add_Click({
$sync["SettingsButton"].Add_Click({
Write-Debug "SettingsButton clicked"
- Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Toggle"; "Theme" = "Hide" }
+ Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Toggle"; "Theme" = "Hide"; "FontScaling" = "Hide" }
})
$sync["ImportMenuItem"].Add_Click({
Write-Debug "Import clicked"
@@ -506,5 +506,30 @@ $sync["SponsorMenuItem"].Add_Click({
Show-CustomDialog -Title "Sponsors" -Message $authorInfo -EnableScroll $true
})
+# Font Scaling Event Handlers
+$sync["FontScalingButton"].Add_Click({
+ Write-Debug "FontScalingButton clicked"
+ Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Hide"; "Theme" = "Hide"; "FontScaling" = "Toggle" }
+})
+
+$sync["FontScalingSlider"].Add_ValueChanged({
+ param($slider)
+ $percentage = [math]::Round($slider.Value * 100)
+ $sync.FontScalingValue.Text = "$percentage%"
+})
+
+$sync["FontScalingResetButton"].Add_Click({
+ Write-Debug "FontScalingResetButton clicked"
+ $sync.FontScalingSlider.Value = 1.0
+ $sync.FontScalingValue.Text = "100%"
+})
+
+$sync["FontScalingApplyButton"].Add_Click({
+ Write-Debug "FontScalingApplyButton clicked"
+ $scaleFactor = $sync.FontScalingSlider.Value
+ Invoke-WinUtilFontScaling -ScaleFactor $scaleFactor
+ Invoke-WPFPopup -Action "Hide" -Popups @("FontScaling")
+})
+
$sync["Form"].ShowDialog() | out-null
Stop-Transcript
diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml
index 914a7b77..8719dc91 100644
--- a/xaml/inputXML.xaml
+++ b/xaml/inputXML.xaml
@@ -948,6 +948,7 @@
+