It is currently December 7th, 2021, 11:46 am

4.5.5.3557

Test and provide feedback on potential changes
User avatar
jsmorley
Developer
Posts: 22419
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

4.5.5.3557

Post by jsmorley »

Ok, we have revisited the TrailingSpaces=1 option, and seem to have it working better with StringAlign applied to the meter.

Can you guys please beat this up and see what we missed? Be sure to test with ClipString and ClipStringW / ClipStringH and all that.

https://builds.rainmeter.net/test_builds/Rainmeter-4.5.5.3557-prerelease.exe

If you set TrailingSpaces=1 on a String meter, then you can use leading and trailing spaces delimited by "quotes".

Code: Select all

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

[Variables]

[MeterOne]
Meter=String
X=119
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
TrailingSpaces=1
Text="    Hello World    "

[MeterTwo]
Meter=String
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[MeterOne:W]
DynamicVariables=1
User avatar
death.crafter
Rainmeter Sage
Posts: 1206
Joined: April 24th, 2021, 8:13 pm

Re: 4.5.5.3557

Post by death.crafter »

Oh my god... I can't wait to try it out. Let me just get back to my system.

Thanks a lot Brian and jsmorley, for working on this.
from the Realm of Death
User avatar
death.crafter
Rainmeter Sage
Posts: 1206
Joined: April 24th, 2021, 8:13 pm

Re: 4.5.5.3557

Post by death.crafter »

About ClipStrings
  • It seems like you are actually messing with widths when dealing with whitespaces and not the actual characters. Cause when using clipstring = 2 max number of white spaced lines at starting are two, no matter how many spaces you actually have.

    And the trailing white spaces are not included in the ending with ClipString=2.

    Screenshot 2021-11-05 160641.png


  • StringAlign=Right is messed up as the "spaces" which aren't really spaces appear at the right hand side.
    ClipString=1:
    Incorrect:
    Screenshot 2021-11-05 162038.png
    Correct:
    Screenshot 2021-11-05 162144.png
    ClipString=2:
    Incorrect:
    Screenshot 2021-11-05 161151.png
    Correct:
    Screenshot 2021-11-05 161457.png
In my opinion, if we can't actually add literal whitespace characters to a string, then we shouldn't.
P.S. isn't there any other library we can use to render string meter? Ofc, you don't have to do it if the cost-benefit ratio is greater than 1. Just saying cause ActiveColors posted this:
Screenshot 2021-11-05 163007.png
[/url]
a while back, which won't be a bad thing I guess...

Also I was trying to embed a link to the image above, which partially works lol.
You do not have the required permissions to view the files attached to this post.
from the Realm of Death
User avatar
Brian
Developer
Posts: 2302
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: 4.5.5.3557

Post by Brian »

The ClipString=1 issue can be fixed easily enough. However, the ClipString=2 issue is more difficult at this time.

[Technical details]
The issue is the way DirectWrite calculates the text metrics for a layout. By default, DirectWrite ignores trailing whitespaces altogether. They provided a way to calculate the correct width when trailing whitespace is present. This method is available from Windows 7 and on.
Here is the structure (note the "widthIncludingTrailingWhitespace" member):
https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_text_metrics

However, because multiline text is delimited on whitespace, the remaining text is moved to the next line. If additional whitespace is all that is moved to the next line, DirectWrite just ignores it. Obviously Microsoft realized the mistake of not calculating the correct height for trailing whitespace and added a function to get it. But...it's only available for Windows 8.1 or later.
Here is the structure:
https://docs.microsoft.com/en-us/windows/win32/api/dwrite_2/ns-dwrite_2-dwrite_text_metrics1
[/Technical details]

death.crafter wrote: November 5th, 2021, 11:03 am In my opinion, if we can't actually add literal whitespace characters to a string, then we shouldn't.
I am starting to agree with this. DirectWrite seems to be the culprit with some of this, which unfortunately, we cannot really fix until we drop support for Windows 7 and 8.

Drat.



PS -
death.crafter wrote: November 5th, 2021, 11:03 amP.S. isn't there any other library we can use to render string meter?
I don't know of any other library that is build-in and seemlessly integrates with D2D. Anything else will be a massive rewrite to this part of the code, and doesn't seem warranted.
User avatar
death.crafter
Rainmeter Sage
Posts: 1206
Joined: April 24th, 2021, 8:13 pm

Re: 4.5.5.3557

Post by death.crafter »

Brian wrote: November 5th, 2021, 7:10 pm I am starting to agree with this. DirectWrite seems to be the culprit with some of this, which unfortunately, we cannot really fix until we drop support for Windows 7 and 8.
Well, I am not being reasonable, but let's weight the options here.

If you add this option then we won't be facing backwards compatibility issues, since it is a completely new feature.

And we could always follow Microsoft, if you won't upgrade your thing, then you can't use new features.

Plus plus for all.

What say?

:sly:
from the Realm of Death
User avatar
Brian
Developer
Posts: 2302
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: 4.5.5.3557

Post by Brian »

While we will probably drop support for Windows 7/8/8.1 at some point, but we haven't committed to that just yet.

We will probably revisit this again (3rd time?) at some point.

-Brian