It is currently March 28th, 2024, 1:39 pm

InlineSetting Question

Report bugs with the Rainmeter application and suggest features.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

InlineSetting Question

Post by Mor3bane »

I am not sure what I need to do for this InlineSetting and InlinePattern:
I am trying to have the font change for the %2 value. In my example I am attempting to escape after the colon ":" for the Calibri font to be applied. Also not sure if my numbering of the setting and pattern is correct either.
Thanks for any explanation and help.
Without the InlinePattern2=Baro .* :\ (.*) the Face is applied but for the whole line. In the below example the Size is applied correctly as well. Hmmm.

Code: Select all

[MeterBar]
Meter=STRING
MeasureName=MeasureBar
MeasureName2=MeasureRF
FontFace=#Font#
FontColor=#Color#
FontSize=17
StringAlign=Center
X=r
Y=20r
Text=Baro %1: %2
InlineSetting=Color | #ColorZ#
InlinePattern=Baro (.*)
InlineSetting2=Face | Calibri
InlineSetting3=Size | 14
InlinePattern2=Baro .* :\ (.*)
Antialias=1
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InlineSetting Question

Post by jsmorley »

There is no need to escape a : character in regular expression, and even if there was, the \ escape char comes before the character you want to escape, not after.

In addition, be very careful about spaces in your pattern, they matter.

Text=Baro %1: %2

Yours:
InlinePattern2=Baro .* :\ (.*)
Working:
InlinePattern2=Baro .*: (.*)
No escape is needed, and there is no space before the :
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: InlineSetting Question

Post by Mor3bane »

Excellent - that works great.

However, this progress leads to another question.

In the following code, why does the Substitute not provide the Face with the proper translation of the font? The "6" should translate into a "down arrow" from the Webdings font list. But it just shows a "6". Why?

Code: Select all

[MeasureRF]
Measure=WebParser
Url=[MeasureBaro]
StringIndex=2
Substitute="Falling":"6","Steady":"~"

[MeterBar]
Meter=STRING
MeasureName=MeasureBar
MeasureName2=MeasureRF
FontFace=#Font#
FontColor=#Color#
FontSize=17
StringAlign=Center
X=r
Y=20r
Text=Baro %1: %2
InlineSetting=Color | #ColorZ#
InlinePattern=Baro (.*)
InlineSetting2=Face | Webdings
InlinePattern2=Baro .*: (.*)
Antialias=1
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: InlineSetting Question

Post by ikarus1969 »

For me it happens only if i don't set the Font variable.

For testing purposes i copied your code. The Fontvariable was not set and i am getting a 6.
Then i set the Fontvariable to, let's say, Arial(but you can use whatever you like) and then i am getting the Down-arrow.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InlineSetting Question

Post by jsmorley »

I think you guys have stumbled onto a bug. We are digging into it as I speak, and will clarify in a bit. Thanks for reporting.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InlineSetting Question

Post by jsmorley »

We haven't yet quite zeroed-in on the underlying issue yet, but here is what I think is happening, and while we correct it for the next beta version of Rainmeter, here is how you can address it:

What we are seeing is that if you use an "external" font, one that isn't installed in Windows, but used by putting it it @Resources\Fonts in your skin root config folder, there is an anomaly:

If you define that font face for the entire string, either with a FontFace option on the meter, or with an InlineSettingN=Face option where you either define the matching InlinePatternN as the entire string, or leave the InlinePatternN off entirely, which defaults to the entire string, then you can't subsequently change the font to something else in that string with another InlineSettingN=Face option.

Once an entire string is defined as using an "external" font, it can't be changed.

For these examples, I have put the font "Fira Sans" into my @Resources\Fonts folder. The font is not installed in Windows.

Code: Select all

[MeterTest]
Meter=String
FontFace=Fira Sans
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontSize=17
Text=String 1 : String 2
InlineSetting=Face | Segoe Script
InlinePattern=.*:(.*)
AntiAlias=1
This won't work, as the entire string is defined with Fira Sans, and can't be changed inline.

Code: Select all

[MeterTest]
Meter=String
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontSize=17
Text=String 1 : String 2
InlineSetting=Face | Fira Sans
InlinePattern=^.*$
InlineSetting2=Face | Segoe Script
InlinePattern2=.*:(.*)
AntiAlias=1
Also won't work, as InlinePattern defines the entire string, and we get the same results as with FontFace.

Code: Select all

[MeterTest]
Meter=String
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontSize=17
Text=String 1 : String 2
InlineSetting=Face | Fira Sans
InlineSetting2=Face | Segoe Script
InlinePattern2=.*:(.*)
AntiAlias=1
Also won't work, as the missing InlinePattern defaults to the entire string, and the result is the same.

Code: Select all

[MeterTest]
Meter=String
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontSize=17
Text=String 1 : String 2
InlineSetting=Face | Fira Sans
InlinePattern=(.*):.*
InlineSetting2=Face | Segoe Script
InlinePattern2=.*:(.*)
AntiAlias=1
This works, since the part of the string using Fira Sans is explicitly defined as less than the entire string, and thus the second InlineSetting2 that changes the Face to Segoe Script works as expected.


Note that this is only an issue if the entire string is initially defined with an "external" font. If you use a font that is installed in Windows, then the behavior is entirely as expected.

Code: Select all

[MeterTest]
Meter=String
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontSize=17
FontFace=Times New Roman
Text=String 1 : String 2
InlineSetting=Face | Segoe Script
InlinePattern=.*:(.*)
AntiAlias=1
This work fine, as Times New Roman is a font face installed in Windows.

Code: Select all

[MeterTest]
Meter=String
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontSize=17
FontFace=Times New Roman
Text=String 1 : String 2
InlineSetting=Face | Fira Sans
InlinePattern=.*:(.*)
AntiAlias=1
This also works fine, as although Fira Sans is an "external" font, it is never defined as the face for the entire string.


This is clearly a bug, and although we will address it, it won't be generally available until we start the beta cycle for Rainmeter 4.3. I would suggest in the short to mid term, that you make changes to your code to avoid this issue.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: InlineSetting Question

Post by Mor3bane »

Wow. In a sort of odd way, it is pretty cool that a bug was revealed. O.O

But it is very cool there is a workaround. :17spot1

Defining the custom Face as less than the entire string is working here as well.

Many thanks, jsmorley
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: InlineSetting Question

Post by Brian »

This has been fixed for the upcoming 4.3 beta. Thanks for reporting!

Honestly, I cannot believe this hasn't come up before.

[Technical_details]
The problem stems from how Rainmeter loads fonts in D2D (it's really DirectWrite, but D2D will suffice). For each meter, Rainmeter attempts to load the font defined with the FontFace option. The first place it looks is the system font cache. If found, the font is loaded. If it isn't found in the system cache, Rainmeter then searches the #@#Fonts\ folder and creates a custom font collection for any files located in that folder. If the font is found there, it tells D2D to use that custom font collection when rendering. Then when any InlineSettings are parsed, the meter would re-use that custom font collection instead of also searching in the system cache for fonts.

So basically, if the FontFace font pointed to a system font, then FontFace worked, and any inline 'face' setting options also worked.
If the FontFace font pointed to a custom font, then system fonts would not work for any inline 'face' setting options - but other custom fonts did work.
[/Technical_details]

-Brian
nikko
Posts: 44
Joined: December 5th, 2017, 5:58 pm

Re: InlineSetting Question

Post by nikko »

how to change font size in this case

[Meter1]
Meter=String
FontSize=12
Text=[\x3455]Hello[\x6437]
InlineSetting=Size | 20
InlinePattern=[\x3455][\x6437]

this InlinePatter doesnt work.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: InlineSetting Question

Post by mak_kawa »

Hi nikko

You want to set size of [\x3455] and [\x6437] to 20? If so, InlinePattern=[\x3455]|[\x6437] does work.
See Rainmeter Document for InlinePattern.
Post Reply