It is currently April 23rd, 2024, 6:35 pm

Dynamic resize both image and string

Get help with creating, editing & fixing problems with skins
jumi
Posts: 11
Joined: January 12th, 2018, 5:39 am

Dynamic resize both image and string

Post by jumi »

I've got this little Now Playing widget and it's set do dynamically resize its content whilst being aligned to the right. It doesn't top over the volume icon and the percentage value on the right (which are static) but I want to put a "track" icon to the left of the Artist/Track and make them dynamically resize together, otherwise if I just align the icon to the left of the now playing info it'll just top over it if the track name is way too long, or leave an entire blank space if it's too short. Here are some images as an example:

The way it is:
Image
Image

The way I'd like it to be, if possible:
Image
Image

Thanks in advance!
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Dynamic resize both image and string

Post by Mordasius »

The following will put a music icon along with the track name and artist in a single meter aligned to the right. You can just add your volume icon and the percentage value right after the string meter. Can't really do much more without knowing how you are positioning things.

Code: Select all

[MtIcon-Title-Artist]
Meter=String
MeasureName=mPlayer
MeasureName2=mArtist
FontSize=14
FontColor=111111
StringAlign=RightCenter
SolidColor=eeeeee
W=400
H=30
X=400
Y=30
;--[   music note ( ♫ ) is unicode U+266B 
Text="[\x266B] %1 - %2"
InlineSetting=Color | 00aaff
InlinePattern=[\x266B]
InlineSetting2=Size | 18
InlinePattern2=\W
AntiAlias=1
Untitled-1.jpg
You do not have the required permissions to view the files attached to this post.
jumi
Posts: 11
Joined: January 12th, 2018, 5:39 am

Re: Dynamic resize both image and string

Post by jumi »

Mordasius wrote: March 3rd, 2019, 9:14 am The following will put a music icon along with the track name and artist in a single meter aligned to the right. You can just add your volume icon and the percentage value right after the string meter. Can't really do much more without knowing how you are positioning things.

Code: Select all

[MtIcon-Title-Artist]
Meter=String
MeasureName=mPlayer
MeasureName2=mArtist
FontSize=14
FontColor=111111
StringAlign=RightCenter
SolidColor=eeeeee
W=400
H=30
X=400
Y=30
;--[   music note ( ♫ ) is unicode U+266B 
Text="[\x266B] %1 - %2"
InlineSetting=Color | 00aaff
InlinePattern=[\x266B]
InlineSetting2=Size | 18
InlinePattern2=\W
AntiAlias=1
Untitled-1.jpg
Oh that seems to work! Although it's limited to text, specifically, and wouldn't be compatible with any other icon I might want to try, but that it's a smart solution, thank you!

And here's how it's currently coded

Code: Select all

[MeasurePlayer]
Measure=NowPlaying
PlayerName=CAD
PlayerType=TITLE

[MeasureArtist]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=ARTIST

[MeasureCover]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=COVER

[Background]
Meter=Image
ImageName=bar.png
H=30
X=0
Y=0

[MusicIcon]
Meter=Image
ImageName=track.png
H=30
W=30
X=1560

[MeterString]
Meter=STRING
MeasureName=MeasurePlayer
MeasureName2=MeasureArtist
X=1800
Y=-6
FontColor=100,100,100
FontSize=11
FontFace=Gotham Rounded
StringAlign=Right
AntiAlias=1
Text="[\x266B] %2 - %1"
;--[   music note ( ♫ ) is unicode U+266B 
InlineSetting=Color | 00aaff
InlinePattern=[\x266B]
InlineSetting2=Size | 18
InlinePattern2=\W
AntiAlias=1
They're all statically positioned to fit a white bar (as you can see in my screenshot) that spans my resolution's width (1920).