I'm building an "utility skin" for myself in order to find the Unicode character whose W and H are the same for all fonts (by the way, if anyone knows which is that character, if it exists, feel free to save me of the trouble to find out and let me know), by trying to iterate through all system fonts (done) and every Unicode character (to be done) to find it, and I've discovered something...
Skin:
Not sure if it's a bug or the intended behavior, but it still feels wrong in this case and obviously it affects the visual outcome of the skin:
Code: Select all
[Variables]
FontIdx=0
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,128
---Measures---
[FontList]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
OutputType=ValueList
UpdateDivider=-1
[FontItem]
Measure=String
String=[FontList]
RegExpSubstitute=1
Substitute="(?siU)^(?:.*\R){0,#FontIdx#}?(.*) [(].*[)]\R.*$":"\1"
UpdateDivider=-1
DynamicVariables=1
---Meters---
[FontText]
Meter=String
W=500
FontEffectColor=0,0,0,255
FontColor=255,255,255,255
StringEffect=Shadow
; - Variable FontFace, Fixed Setting (issue: pattern inherits FontFace's weight and italic status) -
FontFace=[FontItem]
InlinePattern=^(.*?: ).*$
InlineSetting=Face | Tahoma
; - Have to manually reset pattern's weight to its Face default because of the above (possible: Y) -
InlinePattern2=^(.*?: ).*$
InlineSetting2=Weight | 400
; - Have to manually reset pattern's italic to its Face default because of the above (possible: N) -
;InlinePattern3=^(.*?: ).*$
;InlineSetting3=Italic | Yes or No
FontSize=16
AntiAlias=1
ClipString=2
UpdateDivider=-1
MeasureName=FontItem
Text=Font Item: %1
MouseScrollUpAction=[!SetVariable FontIdx (#FontIdx#-1)][!UpdateMeasure FontItem][!UpdateMeter FontText][!Redraw]
MouseScrollDownAction=[!SetVariable FontIdx (#FontIdx#+1)][!UpdateMeasure FontItem][!UpdateMeter FontText][!Redraw]
DynamicVariables=1
- the 1st part of the string (i.e. Font Item: ) to stay Tahoma in its regular and non-italic default form
- the 2nd part of the string (i.e. [FontItem] aka %1) to be displayed according to the iterated font with its own weight and italic status
The "BUG":
If I only let the 1st InlineSetting above (like it should be normal and enough, at least in this case), the 1st part of the string inherits the weight and italic status from the 2nd part of the string aka the iterated font. Now, this might be the desired behavior in some cases when you'd want that status preserved, but it's not in this particular case, since it's about an entirely different font face... with its own weight and italic style. Hence, not sure it's a bug.
The "SUGGESTION":
To get to the desired form, I added the 2nd InlineSetting, which sets (back) the Weight of the 1st part of the string to its default (and font specific) value. However, I can't do that for the Italic status with the 3nd InlineSetting, since apparently, both the Italic and the Oblique inline settings assume the user only wants to turn the Italic/Oblique on and not off. Hence, the suggestion to add the possibility of setting those states OFF if desired, which would probably offer a solution to the "bug" as well.
Note:
The above behavior is also true if I'm doing things the other way, by setting the FontFace to Tahoma and the iniline Setting to the iterated font. Of course, the current code is more suited since when doing things the other way I'd have to check the iterated font face name for parts like "Bold", "Regular", "Italic" and so on.