What I have in mind is something a few of us have talked about in the past but never got round to. It is to allow skin authors to include a font with their skins, and have Rainmeter use it without the user having to "install" it to Windows\Fonts.
We would like to have another folder at the same level as Rainmeter.exe (normally C:\Program Files\Rainmeter) called \Fonts
This folder should be resolved and added to the list of #VARNAME# built-in variables we have now like #SKINSPATH# It could be #FONTSPATH#
In that you can store all fonts you get from various skins downloaded from DevArt etc.
Then we would need a new statement in the [Rainmeter] section of a skin. I was thinking LocalFont=xxxxx
The author could either leave the font in the skin folder and just put LocalFont=Veranda.ttf for instance, or have the user put the font in the common \Fonts folder under Rainmeter and use LocalFont=#FONTSPATH#Veranda.ttf (they will need to specify .ttf .otf etc. as the function(s) I am looking at will need a full file name.
So from a skin standpoint you would have:
[Rainmeter]
LocalFont=Veranda.ttf
[Variables]
FontName=Veranda
(It should be noted that the filename.ttf of a font and the "internal" name needed for FontName= may not be the same. This is the author's responsibility)
Now the C++
http://msdn.microsoft.com/en-us/library/dd183327%28VS.85%29.aspx
So you call it more or less like this:
Code: Select all
CString szFontFile = "Veranda.ttf";
int nResults = AddFontResourceEx(
m_szFontFile, // font file name
FR_PRIVATE, // font characteristics
NULL);
Code: Select all
BOOL b = RemoveFontResourceEx(
m_szFontFile, // name of font file
FR_PRIVATE, // font characteristics
NULL // Reserved.
);
I don't think we want or need to "broadcast" the font to other Windows apps.
There was a suggestion that we just autoload all fonts found in \Fonts when Rainmeter starts and clear them when it ends. This has some charm as it makes it a lot simpler for the skin author, and would be an easier job of coding in the C++ as you wouldn't have to parse the .ini and all that. I would prefer doing it the way I suggested, as I keep like 2,000 fonts "uninstalled" on my system to use in Photoshop with NexusFonts (which does read the whole folder and broadcast the fonts to all Windows apps) but I would hate to have Rainmeter using all that memory to load a ton of fonts you are not using, since Rainmeter is running all the time on most machines. However, I could be talked into the easier way. Let the perfect not be the enemy of the good...
Let me know what you think, if you have any questions or suggestions. I am just not good enough at C++ to be confident I can do this myself without some help, and would love to work with you on this.
P.S. There is an interesting discussion of this at http://www.codeguru.com/cpp/g-m/gdi/gdi/article.php/c16019/