Page 1 of 4

Solved: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 1:04 pm
by the_metal_lord
Hi!
I put couple of fonts into the @Resources folder, and I want random font each time the skin updates.

So I made a text file (FontFace.txt) and wrote the names of the fonts. Then used this-

Code: Select all

[MeasureFontFace]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#CURRENTPATH#FontFace.txt
UpdateDivider=300
This is how the text file look-

Code: Select all

Caviar Dreams
Nexa Light
TT Chocolates Thin
Now, in the Meter I put this-

Code: Select all

FontFace=[MeasureFontFace]
But it's not properly working, it only shows the last font or the default Rainmeter font.

How to make it work properly? Or maybe any different way?

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 1:11 pm
by ikarus1969
Hmmm.

If you want it to get a new font with every update then you should remove the UpdateDivider=300 from the "MeasureFontFace" measure (in case you have the default Update=100 in the rainmeter-section).

Additionaly, do you have a DynamicVariables=1 on the meter with FontFace=[MeasureFontFace]?

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 1:39 pm
by balala
ikarus1969 wrote:(in case you have the default Update=100 in the rainmeter-section).
The default Update value is 1000, not 100 (probably this was a typo). But this doesn't matter too much, if there is an UpdateDivider=300 option, the [MeasureFontFace] measure will be updated on every 300th update cycle. No matter what the Update is set to.
The most important is to have set the DynamicVariables=1 option on the meter which uses the FontFace=[MeasureFontFace] option, as ikarus1969 said.

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 3:05 pm
by the_metal_lord
Yeah, DynamicVariables=1 was already in the Meter. It just cycles through the last font and default Rainmeter font, other fonts are not showing up :( .
Is there way to use Random and lua script... I'm just totally confused.

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 3:14 pm
by jsmorley
Fonts have to be loaded in Windows memory to use them. With Rainmeter, that means that the font must be installed in Windows, or it must reside in the @Resources\Fonts folder of the skin. If a font .ttf or .otf file is found in @Resources\Fonts when the skin is loaded, Rainmeter will load it into Windows memory and it can be used.

So getting the family name of the font is all well and good, but it won't use it if it isn't available.

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 3:16 pm
by the_metal_lord
The fonts are already installed and all are in ttf or otf format.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1



[MeasureFile]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#CURRENTPATH#Quotes.txt
Subfolders=0
UpdateDivider=300
Substitute="---":"#CRLF#"


;-----------------------------

[MeterFile]
Meter=STRING
MeasureName=MeasureFile
StringAlign=Center
X=(#WORKAREAWIDTH# / 2)
Y=10
W=(#WORKAREAWIDTH# - 500)
H=600
FontFace=Nexa Light
FontSize=15
StringStyle=
FontColor=250,250,250,150
FontEffectColor=90,90,90,50
StringEffect=Shadow
Clipstring=2
DynamicVariables=1
AntiAlias=1

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 3:18 pm
by balala
the_metal_lord wrote:The fonts are already installed and all are in ttf or otf format.
Are installed in Windows?
However, could you please pack and upload the whole config (including the fonts, if they are in the @Resources\Fonts folder)? Just to check.

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 3:25 pm
by jsmorley
Skin:

Code: Select all

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

[MeasureFontName]
Measure=Plugin
Plugin=QuotePlugin
PathName=#CURRENTPATH#FontFace.txt
UpdateDivider=2

[MeterTest]
Meter=String
FontSize=20
FontFace=[MeasureFontName]
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeasureFontName]#CRLF##CRLF#Now is the time for all good men#CRLF#to come to the aid of their country#CRLF#12347890 !@#$%^&*(
FontFace.txt:

Code: Select all

Segoe UI
Trebuchet MS
Fira Sans
Calibri
Comic Sans MS
1.png

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 3:30 pm
by the_metal_lord
jsmorley wrote:Skin:

Code: Select all

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

[MeasureFontName]
Measure=Plugin
Plugin=QuotePlugin
PathName=#CURRENTPATH#FontFace.txt
UpdateDivider=2

[MeterTest]
Meter=String
FontSize=20
FontFace=[MeasureFontName]
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeasureFontName]#CRLF##CRLF#Now is the time for all good men#CRLF#to come to the aid of their country#CRLF#12347890 !@#$%^&*(
FontFace.txt:

Code: Select all

Segoe UI
Trebuchet MS
Fira Sans
Calibri
Comic Sans MS
1.png

- I tested this, still the same thing happening, only switching between the last font in the list (in this case Comic Sans) and default Rainmeter font. Other fonts are still not loading.

Re: Random FontFace from text file or @Resources folder

Posted: April 3rd, 2018, 3:31 pm
by jsmorley
Make sure that FontFace.txt is encoded as either ANSI or UTF-16 Little Endian. It won't work if it is encoded as UTF-8 w/BOM.