![]() |
Can I get font name Using API ?
Last time I post a thread about the FontName plugin. I said that the plugin can only get the English name of the font. I used to contact the author, but the plugin is built in 2007, I thought it is not easy to contact to him. Later I search in internet, someone said that a win32 API could get the infomation of a font file.
This is an article about the funtion: http://www.undocprint.org/winspool/getfontresourceinfo I tried to use it, but I didn't get the result as my programming is poor. Would you help me to write an example script to show the usage? |
1 Attachment(s)
Nice find. I'm not sure if it gets exactly what you need but here you go anyway (see attached script). Tested on Windows 7 (Verdana.ttf -> Verdana).
Stu |
1 Attachment(s)
Quote:
I test your script like this: PHP Code:
http://forums.winamp.com/attachment....chmentid=47066 When I have a lot of TTF fonts to install, I must write to registry for every font file before, for the FontName plugin only got the English names. But now, I can easily inst any TTF fonts in custom folder by using a macro. This function is not only useful to me, but also to more users from different contries. Thank you again! |
That's great. I will put it on the Wiki when it's back up (down at the moment).
Stu |
I just updated the function with a missing Push/Pop for $R2.
Stu |
Thanks, I have downloaded the new one.
Ok, more users may view it also on Wiki now. |
|
Recently, I found that I get only "error" when using this code. I found that, I tried to "push" a installed font file name, it returned the correct name, but when I "push" a file name that is not yet installed, it always returned "error". At the beginning I donot know why, later I imagine that the font resource must be added to system first, actually that's it.
So, to install a font, you must insert this line before get its name and write to registry: System::Call "gdi32::AddFontResource(t 'FontFileName')" PHP Code:
|
If you change the name of the font file, the code is not working ...
( For example, if I change the file name to the arial.ttf - arial1.ttf - I get an error. ) We need to get a real Font name, regardless of the name of the font file... How to do it? ps Please tell me - a syntax for the plugin FontName plug-in ? The documentation does not even have examples of ... Quote:
http://nsis.sourceforge.net/FontName_plug-in |
| All times are GMT. The time now is 17:52. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.