Is it possible to embed a GUI font in scripts?
- JoeWinograd
- Posts: 2246
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Is it possible to embed a GUI font in scripts?
The Gui,Font documentation describes how fonts may listed in order, with one font taking precedence over the preceding one. This allows a script to run on multiple systems and use an acceptable GUI font, even if a system does not have the most desirable font installed. But here's what I'm wondering: Is it possible to embed a GUI font in scripts? If so, how? And would the embedded font also work via the EXE of the compiled script? If none of this is possible now, that would be a nice feature to consider for V2. Regards, Joe
Re: Is it possible to embed a GUI font in scripts?
I have had success using AddFontResourceEx.
Add this before you call the font:
DllCall("Gdi32.dll\AddFontResourceEx", "Str", "MyFontFile.ttf", "UInt", 0x10, "UInt", 0)
Then call the font like this: Gui, Font, s12 c000000, MyFontName
"MyFontName" is not the filename, but rather the name that is displayed if you were to open the font in a font viewer, etc...
Add this before you call the font:
DllCall("Gdi32.dll\AddFontResourceEx", "Str", "MyFontFile.ttf", "UInt", 0x10, "UInt", 0)
Then call the font like this: Gui, Font, s12 c000000, MyFontName
"MyFontName" is not the filename, but rather the name that is displayed if you were to open the font in a font viewer, etc...
Last edited by TheDewd on 05 Feb 2016, 12:22, edited 2 times in total.
Re: Is it possible to embed a GUI font in scripts?
Class_CustomFont allows you to load font from a font file, without needed installed to system.
https://autohotkey.com/boards/viewtopic.php?t=813
?
https://autohotkey.com/boards/viewtopic.php?t=813
?
- JoeWinograd
- Posts: 2246
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Is it possible to embed a GUI font in scripts?
Thanks to both of you. I'll give these ideas a try and will let you know if I have any questions. Regards, Joe
Who is online
Users browsing this forum: Bing [Bot], ByronicZero, leothlon and 118 guests