Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,255
AccurateText=1
[Variables]
TopFontPadding=34
BottomFontPadding=21
; Use this for testing...
; [MeasureCPU]
; Measure=Calc
; Formula=(MeasureCPU % 100) + 1
; MinValue=0
; MaxValue=100
[MeasureCPU]
Measure=CPU
[MeterCPUBack]
Meter=String
FontFace=Segoe UI
FontSize=70
FontColor=0,255,0,255
StringEffect=Border
FontEffectColor=47,47,47,255
Padding=0,-#TopFontPadding#,0,-#BottomFontPadding#
AntiAlias=1
Text=CPU
[MeterCPUFill]
Meter=String
W=([MeterCPUBack:W] + 1)
H=([MeterCPUBack:H] - ([MeasureCPU:%] / 100) * [MeterCPUBack:H] + #TopFontPadding#)
FontFace=Segoe UI
FontSize=70
FontColor=150,150,150,255
StringEffect=Border
FontEffectColor=47,47,47,255
Padding=0,-#TopFontPadding#,0,-#BottomFontPadding#
AntiAlias=1
ClipString=1
Text=CPU
DynamicVariables=1
The issue is that all fonts have some built-in "padding" around the actual font glyphs, (probably to account for lower case letters like "y" or "g" that may go below the "baseline" and some symbols that may go above the "topline") and that amount of padding varies from font to font. You have to deal with this padding, either by sort of stripping it off, like I do with the negative Padding= options on the string meters, or by factoring it into the calculations for setting the height of the string.
What makes this complicated is that the padding around the characters in the font are not something you can really "know" or "calculate" based on FontSize, and you more or less have to get it with some trial and error. That makes it hard indeed to make this something that could easily be modified by a user for a different font or a different font size.
Not sure if I am missing something here, or if there is another way to come at this that can simplify it some.