It is currently April 24th, 2024, 3:35 am

overlapping text when changing fontsize

Get help with creating, editing & fixing problems with skins
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

overlapping text when changing fontsize

Post by JamX »

suppose I have 2 meter.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
FontName=Open Sans Light
FontColor=255,255,255,255
FontHeight=20

[sTextRight]
FontFace=#FontName#
FontSize=#FontHeight#
FontColor=#FontColor#
StringAlign=RIGHT
StringEffect=SHADOW
FontEffectColor=0,0,0,100
Antialias=1

[Label1]
Meter=STRING
MeterStyle= sTextRight
Text= World
X=150
Y=150

[Label2]
Meter=STRING
MeterStyle= sTextRight
Text= Hello
X=50r
Y=r
The 2nd meter 50 unit to the right of the 1st meter when I reference it with X=50r

When I change FontHeight=12 to FontHeight=20 the 2 meters overwrites each other because the font is larger then before.

Maybe stupid question but, is the a way to make the reference of the 2nd label, which is now "X=50r" variable so it will fit whatever I type into the variable: FontHeight=.. ?

Or is there another way to do this?

Thanks in advance...
User avatar
Brian
Developer
Posts: 2681
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: overlapping text when changing fontsize

Post by Brian »

Maybe instead of r relative positioning, try R instead.

The lowercase r basically means use the previous meter's top or left edge as a starting point. Uppercase R basically means use the previous meter's bottom or right edge.

So, something like X=5R, which would position the next meter 5 pixels to the right of the first meter - regardless of the size of the first meter.

https://docs.rainmeter.net/manual/meters/general-options/#XY

This way, no matter what the value of "FontHeight" is, you can position the meters next to each other without overlap.

-Brian
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: overlapping text when changing fontsize

Post by JamX »

Thx, after q3 F1 I Will try.
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: overlapping text when changing fontsize

Post by JamX »

OK that worked, thx.

But another question:
I have below code for getting stock price from yahoo finance.
Almost all is working. I see price change etc.
The only thing not working is the [!SetVariable SignStock1 "↑" ][!Updatemeter "LabelUpDownStock1"][!redraw]

I see the variable SignStock1 is changed in " arrow down" which is OK.
rain1.jpg
But when I look at the skin I see:
rain2.jpg
Here is the code:

Code: Select all

[Rainmeter]
DynamicWindowSize=1
AccurateText=1

[Variables]
UpdateQuotes=600
FontColor=155,155,155,155
Highlight=255,255,255,155
FontName=Open Sans Light
FontHeight=25


;yahoo
ExpQuote=(?siU).*" data-reactid="58".* data-symbol="(.*)".*value="(.*)".*value="(.*)".*value="(.*)".*

;tickers
SymbolStock1=UMI.BR
AankoopPrijsStock1=0
KoopSignaalStock1=40
DecStock1=2

; --- STYLES ---
[sTextLeft]
FontFace=#FontName#
FontSize=#FontHeight#
FontColor=#FontColor#
StringAlign=LEFT
StringEffect=SHADOW
FontEffectColor=0,0,0,100
Antialias=1



; --- Measures  Stock1
[InfoIndexStock1]
Measure=WebParser
URL=https://finance.yahoo.com/chart/#SymbolStock1#
RegExp=#ExpQuote#
StringIndex=1
UpdateRate=#UpdateQuotes#
FinishAction=[!EnableMeasureGroup Stock1]

[mIndexStock1_Price]
Group=Stock1
Disabled=1
Measure=WebParser
Url=[InfoIndexStock1]
StringIndex=2
Substitute=",":""

[mIndexStock1.1_Price]
Group=Stock1
Disabled=1
Measure=Calc
Formula=[mIndexStock1_Price]*1
DynamicVariables=1

[mIndexStock1_Change]
Group=Stock1
Disabled=1
Measure=WebParser
Url=[InfoIndexStock1]
StringIndex=3

[mIndexStock1.1_Change]
Group=Stock1
Disabled=1
Measure=Calc
Formula=[mIndexStock1_Change]*1
DynamicVariables=1

IfCondition=(mIndexStock1.1_Change > 0)
IfTrueAction=[!SetVariable  SignStock1 "↑" ][!Updatemeter "LabelUpDownStock1"][!redraw]
IfCondition2=(mIndexStock1.1_Change = 0)
IfTrueAction2=[!SetVariable  SignStock1 "−" ][!Updatemeter "LabelUpDownStock1"][!redraw]
IfCondition3=(mIndexStock1.1_Change < 0)
IfTrueAction3=[!SetVariable  SignStock1 "↓" ][!Updatemeter "LabelUpDownStock1"][!redraw]

[mIndexStock1_ChangePer]
Group=Stock1
Disabled=1
Measure=WebParser
Url=[InfoIndexStock1]
StringIndex=4

[mIndexStock1.1_ChangePer]
Group=Stock1
Disabled=1
Measure=Calc
Formula=[mIndexStock1_ChangePer]*100
DynamicVariables=1

; ---  METERS ---

[LabelIndexStock1]
MeasureName=InfoIndexStock1
Meter=STRING
MeterStyle=sTextleft
MouseOverAction=[!SetOption "#CURRENTSECTION#" FontColor #Highlight#] [!Update]
MouseLeaveAction=[!SetOption "#CURRENTSECTION#" FontColor #FontColor#] [!Update]
LeftMouseUpAction=https://finance.yahoo.com/chart/#SymbolStock1#
X=200
Y=510
Postfix=" - EUR"

[LabelPriceStock1]
Meter=STRING
MeasureName=mIndexStock1.1_Price
MeterStyle= sTextleft
X=20R
Y=r
NumofDecimals=#DecStock1#

[LabelUpDownStock1]
Meter=STRING
MeterStyle= sTextleft
X=20R
Y=r
Text= #SignStock1#


[LabelIndexStock1_Change]
MeasureName=mIndexStock1.1_Change
Meter=STRING
MeterStyle= sTextleft
x=20R
y=r
NumofDecimals=#DecStock1#

[LabelIndexStock1_ChangePer]
MeasureName=mIndexStock1.1_ChangePer
Meter=STRING
MeterStyle=sTextleft 
x=20R
y=r
Text=(%1%)
NumofDecimals=2
Any help is welcome
You do not have the required permissions to view the files attached to this post.
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: overlapping text when changing fontsize

Post by JamX »

Already solved.
After adding dynamicvariables=1 to the [labelupdownstock1] meter it worked.