It is currently August 16th, 2022, 4:00 am

Font Picker

General topics related to Rainmeter.
JaoJack
Posts: 5
Joined: January 8th, 2015, 9:03 pm

Font Picker

Post by JaoJack »

First let me open up by saying this is my first time posting here and I am extremely new to the manipulating skins realm.

I have a copy of LuaCalendar (a Smurfier edited version) and have been able to change out a few tweaks in the Option.ini to allow for quick changing of all colors (i.e. Dates, ActiveDay, Month Title, etc), and it works great so for. The area I am trying to tackle now seems to have stumped me momentarily. I would like to be able to change the FontFace from the Options.ini. I can easily change the variable to a known font name but I would like to either click an Explorer type view and select the font or select from a dropdown menu of the installed system fonts.

I have experimented with placing the .ttf files in my @Resource directory but this doesnt always work (font still needs to be installed).

So all that said, does anyone have a plug in to view and select a font from the installed fonts list?

Also note that I am not a coder and can simply make minor adjustments and tweaks.

Thanks in advance
User avatar
jsmorley
Developer
Posts: 22533
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Font Picker

Post by jsmorley »

JaoJack wrote:First let me open up by saying this is my first time posting here and I am extremely new to the manipulating skins realm.

I have a copy of LuaCalendar (a Smurfier edited version) and have been able to change out a few tweaks in the Option.ini to allow for quick changing of all colors (i.e. Dates, ActiveDay, Month Title, etc), and it works great so for. The area I am trying to tackle now seems to have stumped me momentarily. I would like to be able to change the FontFace from the Options.ini. I can easily change the variable to a known font name but I would like to either click an Explorer type view and select the font or select from a dropdown menu of the installed system fonts.

I have experimented with placing the .ttf files in my @Resource directory but this doesnt always work (font still needs to be installed).

So all that said, does anyone have a plug in to view and select a font from the installed fonts list?

Also note that I am not a coder and can simply make minor adjustments and tweaks.

Thanks in advance
There is no reasonable way to create a "font picker" in Rainmeter that is going to use the installed fonts in Windows. There are literally hundreds, and on some systems thousands, of fonts installed in Windows.

You can put .ttf font files in @Resources\Fonts\ in the root config folder of your skin, and those fonts will then be available for use when Rainmeter is loaded. You still won't be able to have any kind of dynamic "picker" though, as the font .ttf file name has nothing to do with the "family name" in the font required for Rainmeter.

You could create a list of the font family names for the .tff files you put in @Resources\Fonts\ and use !SetOption when one is selected to change a variable that your string meters use. This going to be fairly static though. You put xx fonts in @Resources\Fonts\, then create a list with the "family names" for those fonts, and let the users choose from this list. Be sure to use !WriteKeyValue as well as !SetOption if you want the selection to be permanent.
JaoJack
Posts: 5
Joined: January 8th, 2015, 9:03 pm

Re: Font Picker

Post by JaoJack »

Though I understand what you are saying, and am not opposed to creating a list of font "Family Names" and including the .ttf files in the \Fonts directory, I think the coding side may be a bit outside my skill-set level as it is at the moment. I will have to keep plugging away at it.

Thank you for the reply.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4806
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Font Picker

Post by eclectic-tech »

JaoJack wrote:...
I would like to be able to change the FontFace from the Options.ini. I can easily change the variable to a known font name but I would like to either click an Explorer type view and select the font or select from a dropdown menu of the installed system fonts.
...
You can use RainFont to see all installed fonts and copy the family name to the clipboard and paste it into the option.ini

Thank JS Morley for that program :)
User avatar
jsmorley
Developer
Posts: 22533
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Font Picker

Post by jsmorley »

You might want to consider using the context menu feature and !SkinCustomMenu bang for this.

It's a really quick and easy way to offer a choice like this.
ContextFont_1.0.rmskin

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
ContextTitle=Select Font
ContextAction=[]
ContextTitle2=---
ContextAction2=[]
ContextTitle3=#Font1#
ContextAction3=[!WriteKeyValue Variables CurrentFont "#Font1#"][!SetVariable CurrentFont "#Font1#"][!UpdateMeter *][!Redraw]
ContextTitle4=#Font2#
ContextAction4=[!WriteKeyValue Variables CurrentFont "#Font2#"][!SetVariable CurrentFont "#Font2#"][!UpdateMeter *][!Redraw]
ContextTitle5=#Font3#
ContextAction5=[!WriteKeyValue Variables CurrentFont "#Font3#"][!SetVariable CurrentFont "#Font3#"][!UpdateMeter *][!Redraw]

[Metadata]
Name=ContextFont
Author=JSMorley
Version=Jan 8, 2015
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Information=Demonstrates using a context menu to select and change fonts in a skin.

[Variables]
CurrentFont=1979
Font1=1979
Font2=Angelic War
Font3=Atomic Clock Radio

[MeterDemo]
Meter=String
FontFace=#CurrentFont#
FontSize=20
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=My dog has FLEAS#CRLF#0123456789
DynamicVariables=1

[MeterChangeFont]
Meter=String
Y=5R
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Select Font
LeftMouseUpAction=[!SkinCustomMenu]
Click to animate:
test.gif
You do not have the required permissions to view the files attached to this post.
JaoJack
Posts: 5
Joined: January 8th, 2015, 9:03 pm

Re: Font Picker

Post by JaoJack »

Thank you for the context menu, I believe I can add on to this and incorporate it in the skin nicely! You are a gentleman and a scholar.

RainFont is a pretty little application too. Is there no way to bang out the results? Similar to RainRBG4 (another most awesome application I might add), which I have been able to use for adding several color picking options.

Sometimes I wish the coding side came as easily to me as it seems to for others.
JaoJack
Posts: 5
Joined: January 8th, 2015, 9:03 pm

Re: Font Picker

Post by JaoJack »

Ok, so I have been able to pull together a list of fonts and create the font folder, and there are several; how can I change the Context menu to be a scrollbox?

To be honest, my endgame will be to click the button and have the scrollbox open and display the font family name in the fontface style it will use. When selected, it will change exactly like you have done with the Context Menu.

Thank you again!
User avatar
jsmorley
Developer
Posts: 22533
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Font Picker

Post by jsmorley »

A context menu in Rainmeter can't scroll.
JaoJack
Posts: 5
Joined: January 8th, 2015, 9:03 pm

Re: Font Picker

Post by JaoJack »

Yeah, i am finding that out. How can I make a scrollbox that will display the list since the list is too long for a context menu?
User avatar
jsmorley
Developer
Posts: 22533
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Font Picker

Post by jsmorley »

You really can't. You could probably create some hideously complicated thing that could simulate scrolling "items" in a list, but it would have to be created entirely from scratch, using Calc measures and little arrow meters to click on, and a large number of !SetOptions and such. To be honest, I just wouldn't go through all the thought and coding required. To each his own, but I can't see how it makes sense to offer a ton of "font" choices to a user.