This looks really great, Brian. I'll echo all of @Yincognito's first couple of points. I have no idea how you have figured this out so far but I'm definitely here for it. Great work!Brian wrote: ↑May 1st, 2022, 6:19 am I think something can be done in this area. Maybe.
Here is a simple test:
Justified.png
There are 2 potential "issues", if you want to call them that.
FIrst, D2D seems to increase the spacing between characters within the same word in some cases instead of just the spacing between words. It isn't too bad, but there doesn't seem to be a way to just use the "normal" space between characters in the same word like you would think.
Second, it's difficult to calculate the correct width of the meter when no W is defined - so a width needs to be defined to make this work.
I'll look into these issues and hopefully come up with a solution.
-Brian
It is currently October 1st, 2023, 2:05 am
[Suggestion] Word Spacing To Achieve Straight Column Edges On Each Side
-
- Posts: 18
- Joined: June 17th, 2020, 4:00 am
Re: [Suggestion] Word Spacing To Achieve Straight Column Edges On Each Side
-
- Posts: 18
- Joined: June 17th, 2020, 4:00 am
Re: [Suggestion] Word Spacing To Achieve Straight Column Edges On Each Side
Hey Brian! Just wondering if you ever made any further progress with this. It looked great!Brian wrote: ↑May 1st, 2022, 6:19 am I think something can be done in this area. Maybe.
Here is a simple test:
Justified.png
There are 2 potential "issues", if you want to call them that.
FIrst, D2D seems to increase the spacing between characters within the same word in some cases instead of just the spacing between words. It isn't too bad, but there doesn't seem to be a way to just use the "normal" space between characters in the same word like you would think.
Second, it's difficult to calculate the correct width of the meter when no W is defined - so a width needs to be defined to make this work.
I'll look into these issues and hopefully come up with a solution.
-Brian
-
- Developer
- Posts: 2640
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: [Suggestion] Word Spacing To Achieve Straight Column Edges On Each Side
I did make progress on this and had it all ready to go, however, a unresolvable issue came up. The specific issue is a little hard to describe, but it basically has to do with multiline text.
If the text has no line endings, the text will show as you would expect with the appropriate extra space between characters and word clusters.
Example:
Example:
Example:
I am not sure there is anything that can be done to fix it, but if something "new" comes up, I will definitely look into it.
-Brian
-
- Rainmeter Sage
- Posts: 6066
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: [Suggestion] Word Spacing To Achieve Straight Column Edges On Each Side
So basically, the issue is that the "text cluster" is left aligned (instead of justified) if the line ending (aka the #CRLF#) location occurs before the wrapping one, right? Some ideas which might or might not work or be optimal would be to strip the text of line endings initially and add them after the character placement is established (I have no idea if this is doable, just saying), or using / designing some kind of plugin similar to InputText based on justifying capable text boxes or even WebView2 technology. The latter, while possible, unfortunately adds more dependencies to Rainmeter (like the specific runtime redistributable, writing in HTML and such) and I imagine that not being desirable.Brian wrote: ↑November 11th, 2022, 8:13 pm I did make progress on this and had it all ready to go, however, a unresolvable issue came up. The specific issue is a little hard to describe, but it basically has to do with multiline text.
If the text has line endings and if any of the "text clusters between line endings" DO NOT wrap, they will not get the justified alignment. It looks okay if the "short text" is on the last line, but it looks weird everywhere else.
Example:It would look something like this:Code: Select all
Text=Something short.#CRLF##CRLF#Another sentence too long for the width. W=100
I am not sure there is anything that can be done to fix it, but if something "new" comes up, I will definitely look into it.Code: Select all
Something short. A n o t h e r s e n t e n c e t o o l o n g f o r t h e w i d t h.
Anyway, I might be wrong here, but isn't the behavior you mentioned "normal" in these cases? Consider this test environment on W3Schools (I chose this cause it's easy to experiment with, not necessarily because of the possible connection with the WebView2 environment) and the following HTML code on the left side of the window:
Code: Select all
<!DOCTYPE html>
<html>
<head>
<style>
div {
text-align: justify;
text-justify: inter-word;
}
</style>
</head>
<body>
<h1>The text-justify Property</h1>
<div>Something short.<br><br>Another sentence too long for the width.</div>
<p><b>Tip:</b> Resize the browser window to see how the value "justify" works.</p>
</body>
</html>
You do not have the required permissions to view the files attached to this post.