Refer to: https://forum.rainmeter.net/viewtopic.php?t=22272
Gets current DPI setting from the registry
If DPIOverride is equal to 1 (ON), subtract font size by (font size multiplied by DPI)
Example, if DPI is set to 125% and Font Size is equal to 18:
18 minus (18 times 0.25) = 13.5 (Rounded to 14)
New font size equals 14
14 font size at 125% DPI equals 18
Result: Font size is now accurate
Change 18 in [InputTextFontSize] to your preferred font size at 100% DPI
This will result in accurate text for InputText fields regardless of the user's DPI setting or if they have Rainmeter set to DPI override — the only stipulation being that if Rainmeter is set to DPI override, that the user toggles #DPIOverride# to 1. This can be acheived with a built-in toggle switch in your skins.
Code: Select all
[Variables]
DPIOverride=1
[MeasureRegistry]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\Desktop\WindowMetrics
RegValue=AppliedDPI
UpdateDivider=-1
[InputTextFontSize]
Measure=Calc
Formula=(#DPIOverride#=1?ROUND(18-(18*((((ROUND(([MeasureRegistry]/100)/0.25)))*0.25)-1))):18)
DynamicVariables=1
[Section1InputText1]
Measure=Plugin
Plugin=InputText.dll
FontColor=255,255,255
FontFace=Arial
FontSize=[InputTextFontSize]
AntiAlias=1
SolidColor=30,30,30
W=100
H=30
FocusDismiss=1
Command1=[!SetVariable userInput "$UserInput$"][!Update]
DefaultValue=""
DynamicVariables=1