Is it possible to embed a GUI font in scripts?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Is it possible to embed a GUI font in scripts?

05 Feb 2016, 12:05

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
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Is it possible to embed a GUI font in scripts?

05 Feb 2016, 12:20

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...
Last edited by TheDewd on 05 Feb 2016, 12:22, edited 2 times in total.
Guest
Posts: 57
Joined: 17 Oct 2013, 02:32

Re: Is it possible to embed a GUI font in scripts?

05 Feb 2016, 12:20

Class_CustomFont allows you to load font from a font file, without needed installed to system.
https://autohotkey.com/boards/viewtopic.php?t=813

?
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Is it possible to embed a GUI font in scripts?

05 Feb 2016, 13:08

Thanks to both of you. I'll give these ideas a try and will let you know if I have any questions. Regards, Joe

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Billykid, dinodragon, Google [Bot], mcd and 141 guests