It is currently March 28th, 2024, 8:32 pm

Interesting clipping going on with string meter

Get help with creating, editing & fixing problems with skins
User avatar
wodger1912
Posts: 4
Joined: June 15th, 2020, 4:24 pm

Interesting clipping going on with string meter

Post by wodger1912 »

Hi everyone,

New guy here, just getting into rainmeter and learning something new every day. I'm just starting with my ideas and I've come across something I haven't managed to solve yet through googling and digging the forums.

Heres whats going on - have a string meter displaying text, there's a bar underneath that moves out - using a shape meter on a path for that - that's not the problem, but if you watch the end of the text - it reveals there's some clipping going on. To check, I made the solid color box a transparent red, and it indeed is causing part of the text to be cut off.

Think its something to do with the font, but would like to keep the font, can it be fixed?

Thanks

W.

p.s. its a WIP code so some parts are not even finished yet :D
Clipping.gif

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=
Author=Wodger
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
FontSizeSet=80
FaderColor=255,255,255,1
FaderLengthStart=0
FaderLengthEnd=0
FaderValue=0.5
SelectedMeterLaunch=MeterLaunch1
U=[!UpdateMeasure MeasureHoverBarReveal][!UpdateMeter MeterLaunchBar][!Redraw]


[MeterLaunch1]
Meter=String
Text=Online Drives
AntiAlias=1
FontColor=255,255,255
FontFace=Norican
FontSize=#FontSizeSet#
SolidColor=150,100,100,50
MouseOverAction=[!SetVariable SelectedMeterLaunch "MeterLaunch1"][!CommandMeasure MeasureHoverBarReveal "Stop 2"][!CommandMeasure MeasureHoverBarReveal "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureHoverBarReveal "Stop 1"][!CommandMeasure MeasureHoverBarReveal "Execute 2"]
DynamicVariables=1

[MeterLaunchBar]
Meter=Shape
Shape=Path RightBar | StrokeWidth 0 | Fill Color #FaderColor#
RightBar=([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | LineTo (([#SelectedMeterLaunch#:W]/2)+15)*#FaderValue#,([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | LineTo ([#SelectedMeterLaunch#:W])*#FaderValue#,([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | ArcTo ([#SelectedMeterLaunch#:W]*#FaderValue#),([#SelectedMeterLaunch#:H]) | LineTo ([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]), ClosePath=1
;Shape2=Path LeftBar | StrokeWidth 0 | Fill Color #FaderColor#
;LeftBar=([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | LineTo 10,([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | ArcTo 10,([#SelectedMeterLaunch#:H]),*,*,*,1 | LineTo ([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]), ClosePath=1
DynamicVariables=1

[MeasureHoverBarReveal]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Reveal,10,10
Reveal=[!SetVariable FaderValue "(Clamp(#FaderValue#+0.05,0.5,1))"]#U#
ActionList2=Repeat Hide,10,10
Hide=[!SetVariable FaderValue "(Clamp(#FaderValue#-0.05,0.5,1))"]#U#
IfCondition=(#FaderValue#=0.5)
IfTrueAction=[!SetVariable FaderColor "255,255,255,1"]
IfCondition2=(#FaderValue#>0.5)
IfTrueAction2=[!SetVariable FaderColor "255,255,255,100"]
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interesting clipping going on with string meter

Post by jsmorley »

That is really weird. I don't have that Norican font, so I can't fully test, but yeah, it seems like something with the glyphs of that font is not causing Rainmeter to see the full extent of that meter when it sets the meter container size.

I'm not even sure how best to attack this.

Try adding a new "background" meter before all the others:

Code: Select all

[MeterInvisiBack]
Meter=Image
W=650
H=1
SolidColor=0,0,0,1
This will be invisible, and large enough to create a solid but invisible background for the skin that will hold that entire text, without impacting the calculations for the expanding bar under it. I'm hoping that this will cause DynamicWindowSize to not depend on that font and its funky metrics.

See what that does.

Obviously this works fine as you have it with any of the "normal" fonts that come with Windows, but I'm in no way suggesting you should give up on your desired font without a fight.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Interesting clipping going on with string meter

Post by balala »

jsmorley wrote: June 15th, 2020, 4:54 pm I don't have that Norican font, so I can't fully test,
It can easily be found on Internet. For instance: https://www.1001fonts.com/norican-font.html
Although this doesn't completely match with the dynamic window size, a second possibility is to set a well defined width for the skin, adding a SkinWidth=555 option to the [Rainmeter] section.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interesting clipping going on with string meter

Post by jsmorley »

balala wrote: June 15th, 2020, 7:59 pm It can easily be found on Internet. For instance: https://www.1001fonts.com/norican-font.html
Although this doesn't completely match with the dynamic window size, a second possibility is to set a well defined width for the skin, adding a SkinWidth=555 option to the [Rainmeter] section.
Ah, ok.

Yeah, that's a weirdly broken font. When I use it, my solution does fix the problem of it truncating the tail of that final "s", but the meter still sees the shorter length, and the SolidColor background on the meter is still truncated a bit. The "s" actually sticks outside the meter a tad.

I think you will need to use a large enough actual solid background meter behind it, then don't use SolidColor on the meter itself.

Everything else seems ok. Just the SolidColor container of the meter isn't being made large enough. SkinWidth won't help, Padding won't help, I think you need a separate background meter.



1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interesting clipping going on with string meter

Post by jsmorley »

Like this:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=
Author=Wodger
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
FontSizeSet=80
FaderColor=255,255,255,1
FaderLengthStart=0
FaderLengthEnd=0
FaderValue=0.5
SelectedMeterLaunch=MeterLaunch1
U=[!UpdateMeasure MeasureHoverBarReveal][!UpdateMeter MeterLaunchBar][!Redraw]

[MeterBackground]
Meter=Image
W=555
H=151
SolidColor=150,100,100,50

[MeterLaunch1]
Meter=String
Text=Online Drives
AntiAlias=1
FontColor=255,255,255
FontFace=Norican
FontSize=#FontSizeSet#
MouseOverAction=[!SetVariable SelectedMeterLaunch "MeterLaunch1"][!CommandMeasure MeasureHoverBarReveal "Stop 2"][!CommandMeasure MeasureHoverBarReveal "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureHoverBarReveal "Stop 1"][!CommandMeasure MeasureHoverBarReveal "Execute 2"]
DynamicVariables=1

[MeterLaunchBar]
Meter=Shape
Shape=Path RightBar | StrokeWidth 0 | Fill Color #FaderColor#
RightBar=([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | LineTo (([#SelectedMeterLaunch#:W]/2)+15)*#FaderValue#,([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | LineTo ([#SelectedMeterLaunch#:W])*#FaderValue#,([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | ArcTo ([#SelectedMeterLaunch#:W]*#FaderValue#),([#SelectedMeterLaunch#:H]) | LineTo ([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]), ClosePath=1
;Shape2=Path LeftBar | StrokeWidth 0 | Fill Color #FaderColor#
;LeftBar=([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | LineTo 10,([#SelectedMeterLaunch#:H]-[#SelectedMeterLaunch#:H]/15) | ArcTo 10,([#SelectedMeterLaunch#:H]),*,*,*,1 | LineTo ([#SelectedMeterLaunch#:W]/2),([#SelectedMeterLaunch#:H]), ClosePath=1
DynamicVariables=1

[MeasureHoverBarReveal]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Reveal,10,10
Reveal=[!SetVariable FaderValue "(Clamp(#FaderValue#+0.05,0.5,1))"]#U#
ActionList2=Repeat Hide,10,10
Hide=[!SetVariable FaderValue "(Clamp(#FaderValue#-0.05,0.5,1))"]#U#
IfCondition=(#FaderValue#=0.5)
IfTrueAction=[!SetVariable FaderColor "255,255,255,1"]
IfCondition2=(#FaderValue#>0.5)
IfTrueAction2=[!SetVariable FaderColor "255,255,255,100"]
DynamicVariables=1

2.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interesting clipping going on with string meter

Post by jsmorley »

If you add a SolidColor=255,0,0,50 to the String meter, you can see the difference.


3.jpg


The text of the string sees the right width, the sliding bar (based on the width of the meter) sees the right width, but the SolidColor does not. I have no idea how this particular font is borking this, but it clearly is.
You do not have the required permissions to view the files attached to this post.
User avatar
wodger1912
Posts: 4
Joined: June 15th, 2020, 4:24 pm

Re: Interesting clipping going on with string meter

Post by wodger1912 »

Thanks for the great replies - had a feeling it was the font as when I changed the text after posting, it's not just the S that's doing it, its other glyphs also. We'll see how things go with the fixes described

I think what might be doing it referencing JSMorleys last reply is the glyphs are not set to take the embellishment into account - hence why it looks nicely joined up when in a word or sentence (the glyphs embellishments actually overlap the next glyph). I've seen this before on other fonts, while it looks nice in a word, it plays havoc with things like highlighting - see below snip from MS Word using highlighting with grey.

Anyways, at least I know I'm not going nuts or am doing something completely backward in Rainmeter :)
Word.png
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interesting clipping going on with string meter

Post by jsmorley »

wodger1912 wrote: June 15th, 2020, 11:49 pm Thanks for the great replies - had a feeling it was the font as when I changed the text after posting, it's not just the S that's doing it, its other glyphs also. We'll see how things go with the fixes described

I think what might be doing it referencing JSMorleys last reply is the glyphs are not set to take the embellishment into account - hence why it looks nicely joined up when in a word or sentence (the glyphs embellishments actually overlap the next glyph). I've seen this before on other fonts, while it looks nice in a word, it plays havoc with things like highlighting - see below snip from MS Word using highlighting with grey.

Anyways, at least I know I'm not going nuts or am doing something completely backward in Rainmeter :)

Word.png

Interesting. I think you are exactly right.
User avatar
wodger1912
Posts: 4
Joined: June 15th, 2020, 4:24 pm

Re: Interesting clipping going on with string meter

Post by wodger1912 »

Just wondering, is there a way for it to remain clipped? - so the end of the glyph doesn't appear?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interesting clipping going on with string meter

Post by jsmorley »

wodger1912 wrote: June 16th, 2020, 12:55 am Just wondering, is there a way for it to remain clipped? - so the end of the glyph doesn't appear?
Only with some brute-force.

Code: Select all

[MeterContainer]
Meter=Image
W=547
H=151
SolidColor=0,0,0,255

[MeterLaunch1]
Meter=String
Text=Online Drives
AntiAlias=1
FontColor=255,255,255
FontFace=Norican
FontSize=#FontSizeSet#
SolidColor=150,100,100,50
MouseOverAction=[!SetVariable SelectedMeterLaunch "MeterLaunch1"][!CommandMeasure MeasureHoverBarReveal "Stop 2"][!CommandMeasure MeasureHoverBarReveal "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureHoverBarReveal "Stop 1"][!CommandMeasure MeasureHoverBarReveal "Execute 2"]
DynamicVariables=1
Container=MeterContainer
That will put the String meter inside a Container, which will restrict it to the size of the container it is in.

However, you might want to do some work on that bar that you are sliding, so it is constrained to the size of the container as well. You don't want to just whack it off, as it has a rounded end.


3.jpg
You do not have the required permissions to view the files attached to this post.