It is currently April 24th, 2024, 7:25 am

ClipString problem

Get help with creating, editing & fixing problems with skins
Alilliender
Posts: 2
Joined: August 10th, 2021, 11:56 pm

ClipString problem

Post by Alilliender »

Hey everyone,

Having a problem with clipstring trying to generate text outside my specified width dimensions. I think it might have something to do with fontweight.

It's displaying from a Spotify measure and I noticed it playing Jigsaw Falling Into Place by Radiohead. First time I've had a problem that hasn't been fixed by a quick search.

Here's my code, I've added solidcolor to show where I'm trying to keep my text.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Size=1
Colour=255,255,255,255

[MeasureT]
Measure=NowPlaying
PlayerName=Spotify
PlayerType=Title

[MeasureA]
Measure=NowPlaying
PlayerName=Spotify
PlayerType=Artist

[MeterT]
Meter=String
MeasureName=MeasureT
FontFace=Roboto
Fontcolor=#Colour#
FontSize=(#Size#*30)
FontWeight=450
StringAlign=Right
ClipString=1
W=(#Size#*360)
X=(#Size#*360)
Antialias=1
SolidColor=0,255,0,120

[MeterA]
Meter=String
MeasureName=MeasureA
FontFace=Roboto
Fontcolor=#Colour#
FontSize=(#Size#*20)
FontWeight=300
StringAlign=Right
ClipString=1
W=(#Size#*360)
X=(#Size#*360)
Y=R
Antialias=1
SolidColor=0,255,0,120
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: ClipString problem

Post by CodeCode »

If you are using the #size# variable to dynamically change the width of your skin, and that is deliberate. ClipString is not really needed.

If you want to limit how far the skin changes there are a couple ways.
1) Create a container shape with the dimensions of your outer bounds. Make the shape be 0,0,0,1.
https://docs.rainmeter.net/manual/meters/general-options/container/

2) Using a clamp in your formulas:
Clamp(x, low, high): Restricts value x to low and high limits.
EDIT: Look here: https://forum.rainmeter.net/viewtopic.php?f=5&t=38087&start=20#p195424 for more on containers for text management. In this case the text was resized according to how many characters wide the shape is. It should provide insight in the least.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
Alilliender
Posts: 2
Joined: August 10th, 2021, 11:56 pm

Re: ClipString problem

Post by Alilliender »

This helped but not how I thought it would:
CodeCode wrote: August 11th, 2021, 1:34 am EDIT: Look here: https://forum.rainmeter.net/viewtopic.php?f=5&t=38087&start=20#p195424 for more on containers for text management. In this case the text was resized according to how many characters wide the shape is. It should provide insight in the least.
I wanted to keep my FontSize static and the text clipped to keep a maximum width. #Size# was only there to scale everything at the same rate. Turns out all I needed was the AccurateText=1 setting so it could recognize the size of the characters after changing FontWeight.

Cheers for the help!
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ClipString problem

Post by balala »

Alilliender wrote: August 11th, 2021, 2:37 am I wanted to keep my FontSize static and the text clipped to keep a maximum width.
Besides setting the AccurateText=1 option, you might want trying to set the ClipString=2 option on the String meters, along with setting proper ClipStringW and ClipStringH options. For instance:

Code: Select all

[MeterT]
...
ClipString=2
ClipStringW=(#Size#*360)
ClipStringH=(#Size#*54)
...

[MeterA]
...
ClipString=2
ClipStringW=(#Size#*360)
ClipStringH=(#Size#*36)
...
Additonal note: The NowPlaying measures should have be always used into a parent - child structure, which means that if more than a single such measure is used (like this time), one should be the parent- and the other should be the child measure, which is referencing the parent measure. In your code both measures are parent measures (this can be known by the fact that both measures have the PlayerName=Spotify option), which even if does work, is not the best approach. So recommend to change the PlayerName option of the [MeasureA] measure to PlayerName=[MeasureT], in which case [MeasureT] will be the parent measure and obviously [MeasureA] will be the child measure. Something like this:

Code: Select all

[MeasureT]
Measure=NowPlaying
PlayerName=WMP
PlayerType=Title

[MeasureA]
Measure=NowPlaying
PlayerName=[MeasureT]
PlayerType=Artist