Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Crazy Scripting : Include and Use TrueType font from Script


  • Please log in to reply
12 replies to this topic
SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005



Posted Image[/list]
;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   ;
;                                                                                        ;
;          Title        :  Include and use TrueType font from Script                     ;
;                          - Digital clock Demo II                                       ;
;                                                                                        ;
;                          [color=black]Modifed 12Hr Version - 12hr version with Minimal GUI[/color]          ;                                                                                        

;          Author       :  [color=indigo]SKAN - Suresh Kumar A N[/color] ( [email protected] )            ;
;          Date         :  Created: 25-May-2008   |   Last Modified: 28-Mar-2008         ;
;                                                                                        ;
;          Forum link   :  www.autohotkey.com/forum/viewtopic.php?t=32179                ;
;                                                                                        ;
;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   ;

#SingleInstance, Force
Gui -Caption +Border +AlwaysOnTop +0x40000
Gui, Margin, 0, 0
Gui, Color, 261800

nSize := LoadFontFile( Buffer )
DllCall( "gdi32.dll\AddFontMemResourceEx", UInt,&Buffer, UInt,nsize, Int,0, UIntP,n )

hFont1 := DllCall( "CreateFont", Int,50, Int,0, Int,0, Int,0, Int,700, UInt,0, UInt,0
                , UInt,0, UInt,0, UInt,0, UInt,0, UInt,0, UInt,0, Str,"Skans-Digi" )
hFont2 := DllCall( "CreateFont", Int,22, Int,12, Int,0, Int,0, Int,400, UInt,0, UInt,0
                , UInt,0, UInt,0, UInt,0, UInt,0, UInt,0, UInt,0, Str,"Skans-Digi" )

FormatTime,hm,,h:mm
FormatTime,tt,,tt
Gui, Add, Text, x1 y1 w105 h46 c5B3C00 Right hwndDsp0 Border +0x200 GuiMove, 18:88
Gui, Add, Text, xp yp wp hp cFFAB0F Right hwndDsp1 vTime +0x200 BackgroundTrans, %hm%
Gui, Font, S9 Bold, Tahoma
Gui, Add, Text, x+4 y7 w27 h15 0x201 cDEDEDE vtt, %tt%
Gui, Add, Text, xp-1 y+0 w30 h20 cBF7C00 hwndDsp2 vSec 0x200, %A_Sec%

SendMessage,0x30,hFont1,1,, ahk_id %Dsp0%
SendMessage,0x30,hFont1,1,, ahk_id %Dsp1%
SendMessage,0x30,hFont2,1,, ahk_id %Dsp2%

Gui, Show,, Digital Clock
SetTimer, UpdateClock, 500
Return

uiMove:
 PostMessage, 0xA1, 2
Return

UpdateClock:
  If ( A_Sec == "00" ) {
    FormatTime, hm, , h:mm
    GuiControl,,Time, % hm
      If ( hm = "12:00" ) {
         FormatTime, tt,, tt
         GuiControl,, tt, %tt%
  }}
  If ( pSec <> A_Sec )
    GuiControl,,Sec, % pSec := A_Sec
Return

LoadFontFile( byRef fData ) {
hex=
( join ; Compressed hex data > reduced from 6608 to 5574 bytes
Y1UFZ8X3Z704F532F3283A84DD4W178V4E50434C54BEZ4081WCBCV36636D617XBZ6DW1F4V2C6376742014B20EA4W
344V586670676DA7D95E93W22U646761737XDY6WCBTC676C79662E4A2CEAW3B4W870686561645C58C2AAVFCV3668
68656105B501AFW134V24686D747816D40405W1C8V2C6C6F63610B3ZD9EW39CV186D61787Y8Z123W158V206E616D
65030712F8WC24V52706F7374YDZD6WC78V3870726570CE2F71BCW284VBFY1U1XAEBE4B0B5F0F3CF5W44CT36B5C2
EDTC45FBBB5Z3AW1F502BCY1YBY2M1W384FF38W23Y3AZ3B01F5Y1LMBY1UBZ22Y7Q2Y8Z4XAV5BZBFO21302BCY5Y20
2BC028AV8F02BC028AW1C5Z320103KLT416C7473Z2Y31Z3A032YC8W384ZBBW23Y3A023Z18D023Y3A023Y4E023Y3A
023Y3A023Y3A023Y4E023Y3A023Y3AZF4Z46U1Y3Y1UCY4Z2T4Y4Y1V3AFFFFV30FFFFFFDX1T4Z505040302Z2C7645
20BZ3254523616818236860442D2C4520BZ32545236168236860442D2C2020B8FFC03812B14Z136382D2C2020B04
03812BZ136B8FFC0382D2C01B046762047681823466168205820BZ3252338BZ22512BZ1366538592D4ZE1E1E1D1D
0D0D0404X101045018DB801FF857645684418B301Z46Z2BB302Z46Z2BB303Z46Z2BB3050D46Z2BB3060D46Z2BB30
7Z46Z2BB308Z46Z2BB3090D46Z2BB30A0446Z2BB30B1046Z2BB30C0446Z2BB30E0446Z2BB30F0D46Z2BB3111046Z
2BB3120D46Z2BB3131046Z2BB3140D46Z2BB3150446Z2BB3161046Z2BB3170D46Z2BB3181046Z2BB3190446Z2BB3
1A0446Z2BB31B0446Z2BB31C0446Z2B456844456844456844456844456844Y2BC02DC02A802470197Z68W35B0231
Z4B01ECFFAD0183W1FCZ14FFD6FF45Z74FF8CZ8B01AFFF6YBEFF73ZDZ104012A0139Z68Z68Z99ZAYA5ZC1Z27ZC1Z
18Z68Z45ZB2Z34Z8FZ1CV86Z9E011Z18Z1AA021C02A202EA0384040C0438Y6Z3AW1F502BCY3Y7YCZ11Z16Z1BZ9F4
0501612140C080A0F0E1D020303020A091D0506060513141D0407070418191D01W11B11160C0A1E1C02011EY7061
E0418171503141D1A191303121ZF0903081D0E0D0B030A03W5040D010A46762F3718Z3F3C3F3C012F173CFD173C2
F173CFD173CZ10FD3C10FD3C10FD2F3CD63C872E05C404FCC4872E05C404FCC4872E05C404FCC4872E05C404FCC4
011112391112393130B21C0A052B0107232701213733271507113727111715070511273537273537110701E268C4
680194FE6C68C4D868272768410194684141682702BC6969FD4468A18D68010F274F010F688D424EFEF1688D4169
8D68FEF128U2018DZ1401F502A8Y4Y9W111273537273537110701F568414168270123FEF1688D41698D68FEF128U
5Z3AW1F502BCY3Y7YCZ11Z17Z83403E160403131214110F0D0C080A0A091D050606050E0F1D01W10A1E1802011EZ
15141E17120407061E040E0D1D1ZF09081D0B0A03W5040D010A46762F3718Z3F3C3F3C012F3CFD3C2F3CFD3CZ10F
D3C3F3CFD3C10FD3C10FD872E05C404FCC4872E05C404FCC401111239111239Z111239012E2E2E3130B2180A052B
01072327012137332715071137253537110727170723273701E268C4680194FE6C68C4D86827012C6827473434DE
343402BC6969FD4468A18D68010F27698D68FEF1282134343434S5Z4EW1F502BCY3Y7YCZ11Z17Z80403E16050313
12140C080A090A1D040707040E0F1D01W1110C091E1802011EZ15141E17120407061E040E0D0B030A1D1ZF090308
03W5040D010346762F3718Z3F3C3F3C012F173CFD173CZ10FD3C3F3CFD3C10FD3C10FD2FD6872E05C404FCC4872E
05C404FCC401111239Z111239012E2E2E3130B21803052B010723270121373337112735372735371107271707232
73701E268C4680194FE6C68C47B6841416827473434DE343402BC6969FD4468BBFEF1688D41698D68FEF12821343
43434S4Z3AZ1401F502A8Y4Y9YEZ14X1311171507051127353727353711072717072327373A68410194684141682
7473434DE34340199010F688D424EFEF1688D41698D68FEF1282134343434S5Z3AW1F502BCY3Y7YCZ11Z17Z83403
E1605Z131214110D0F0C0A080A091D020303020E0F1D040707040E1E1802011EZ15141E17120407061E041ZF1D0E
0D0B0A1D090803W5040D010846762F3718Z3F3C3F3C012F3CFD3C2F3CFD3CZ10FD3C3F3CFD3C10FD3C10FD872E05
C404FCC4872E05C404FCC401111239111239Z111239012E2E2E3130B21808052B010723270121373301111715070
51127353727170723273701E268C4680194FE6C68C4FEC0684101946841473434DE343402BC6969FD44680131010
F688D424EFEF1688D414834343434W6Z3AW1F502BCY3Y7YCZ11Z16Z1CZ9D404D1BZ1817191612140C080A0F0E1D0
20303020A091D0506060513141D0407070411160C0A1E1D02011EZ1A191E1C170407061E0415141D13121ZF09030
81D0E0D0B030A03W5040D010A46762F3718Z3F3C3F3C012F173CFD173C2F3CFD3CZ10FD3C3F3CFD3C10FD3C10FD2
F3CD6872E05C404FCC4872E05C404FCC4872E05C404FCC401111239111239Z111239012E2E3130B21D0A052B0107
23270121373327150711372711171507051127353727170723273701E268C4680194FE6C68C4D868272768410194
6841473434DE343402BC6969FD4468A18D68010F274F010F688D424EFEF1688D414834343434W3Z4EZ1401F502BC
Y3Y8YDZ524025030804060A0B1D01W10D0802011EYA090703061D0C0B05030403W50F78010346762F3718Z763F18
3F3C012F173CFD173CZ10FD3C2FD6872E05C404FCC401111239012E3130B20E03052B01072327011127353727353
7110701E268C46801A7684141682702BC6969FE67FEF1688D41698D68FEF128W7Z3AW1F502BCY3Y7YCZ11Z16Z1BZ
21ZB3405A201D1C1E1612140C080A0F0E1D020303020A091D0506060513141D0407070418191D01W11B11160C0A1
E2202011EZ1F1E1E211C0407061E0418171503141D1A191303121ZF0903081D0E0D0B030A03W5040D010A46762F3
718Z3F3C3F3C012F173CFD173C2F173CFD173CZ10FD3C3F3CFD3C10FD3C10FD2F3CD63C872E05C404FCC4872E05C
404FCC4872E05C404FCC4872E05C404FCC401111239111239Z111239012E3130B2220A052B010723270121373327
1507113727111715070511273537273537110727170723273701E268C4680194FE6C68C4D8682727684101946841
416827473434DE343402BC6969FD4468A18D68010F274F010F688D424EFEF1688D41698D68FEF1282134343434S6
Z3AW1F502BCY3Y7YCZ11Z16Z1CZ9D404D1B05181719110D0F0C0A080A091D020303020E0F1D0407070413141D01W
1160C110E1E1D02011EZ1A191E1C170407061E0413121Z30F1D15140E030D0B0A1D090803W5040D010846762F371
8Z3F3C3F3C012F3CFD3C2F173CFD173CZ10FD3C3F3CFD3C10FD3C10FD2FD63C872E05C404FCC4872E05C404FCC48
72E05C404FCC401111239111239Z111239012E2E3130B21D08052B01072327012137330111171507051127353727
3537110727170723273701E268C4680194FE6C68C4FEC0684101946841416827473434DE343402BC6969FD446801
31010F688D424EFEF1688D41698D68FEF1282134343434S2Z46VAF0247Y3Y7Z35401907041E0502011EY5040103Z
1D070603030206050303YDZ3F3C3F3C012F173CFD173CZ10FD3C10FD3C3130B208Y52B3335331503353315466969
69686801DF6868S4Z36Y3Y10409Y1Z14Y8Y3Y10409Y2Y8U3Y10409Y3Z14Y8Y3Y10409Y4Z14Y8Z42Z6FZ6CZ64Z53Z
6BZ61Z6EZ73Z2DZ44Z69Z67Z69U2PFF88Z46KQBZ13Z14Z15Z16Z17Z18Z19Z1AZ1BZ1CZ1DU2YEY2FFFFY2Y1O10402
BCX6F1C02BC027544532D4469676974616CZ2AF5950802FFFFFFFF3FFFFFFF44532D52303V1V
)

VarSetCapacity(Z,512,48), Nums:="512|256|128|64|32|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2"
Loop, Parse, Nums, |                                  ;  Uncompressing nulls in hex data
  StringReplace,hex,hex,% Chr(70+A_Index),% SubStr(Z,1,A_LoopField),All

; Laszlo's MCode() ; http://www.autohotkey.com/forum/viewtopic.php?p=135302#135302
VarSetCapacity( fData,( nSize := StrLen(Hex)//2 ) )
Loop % nSize
  NumPut( "0x" . SubStr(hex,2*A_Index-1,2), fData, A_Index-1, "Char" )
Return nSize
}


Backup:
Previous Demo : <!-- w -->www.autohotkey.net/~Skan/Scripts/Digita ... mo_old.ahk<!-- w -->
GUI Snapshot : <!-- w -->www.autohotkey.net/~Skan/Scripts/Digita ... mo_old.png<!-- w -->

ahklerner
  • Members
  • 1386 posts
  • Last active: Oct 08 2014 10:29 AM
  • Joined: 26 Jun 2006
coool...how can i get the hex data for a ttf the I already have?
Posted Image
ʞɔпɟ əɥʇ ʇɐɥʍ

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Excellent! You never cease to amaze us :D

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Thanks ahklerner and daonlyfreez. :)

how can i get the hex data for a ttf the I already have?


You can use the snippet given here: How to convert Image data (JPEG/PNG/GIF) to hBITMAP ?.
Generally speaking, it is not a good idea to include any file over 8k ( hex will be 16k ), whereas a good font would weigh in the range between 20-50k

You can either store it inside autohotkeysc.bin ( if you compile ) or put it in external dll or call it from an axc file.
The font I have used is exceptionally small ( 3.23kb ) because it contains only a few glyphs

:)

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Webdings.ttf ( 118,752 bytes ) reduced to MediaB.ttf ( 1,740 bytes )

Fontname: MediaButtons
Mappings: 0123456789:;<=


Demo Media Buttons
Posted Image
nSize := LoadFontFile( fData )
fh := DllCall( "AddFontMemResourceEx", UInt,&fData, UInt,nSize, Int,0, UIntP,n )
FW_NORMAL := 400, SYMBOL_CHARSET := 2
hFont1 := DllCall( "CreateFont", Int,[color=red]16[/color], Int,0, Int,0, Int,0, UInt,FW_NORMAL, UInt,0
     , Int,0, Int,0, UInt,SYMBOL_CHARSET, Int,0, Int,0, Int,0, Int,0, Str,"[color=red]MediaButtons[/color]" )
Buttons := "0123456789:;<="
Loop, Parse, Buttons
 {
   Gui, Add, Button, x+5 y10 w33 h27 hwndhButton%A_Index%, %A_LoopField% 
   SendMessage, 0x30, hFont1,1,, % "ahk_id " hButton%A_Index%
 }              
Gui, Show,, MediaButtons.ttf   [  %Buttons%  ]
OnExit, QuitScript
Return                                                 ; // end of auto-execute section //

QuitScript:
GuiClose:
 DllCall( "RemoveFontMemResourceEx",UInt,fh ),       DllCall( "DeleteObject",UInt,hFont1 )
 ExitApp
Return
 

LoadFontFile( byRef fData ) {                                                 ; MediaB.ttf
hex=
( LTrim Join
[color=#808080]H1LBG8I3G304F532F3238C8F05CJ138K56636D617ICF06FJ1B4K2C6761737G823HAJ6C8K14676C7966F815372F
J2L27468656164DB7C5221KBCK36686865610DE806E9KF4K24686D747816970C5AJ19L226C6F6361046A0514J1
EL206D61787G18EG43J118K206E616D65427DBB76J474J232706F7374FEF2G64J6A8K2I1L1I3D5399595F0F3CF
5G1908OAF4EDB77MC5802D69G80FF4G7H5NCH2T1J666FE66J8I8H8G7J1ZO2H1LFG12H3P2G1H2FG46J125T107BB
019I5J4CE04CEJ31604CE04CEJ316G6402120CH5030102010509060703ZP534B202H40F030F03D0666FE66J666
019A8Y4I8G8H2H1H1H2H3H14G14G11G1BA012G12G26701CG1CQ1H3PCH4G2M4H4H1IF03DFFFFIF030FFFF0FD1H1
S14G22G38G5EG6CG7AG88G96GACGC2GDEGFA011G11E013AH2G8K38G4D6H3H7I33112111252111218G3GFD9401D
8FE2804D6FB2A9403AEH102GFF4G6I4I3J521112106GFCH4GCG1L201GFF4G7H4CI3H7J52111210311211107GFA
H6G80FBGCG580FBH4GFCN301GFF4G7H4CI7HDG11J1211121112111210311211121110311211107GFE80FB8G18G
48080FC8G28080FC8G140FEH38G2GFDH2GFFGFFGFEH2GFEJ102L48G5J2I2109010480FD8G28G28G28K103L58G5
J2J901110580FD8G280FD8G5L1014G14G64G3CI2J121010640FBH28G14G28K1014HCG64G34I2J9020640FD80FD
8G340FD8G28I20110FFCG64204CI2H5J509040642FD8G280FD4EFD8G2804G28G280FBH28G28M201BAFFCG6EC04
CI2H5J9011103011106ECFD8032FD8G240FD8G5GFD80FD8G5P30120FFCG6EC04CI2H5H9J5090523113306ECFD8
G280FD4EFD8G280FD6680804G28G280FBH28G280FBH5L30120FFCG6EC04CI3H6H9J523113303011103011106EC
80809AFD8032FD804G5GFD80FD8G5GFD80FD8G5P20267FFCG56704CI3H7J5211121012111210567FFH1GFEGFFH
1G4G5GFBH5L101CH26064G4A6H3I252111210640FB8G48026048K101CH26064G4A6HBJ114G2322G3534G3332H6
40FEAEEEEEFEAE0152EEEE01520266EEFEAE0152EEEE0152FEAEQ1C0156H3J403H2HCG92H3J405H2G1M3J406H2
HCG1I3J407H2G1H1CH3J408H2G1H2CH3J409H1G18G4AH3J409H2HEG3CH3J409H3G18G4AH3J409H4G18G4AH3J40
AH2HCG92H3J40BH2G1H62H3J40CH2HCG92H3J40EH2HCGBI3J41I2HEG72H3J413H2G12G8I3J414H2HCG92H3J415
H2G1H92H3J416H2HCG92H3J419H2HEGA2H3J41BH2G1HBI3J41DH2HCG92H3J41FH2HCG92H3J424H2HEGCI3J42DH
2HEGCEH3J80AH2HCG92H3J816H2HCG92H3JC0AH2HCG92H3JC0CH2HCG92G6FG62G79010DG65G6AG6EGE9G6EG6FG
72G6DG61G6CG53G74G61G6EG64G61G72G64039A03B103BD03BF03BD03B903BA03ACG52G65G67G75G6CG61G72G4
DG65G64G69G61G42G75G74G74G6FG6EG73G4EG6FG72G6DG61G61G6CG69G4EG6FG72G6DG61G6CG65G53G74G61G6
EG64G61G61G72G64G4EG6FG72G6DG61G6CG6EG79041E0431044B0447043D044B0439G4EG6FG72G6DGE1G6CG6EG
65G4EG61G76G61G64G6EG6FG41G72G72G75G6EG74G61L3QFEEFG64ZZJ4H8H2G1CH108J3FFFFI[/color]
)
Loop 20
 StringReplace,Hex,Hex,% Chr(70+21-A_Index),% SubStr("000000000000000000000",A_Index), All
VarSetCapacity( fData,( nSize := StrLen(Hex)//2 ) )
Loop % nSize
 NumPut( "0x" . SubStr(hex,2*A_Index-1,2), fData, A_Index-1, "Char" )
Return nSize   
}

Note: Null compression algorithm for hex data
kWo4Lk1.png

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Very nice! 8)

What tools do you use to create the small ttf, and what is the maximum size this inline method can handle? Can this be used to load a ttf file too?

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Can this be used to load a ttf file too?


Sure.. Instead of
nSize := LoadFontFile( fData )
use
FileGetSize, nSize, MediaB.ttf
FileRead, fData, MediaB.ttf

If you are compiling your script,
Add MediaB.ttf as RCDATA to AutoHotkeySC.bin ( with, maybe, ResHacker ) and load it from your script as follows:
hModule   := DllCall( "GetModuleHandle", Str, A_ScriptFullPath ) 
hResource := DllCall( "FindResource", UInt,hModule, UInt,[color=red]500[/color], UInt,[color=red]10[/color] )  
nSize     := DllCall( "SizeofResource", UInt,hModule, UInt,hResource ) 
hResData  := DllCall( "LoadResource", UInt,hModule, UInt,hResource ) 
fData     := DllCall( "LockResource", UInt, hResData )
fh := DllCall( "AddFontMemResourceEx", UInt, fData, UInt,nSize, Int,0, UIntP,n )
; Take care!  No Ampersand for fData - here ^

;[color=red] 500 is Ordinal and 10 is RCDATA[/color]

what is the maximum size this inline method can handle?


This type of text-concatenation has a limit of 16kb limit per variable, but we may use .= operator to merge multiple variables, like, if we have 30kb of hex data:
Data=
( Ltrim Join
; paste the initial 16kb of hex data here
)
[color=red]Hex .= Data[/color]
Data=
( Ltrim Join
; paste the rest of hex data here
)
[color=red]Hex .= Data[/color]
The above method should be quite okay for few hundred KB's, but this would affect the load-time of the script.

What tools do you use to create the small ttf


High Logic - FontCreator - Commercial Software :| :( :oops: ( you can guess why I am embarrased )

Pretty exhaustive software. I open a .TTF and delete/alter as much information as I can.. and save it. That is it!.
Not advisable to work on an installed font though. Have to move it out from windows' font folder first.

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
With your suggested adaptation
FileGetSize, nSize, MediaB.ttf 
FileRead, fData, MediaB.ttf
instead of inline, if I try to load any ttf file that is bigger than, say 6 or 7 kB, the script does not work, and if I don't supply the exact internal fontname it won't either. :?
I have not tried inline yet, but are you really sure about those limits?

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

instead of inline, if I try to load any ttf file that is bigger than, say 6 or 7 kB, the script does not work


Refer MSDN: CreateFont()
for the fdwCharSet parameter, I had used
ANSI_CHARSET for Digital Clock
SYMBOL_CHARSET for Media Buttons
whereas
using DEFAULT_CHARSET is more generic and works with every random font I experimented.

Here is the script:

FontFile := "Modaerne Regular.ttf"
FontName := "Modaerne Regular"
Url      := "http://www.webpagepublicity.com/free-fonts/m/Modaerne%20Regular.ttf"

#SingleInstance, Force
SetWorkingDir, %A_ScriptDir%
IfNotExist, %FontFile%, UrlDownloadToFile, %Url%, %FontFile% 

FileGetSize, nSize, %FontFile%
FileRead, fData, %FontFile%

fh := DllCall( "AddFontMemResourceEx", UInt,&fData, UInt,nSize, Int,0, UIntP,n )
FW_NORMAL := 400, DEFAULT_CHARSET := 0x1
hFont1 := DllCall( "CreateFont", Int,28, Int,0, Int,0, Int,0, UInt,FW_NORMAL, UInt,0
     , Int,0, Int,0, UInt,DEFAULT_CHARSET, Int,0, Int,0, Int,0, Int,0, Str,FontName )

Gui, Color, DEE3E7
Gui, Add, Text, x+5 y10 w640 h50 hwndhText 0x200 , What This Font Looks Like
SendMessage, 0x30, hFont1,1,, ahk_id %hText%
             
Gui, Show,, %FontFile%  [%nSize% bytes]
OnExit, QuitScript

^F2::Reload                                              ; // end of auto-execute section //

GuiEscape:
QuitScript:
GuiClose:
 DllCall( "RemoveFontMemResourceEx",UInt,fh ),       DllCall( "DeleteObject",UInt,hFont1 )
 ExitApp
Return

/*

[color=red]Copy & Replace any of the following to top of the script[/color]

FontFile := "ZXSpectrum.ttf"
FontName := "ZXSpectrum"
Url      := "http://www.webpagepublicity.com/free-fonts/z/ZXSpectrum.ttf"

FontFile := "Action Is_ The Sequel.ttf"
FontName := "Action Is: The Sequel"
Url      := "http://www.webpagepublicity.com/free-fonts/a/Action%20Is_%20The%20Sequel.ttf"

FontFile := "Screen.ttf"
FontName := "Screen"
Url      := "http://www.webpagepublicity.com/free-fonts/s/Screen.ttf"

FontFile := "LED BOARD REVERSED.ttf"
FontName := "LED BOARD REVERSED"
Url      := "http://www.webpagepublicity.com/free-fonts/l/LED%20BOARD%20REVERSED.ttf"

FontFile := "HammerThin Regular.ttf"
FontName := "HammerThin Regular"
Url      := "http://www.webpagepublicity.com/free-fonts/h/HammerThin%20Regular.ttf"

FontFile := "Fantomet.ttf"
FontName := "Fantomet"
Url      := "http://www.webpagepublicity.com/free-fonts/f/Fantomet.ttf"

FontFile := "Digital Readout ExpUpright.ttf"
FontName := "Digital Readout ExpUpright"
Url      := "http://www.webpagepublicity.com/free-fonts/d/Digital%20Readout%20ExpUpright.ttf"

FontFile := "Moon Phases.ttf"
FontName := "Moon Phases"
Url      := "http://www.webpagepublicity.com/free-fonts/m/Moon%20Phases.ttf"

FontFile := "Zud Juice.ttf"
FontName := "Zud Juice"
Url      := "http://www.webpagepublicity.com/free-fonts/z/Zud%20Juice.ttf"

FontFile := "Zuerbig.ttf"
FontName := "Zuerbig"
Url      := "http://www.webpagepublicity.com/free-fonts/z/Zuerbig.ttf"

FontFile := "Qwikscribble Normal.ttf"
FontName := "Qwikscribble Normal"
Url      := "http://www.webpagepublicity.com/free-fonts/q/Qwikscribble%20Normal.ttf"

FontFile := "Queue Regular.ttf"
FontName := "Queue Regular"
Url      := "http://www.webpagepublicity.com/free-fonts/q/Queue%20Regular.ttf"

if I don't supply the exact internal fontname it won't either. :?


How would it?!.. uh.. Okay, I should have mentioned it. :(
Fetching the internal fontname is possible, though
[*:2mzljlfh]Retrieving a Fontname from TTF with FREETYPE DLL
[*:2mzljlfh]TrueType font file informations (name that .TTF font!)

I have not tried inline yet, but are you really sure about those limits?


16000 bytes would be safe to assume.. though I find it to be 16379 in following example:

nSize:= LoadFontFile( fData )
fh := DllCall( "AddFontMemResourceEx", UInt,&fData, UInt,nSize, Int,0, UIntP,n )
FW_NORMAL := 400, DEFAULT_CHARSET := 0x1
hFont1 := DllCall( "CreateFont", Int,28, Int,0, Int,0, Int,0, UInt,FW_NORMAL, UInt,0
     , Int,0, Int,0, UInt,DEFAULT_CHARSET, Int,0, Int,0, Int,0, Int,0, Str,"Fantomet" )
Gui, Add, Text, x+5 y10 w640 h50 hwndhText 0x201 , What This Font Looks Like
SendMessage, 0x30, hFont1,1,, ahk_id %hText%          
Gui, Show,, Fantomet [%nSize% bytes]
OnExit, QuitScript
Return                                                 ; // end of auto-execute section //

GuiEscape:
QuitScript:
GuiClose:
 DllCall( "RemoveFontMemResourceEx",UInt,fh ),       DllCall( "DeleteObject",UInt,hFont1 )
 ExitApp
Return


LoadFontFile( byRef fData ) {                                   ; Fantomet.ttf 15,280 bytes
Data=
( Join
00010000000F0030000300C04F532F3251CD5EB600003AA40000005650434C542B2DC8BC00003AFC0000003663
6D617011DF1739000033100000030A63767420B571B9F400000384000000186670676D8333C24F000003700000
0014676C7966AF408B61000003C800002C7868646D78F78FB4780000361C0000048868656164C24FA18900003B
34000000366868656106AD032100003B6C00000024686D7478BE32003F00003154000001106C6F63610005D656
00003040000001146D617870009C010700003B90000000206E616D656DE2638C000000FC00000273706F737408
E1095F00003264000000AA7072657076B81B570000039C0000002A00000018012600000000000000000074003A
0000000000000001001000B60000000000000002000E00CD0000000000000003001000FB000000000000000400
1000E30000000000000005001C011900000000000000060010013D00000000000000070000014D000100000000
0000003A00000001000000000001000800AE0001000000000002000700C60001000000000003000800F3000100
0000000004000800DB0001000000000005000E010B00010000000000060008013500010000000000070000014D
00030001040900000074003A0003000104090001001000B60003000104090002000E00CD000300010409000300
1000FB0003000104090004001000E30003000104090005001C011900030001040900060010013D000300010409
00070000014D4C697374656D61676572656E2031393937202D206269626C6973746540706F7374322E74656C65
2E646B202D20706F737463617264776172652E004C0069007300740065006D00610067006500720065006E0020
00310039003900370020002D0020006200690062006C006900730074006500400070006F007300740032002E00
740065006C0065002E0064006B0020002D00200070006F0073007400630061007200640077006100720065002E
46616E746F6D657400460061006E0074006F006D00650074526567756C61720052006500670075006C00610072
46616E746F6D657400460061006E0074006F006D0065007446616E746F6D657400460061006E0074006F006D00
650074322E30202D2033312D30382D39370032002E00300020002D002000330031002D00300038002D00390037
46616E746F6D657400460061006E0074006F006D00650074004001002C764520B003254523616818236860442D
FFF403D0005100E7004400535A725A725A725A7200040006400501010000018DB801FF85456844456844B30302
46002BB3050446002BB10202456844B1040445684400000002003F000001B603D0000300070057402101080840
0902070402010006050203020504040007060401020101030000010046762F3718003F3C3F3C10FD3C10FD3C01
2F3CFD3C2F3CFD3C003130014968B900000008496861B0405258381137B90008FFC0385933112111253311233F
0177FEC7FAFA03D0FC303F03530000030000000002DC03D000060009000C00584021010D0D400E070B07060C0A
09080705000C0A040302080901050401030000010946762F3718003F173C3F2F2F3CFD3C012E2E2E2E2E2E2E00
2E2E2E3130014968B90009000D496861B0405258381137B9000DFFC0385921232723072309011121010B01029A
5758FB5856012C016EFD2401D46667FEFE036FFC9103D0FD720128FED800040000000002DC03D00010001F0029
002C006F402E012D2D402E2A2A161506052C2B2A110E0B26251703160205042002002726040318170425242B2C
01040300012C46762F3718003F3C3F2F2F3CFD3C10FD3C012FFD2F3CFD173C2E2E2E2E2E2E002E2E2E2E2E3130
014968B9002C002D496861B0405258381137B9002DFFC038592514062B01113332161716151406071E01033427
262B01113332373637363736133427262B01113332361711210258805FF5C82C5C1F4A4134434D6E2E26546B91
3D2312080303021B262A518D984E48D7FD24D75E79034B191736663B6820207A015D4F1F19FED82D171B09170E
FE6C54343BFEAA468A03D000020000FFEE02DC03D00028002B00584021012C2C402D2929281615002B2A291500
1E020A2304041A04112A2B010400012B46762F3718003F3F2F2FFD10FD012FFD2E2E2E2E2E002E2E2E2E2E3130
014968B9002B002C496861B0405258381137B9002CFFC0385925140E0123222726272635343736373E01333217
161523342F022207061514171E013332373E013517112102653D68365643391F23290A1523634150414653451E
217A2D15361A452C2B1A1F24CAFD24B236593541385A657F7B761D26404532374D43210A04B95666B064312E11
0F3A26B203D000030000000002DC03D0000D001A001D005B4022011E1E401F1B1B15140B0A1D1C1B16150A090E
0200171604081C1D01090800011D46762F3718003F3C3F2F10FD3C012FFD2E2E2E2E2E2E2E002E2E2E2E2E3130
014968B9001D001E496861B0405258381137B9001EFFC0385901140706070607062B0111333216072726272E01
2B01113332373613112102631103052652303DEDD29C7D5304010C115B5376925C2C32C6FD2401AA594A111486
3A22034BE9B86B23344A50FD3E5B67FEFA03D00000020000000002DC03D0000B000E0070402E010F0F40100C0C
050403020E0D0C0B08070403000A090603050202010B0A040007060409080D0E01010000010E46762F3718003F
3C3F2F2F3CFD3C10FD3C012F3CFD173C2E2E2E2E2E2E2E2E2E002E2E2E2E2E3130014968B9000E000F496861B0
405258381137B9000FFFC03859290111211521112115211121171121024CFE4401BCFE970100FF00016990FD24
034B45FED344FEAF4403D00000020000000002DC03D00009000C00654028010D0D400E0A0A090801000C0B0A09
040300060502030102080703020405040B0C01070600010C46762F3718003F3C3F2F2F3CFD3C012F3CFD173C2E
2E2E2E2E2E2E002E2E2E2E2E3130014968B9000C000D496861B0405258381137B9000DFFC03859012111211521
112311211311210251FE8E0113FEED5301C58BFD240306FED344FE6B034BFCB503D00000020000FFF102DC03D0
002A002D006D402C012E2E402F2B2B231B181712022D2C2B292817270201022A001F020B2A290428272C2D0106
00010000012D46762F3718003F3C3F3F2F2F3CFD3C012FFD2F3CFD3C3C2E2E2E2E2E2E002E2E2E2E2E2E2E3130
014968B9002D002E496861B0405258381137B9002EFFC038592123350F01062322272E0135343736373E013332
161716152334262322070615141716333237363523352113112102755316192A645B3E35310F0E1D1F654B3267
1F25534C3E8422102126656A3023BD011067FD245B1F1C2F4138BE665B524D3F435132272F423D48BF5B6E9D57
64654B7844FE5E03D000020000000002DC03D0000B000E006E402F010F0F40100C0C0B0A07060E0D0C0A090203
01020B00080704030302060509080403020D0E01050401030000010E46762F3718003F173C3F2F2F3CFD3C012F
3CFD173C2F3CFD173C2E2E2E002E2E2E2E2E3130014968B9000E000F496861B0405258381137B9000FFFC03859
212311211123113311211133131121025653FED65353012A5386FD24019AFE66034BFE93016DFCB503D0000200
00000002DC03D0000B000E0070402F010F0F40100C0C0E0D0C0B080706050201000403020A090B0A0303020500
09080503040507060D0E01010000010E46762F3718003F3C3F2F2F3CFD173C10FD173C012F3CFD3C2E2E2E2E2E
2E2E2E2E2E2E002E3130014968B9000E000F496861B0405258381137B9000FFFC0385929013533112335211523
11331711210203FED66B6B012A6C6CD9FD245302A55353FD5B5303D000020000FFEC02DC03D00018001B006540
28011C1C401D19190C0B1B1A1917160D0C020B0A151402180010050616150518171A1B010600011B46762F3718
003F3F2F2F3CFD3C10FD012F3CFD3C2F3CFD3C2E2E2E2E2E002E2E2E3130014968B9001B001C496861B0405258
381137B9001CFFC0385925140706070623222E013D0133151416333237363511233533131121025613245D282F
3B6C3E53464C29244B99EC86FD24C12F274A251033614997974B3F0E1D57023753FCB503D00000020000000002
DC03D00016001900604026011A1A401B17170F0706050219181716100007060203030205041819010403010300
00011946762F3718003F173C3F2F012F3CFD173C2E2E2E2E2E2E002E2E2E2E2E2E3130014968B90019001A4968
61B0405258381137B9001AFFC03859212301032311330332373637363F02170F0106070607011121027A6CFEB6
02535301150F344A2E21251F4B473917382A3001C4FD24018AFE76034BFE9108165E3A3A403F20815D253B2C1B
FE5A03D00000020000000002DC03D00005000800574020010909400A0606030208070605000403020201050405
00070801010000010846762F3718003F3C3F2F10FD3C012F3CFD3C2E2E2E2E2E002E2E2E3130014968B9000800
09496861B0405258381137B90009FFC03859290111331121171121024BFE4653016791FD24034BFD085303D000
00020000000002DC03D0000B000E00674029010F0F40100C0C0B0A0908070403020E0D0C0A0201020B00050402
07060D0E01060501030000010E46762F3718003F173C3F2F012F3CFD3C2F3CFD3C3C2E2E2E002E2E2E2E2E2E2E
2E2E3130014968B9000E000F496861B0405258381137B9000FFFC038592123110B01112311331B013313112102
8E53CDCD5353CDCD534EFD2402A6FE4201BEFD5A034BFE3A01C6FCB503D00000020000000002DC03D00009000C
00634027010D0D400E0A0A0908070605020C0B0A07030202050408010209000B0C01040301030000010C46762F
3718003F173C3F2F012F3CFD3C2F3CFD3C2E2E2E2E002E2E2E2E2E2E2E3130014968B9000C000D496861B04052
58381137B9000DFFC0385921230111231133011133131121025E53FEC4536E0121537EFD2402DDFD23034BFD74
028CFCB503D00000030000FFEE02DC03D00018002C002F0053401F01303040312D2D2F2E2D1921020C2C020027
04061D04102E2F010600012F46762F3718003F3F2F2FFD10FD012FFD2FFD2E2E2E2E002E3130014968B9002F00
30496861B0405258381137B90030FFC0385901160706070623222726272635343736333217161F01161F010736
272623220706151417161716333237363F01131121026E030F1B5D344885431D0F0C6A385E48323A16190B0509
4A04101A8C6C24220C0B28254E4B282C0708C0FD24019B325CA94C2A913E554253F47F4329303C451F2A504F5B
6EB5645FAF6D524D363333384854FEC703D000030000000002DC03D0000C0015001800614026011919401A1616
1211100F0908050418171611100603050208070D0200171801070600011846762F3718003F3C3F2F012FFD2F3C
FD173C2E2E2E002E2E2E2E2E2E2E2E2E3130014968B900180019496861B0405258381137B90019FFC038590114
07062B011123113332171607342B01113332373613112102523E45619253D393432053A380925B2412DDFD2402
686D4F58FEAC034B71363C9EFE936733FDCD03D000030000FFAD02DC03D0002200360039005D4024013A3A403B
37370239383723222B020A3602170031040427040E38010039010400013946762F3718003F3F2F3C2F2FFD10FD
012F3CFD2FFD2E2E2E2E2E002E2E3130014968B90039003A496861B0405258381137B9003AFFC0385905232706
23222726272635343736333217161F01161F021607060F01060706070607133627262322070615141716171633
3237363F01131121026E623A2F3585431D0F0C6A385E48323A16190B05090401030107080206020B15210F0410
1A8C6C24220C0B28254E4B282C0708C0FD24535A19913E554253F47F4329303C451F2A504F17280F2D350D1209
1E3C2A015C5B6EB5645FAF6D524D363333384854FEC703D000030000000002DC03D0000F001A001D0069402B01
1E1E401F1B1B17161514070603021D1C1B0F00161504030302060510020B1C1D01050401030000011D46762F37
18003F173C3F2F012FFD2F3CFD173C2E2E2E2E2E002E2E2E2E2E2E2E2E2E3130014968B9001D001E496861B040
5258381137B9001EFFC0385921230323112311333217161514070607373427262B011133323736011121026D53
DF7A53E484391B4B252F4C43222A87874229240105FD240170FE90034B743734774B250FF6622513FEAF3C36FD
D903D000020000FFE802DC03D00039003C005B4023013D3D403E3A3A2B0D3C3B3A2A0C1902003302221205032F
05263B3C01040300013C46762F3718003F3C3F2F2FFD10FD012FFD2FFD2E2E2E2E2E002E2E2E3130014968B900
3C003D496861B0405258381137B9003DFFC038592514062B01272227262F03371F021633323F01363736353427
262F01262726353437363332171617072F0126232207061514171E011716131121026A836E2012071B3115211D
3237451C241E302D2221051316301E1F587324356F343F473A254B2C3E2C19423D262C4319CD323672FD24D26E
7C030A120F181A31353F15110E1317051C202C462C1B1438492536507D31171C1138412A1A0F1A1D3B45391578
353AFEDB03D00000020000000002DC03D00007000A005D4024010B0B400C08080A090807060500040302020105
04010300050706090A01030200010A46762F3718003F3C3F2F2F3CFD173C012F3CFD3C2E2E2E2E2E2E2E002E31
30014968B9000A000B496861B0405258381137B9000BFFC0385901231123112335211311210280E953E902255C
FD2402F8FD0802F853FCB503D00000020000FFF102DC03D000140017005940210118184019151514130F0A0917
16150B0A02090813120214001617010400011746762F3718003F3F2F012F3CFD3C2F3CFD3C2E2E2E002E2E2E2E
2E2E3130014968B900170018496861B0405258381137B90018FFC0385925140706232227263511331114171633
3236351133131121025649435C5C43495346222D40555386FD24B75A38343439590294FD6C531F0F443D0294FC
B503D00000020000000002DC03D000060009004D401A010A0A400B070706050403000908070300080901020100
010946762F3718003F3C3F2F012E2E2E2E2E002E2E2E2E2E2E3130014968B90009000A496861B0405258381137
B9000AFFC0385901032303331B021121025CBC64BC539B9BD3FD24034BFCB5034BFD3402CCFCB503D000000200
00000002DC03D0000B000E00614026010F0F40100C0C0B0A0908070603000E0D0C06000802050A02010D0E0105
0402030100010E46762F3718003F173C3F2F012FFD2FFD2E2E2E2E2E002E2E2E2E2E2E2E2E2E3130014968B900
0E000F496861B0405258381137B9000FFFC038590103230B012303331B041121028E4256888955425338959538
A1FD24034BFCB501B9FE47034BFD3E01E1FE1F02C2FCB503D00000020000000002DC03D0000B000E005B402201
0F0F40100C0C0A09080706020E0D0C0B0A060504000D0E01040301030000010E46762F3718003F173C3F2F012E
2E2E2E2E2E2E2E2E002E2E2E2E2E2E2E3130014968B9000E000F496861B0405258381137B9000FFFC038592123
0B01231303331B013303011121025D5A95965AC2C25A95965AC30142FD240142FEBE01A501A6FEBD0143FE5BFE
5A03D00000020000000002DC03D00008000B0056401F010C0C400D090908070605000B0A09050004030202010A
0B01030200010B46762F3718003F3C3F2F012F3CFD3C2E2E2E2E2E002E2E2E2E2E2E3130014968B9000B000C49
6861B0405258381137B9000CFFC03859010311231103331B021121026DD653D553ACACC2FD24034BFE29FE8C01
7401D7FE82017EFCB503D000020000000002DC03D00009000C00654027010D0D400E0A0A080C0B0A0908070605
04030201000902050004030506050B0C01010000010C46762F3718003F3C3F2F2F3CFD3C10FD3C012E2E2E2E2E
2E2E2E2E2E2E2E2E002E2E3130014968B9000C000D496861B0405258381137B9000DFFC0385929013501213521
1501211711210256FE300164FEAD01A1FE9C018286FD245302A55353FD5B5303D00000010000000002DC03D000
02003A401001030340040101020100020000010046762F3718003F2F012E2E2E002E3130014968B90000000349
6861B0405258381137B90003FFC0385931211102DC03D00000010000000002DC03D00003003D40110104044005
020302010003000201010046762F3718002F3C2F3C012E2E2E2E003130014968B900000004496861B040525838
1137B90004FFC038591901211102DC03D0FC3003D00000010000000002DC03D00002003A401001030340040202
010000010200010046762F3718003F2F2F012E2E2E003130014968B900000003496861B0405258381137B90003
FFC0385919012102DC03D0FC300000030000000002DC03D000060009000C00564020010D0D400E0C0B08060C0B
0A0907050009070403020A0C050401040000010A46762F3718003F173C2F2F3CFD3C012E2E2E2E2E2E2E002E2E
2E3130014968B9000A000D496861B0405258381137B9000DFFC0385921232723072301130B01011121029A5758
FB5856012C666667FEF902DCFEFE036FFDD30128FED8028EFC300000040000000002DC03D00010001F0029002C
006E402D012D2D402E2C2B161506052C2B2A110E0B26251703160205042002002726040318170425242A2C0403
00012A46762F3718003F3C3C2F2F3CFD3C10FD3C012FFD2F3CFD173C2E2E2E2E2E2E002E2E2E2E2E3130014968
B9002A002D496861B0405258381137B9002DFFC038592514062B01113332161716151406071E01033427262B01
113332373637363736133427262B01113332360111210258805FF5C82C5C1F4A4134434D6E2E26546B913D2312
080303021B262A518D984E48FDFB02DCD75E79034B191736663B6820207A015D4F1F19FED82D171B09170EFE6C
54343BFEAA460346FC300000020000FFEE02DC03D00028002B00584021012C2C402D2B2A281615002B2A291500
1E020A2304041A0411292B000400012946762F3718003F3F2F2FFD10FD012FFD2E2E2E2E2E002E2E2E2E2E3130
014968B90029002C496861B0405258381137B9002CFFC0385925140E0123222726272635343736373E01333217
161523342F022207061514171E013332373E013501112102653D68365643391F23290A1523634150414653451E
217A2D15361A452C2B1A1F24FDEE02DCB236593541385A657F7B761D26404532374D43210A04B95666B064312E
110F3A26031EFC3000030000000002DC03D0000D001A001D005A4021011E1E401F1D1C15140B0A1D1C1B16150A
090E0200171604081B1D090800011B46762F3718003F3C3C2F10FD3C012FFD2E2E2E2E2E2E2E002E2E2E2E2E31
30014968B9001B001E496861B0405258381137B9001EFFC0385901140706070607062B0111333216072726272E
012B01113332373601112102631103052652303DEDD29C7D5304010C115B5376925C2C32FDEA02DC01AA594A11
14863A22034BE9B86B23344A50FD3E5B6702CAFC300000020000000002DC03D0000B000E006F402D010F0F4010
0E0D050403020E0D0C0B08070403000A090603050202010B0A040007060409080C0E010000010C46762F371800
3F3C3C2F2F3CFD3C10FD3C012F3CFD173C2E2E2E2E2E2E2E2E2E002E2E2E2E2E3130014968B9000C000F496861
B0405258381137B9000FFFC03859290111211521112115211121011121024CFE4401BCFE970100FF000169FDB4
02DC034B45FED344FEAF038CFC3000020000000002DC03D00009000C00644027010D0D400E0C0B090801000C0B
0A09040300060502030102080703020405040A0C070600010A46762F3718003F3C3C2F2F3CFD3C012F3CFD173C
2E2E2E2E2E2E2E002E2E2E2E2E3130014968B9000A000D496861B0405258381137B9000DFFC038590121112115
21112311212511210251FE8E0113FEED5301C5FDAF02DC0306FED344FE6B034B85FC3000020000FFF102DC03D0
002A002D006C402B012E2E402F2D2C231B181712022D2C2B292817270201022A001F020B2A290428272B06002D
010000012B46762F3718003F3C3C3F2F2F3CFD3C012FFD2F3CFD3C3C2E2E2E2E2E2E002E2E2E2E2E2E2E313001
4968B9002B002E496861B0405258381137B9002EFFC038592123350F01062322272E0135343736373E01333216
1716152334262322070615141716333237363523352101112102755316192A645B3E35310F0E1D1F654B32671F
25534C3E8422102126656A3023BD0110FD8B02DC5B1F1C2F4138BE665B524D3F435132272F423D48BF5B6E9D57
64654B7844022EFC3000020000000002DC03D0000B000E006C402E010F0F40100E0D0B0A07060E0D0C0A090203
01020B00080704030302060509080403020C0E050401040000010C46762F3718003F173C2F2F3CFD3C012F3CFD
173C2F3CFD173C2E2E2E002E2E2E2E2E3130014968B9000C000F496861B0405258381137B9000FFFC038592123
11211123113311211133251121025653FED65353012A53FDAA02DC019AFE66034BFE93016D85FC300002000000
0002DC03D0000B000E006F402E010F0F40100E0D0E0D0C0B080706050201000403020A090B0A03030205000908
0503040507060C0E010000010C46762F3718003F3C3C2F2F3CFD173C10FD173C012F3CFD3C2E2E2E2E2E2E2E2E
2E2E2E002E3130014968B9000C000F496861B0405258381137B9000FFFC0385929013533112335211523113301
11210203FED66B6B012A6C6CFDFD02DC5302A55353FD5B037DFC300000020000FFEC02DC03D00018001B006540
28011C1C401D1B1A0C0B1B1A1917160D0C020B0A15140218001005061615051817191B000600011946762F3718
003F3F2F2F3CFD3C10FD012F3CFD3C2F3CFD3C2E2E2E2E2E002E2E2E3130014968B90019001C496861B0405258
381137B9001CFFC0385925140706070623222E013D0133151416333237363511233533251121025613245D282F
3B6C3E53464C29244B99ECFDAA02DCC12F274A251033614997974B3F0E1D5702375385FC300000020000000002
DC03D000160019005E4025011A1A401B19180F0706050219181716100007060203030205041719040301040000
011746762F3718003F173C2F012F3CFD173C2E2E2E2E2E2E002E2E2E2E2E2E3130014968B90017001A496861B0
405258381137B9001AFFC03859212301032311330332373637363F02170F0106070607011121027A6CFEB6025
)
Hex .= Data
Data=
( Join
35301150F344A2E21251F4B473917382A30FEE802DC018AFE76034BFE9108165E3A3A403F20815D253B2C1B022
AFC300000020000000002DC03D0000500080056401F010909400A0807030208070605000403020201050405000
608010000010646762F3718003F3C3C2F10FD3C012F3CFD3C2E2E2E2E2E002E2E2E3130014968B900060009496
861B0405258381137B90009FFC03859290111331121011121024BFE46530167FDB502DC034BFD08037DFC30000
20000000002DC03D0000B000E00654028010F0F40100E0D0B0A0908070403020E0D0C0A0201020B00050402070
60C0E060501040000010C46762F3718003F173C2F012F3CFD3C2F3CFD3C3C2E2E2E002E2E2E2E2E2E2E2E2E313
0014968B9000C000F496861B0405258381137B9000FFFC038592123110B01112311331B0133251121028E53CDC
D5353CDCD53FD7202DC02A6FE4201BEFD5A034BFE3A01C685FC300000020000000002DC03D00009000C0061402
6010D0D400E0C0B0908070605020C0B0A07030202050408010209000A0C040301040000010A46762F3718003F1
73C2F012F3CFD3C2F3CFD3C2E2E2E2E002E2E2E2E2E2E2E3130014968B9000A000D496861B0405258381137B90
00DFFC0385921230111231133011133251121025E53FEC4536E012153FDA202DC02DDFD23034BFD74028C85FC3
00000030000FFEE02DC03D00018002C002F0053401F01303040312F2E2F2E2D1921020C2C02002704061D04102
D2F000600012D46762F3718003F3F2F2FFD10FD012FFD2FFD2E2E2E2E002E3130014968B9002D0030496861B04
05258381137B90030FFC0385901160706070623222726272635343736333217161F01161F01073627262322070
6151417161716333237363F01011121026E030F1B5D344885431D0F0C6A385E48323A16190B05094A04101A8C6
C24220C0B28254E4B282C0708FDE402DC019B325CA94C2A913E554253F47F4329303C451F2A504F5B6EB5645FA
F6D524D3633333848540297FC300000030000000002DC03D0000C0015001800604025011919401A18171211100
F0908050418171611100603050208070D02001618070600011646762F3718003F3C3C2F012FFD2F3CFD173C2E2
E2E002E2E2E2E2E2E2E2E2E3130014968B900160019496861B0405258381137B90019FFC03859011407062B011
123113332171607342B01113332373601112102523E45619253D393432053A380925B2412FE0102DC02686D4F5
8FEAC034B71363C9EFE936733019DFC3000030000FFAD02DC03D0002200360039005D4024013A3A403B3938023
9383723222B020A3602170031040427040E37010039000400013746762F3718003F3F2F3C2F2FFD10FD012F3CF
D2FFD2E2E2E2E2E002E2E3130014968B90037003A496861B0405258381137B9003AFFC03859052327062322272
6272635343736333217161F01161F021607060F010607060706071336272623220706151417161716333237363
F01011121026E623A2F3585431D0F0C6A385E48323A16190B05090401030107080206020B15210F04101A8C6C2
4220C0B28254E4B282C0708FDE402DC535A19913E554253F47F4329303C451F2A504F17280F2D350D12091E3C2
A015C5B6EB5645FAF6D524D3633333848540297FC300000030000000002DC03D0000F001A001D0067402A011E1
E401F1D1C17161514070603021D1C1B0F00161504030302060510020B1B1D050401040000011B46762F3718003
F173C2F012FFD2F3CFD173C2E2E2E2E2E002E2E2E2E2E2E2E2E2E3130014968B9001B001E496861B0405258381
137B9001EFFC0385921230323112311333217161514070607373427262B011133323736011121026D53DF7A53E
484391B4B252F4C43222A8787422924FE2902DC0170FE90034B743734774B250FF6622513FEAF3C3601A9FC300
0020000FFE802DC03D00039003C005B4023013D3D403E3C3B2B0D3C3B3A2A0C1902003302221205032F05263A3
C00040300013A46762F3718003F3C3F2F2FFD10FD012FFD2FFD2E2E2E2E2E002E2E2E3130014968B9003A003D4
96861B0405258381137B9003DFFC038592514062B01272227262F03371F021633323F01363736353427262F012
62726353437363332171617072F0126232207061514171E011716011121026A836E2012071B3115211D3237451
C241E302D2221051316301E1F587324356F343F473A254B2C3E2C19423D262C4319CD3236FD9602DCD26E7C030
A120F181A31353F15110E1317051C202C462C1B1438492536507D31171C1138412A1A0F1A1D3B45391578353A0
2ABFC3000020000000002DC03D00007000A005C4023010B0B400C0A090A0908070605000403020201050401030
0050706080A030200010846762F3718003F3C3C2F2F3CFD173C012F3CFD3C2E2E2E2E2E2E2E002E3130014968B
90008000B496861B0405258381137B9000BFFC0385901231123112335212511210280E953E90225FD8002DC02F
8FD0802F85385FC3000020000FFF102DC03D000140017005940210118184019171614130F0A091716150B0A020
90813120214001517000400011546762F3718003F3F2F012F3CFD3C2F3CFD3C2E2E2E002E2E2E2E2E2E3130014
968B900150018496861B0405258381137B90018FFC038592514070623222726351133111417163332363511332
51121025649435C5C43495346222D405553FDAA02DCB75A38343439590294FD6C531F0F443D029485FC3000000
20000000002DC03D000060009004C4019010A0A400B0908060504030009080703000709020100010746762F371
8003F3C3C2F012E2E2E2E2E002E2E2E2E2E2E3130014968B90007000A496861B0405258381137B9000AFFC0385
901032303331B01251121025CBC64BC539B9BFDF702DC034BFCB5034BFD3402CC85FC300000020000000002DC0
3D0000B000E005F4025010F0F40100E0D0B0A0908070603000E0D0C06000802050A02010C0E050402040100010
C46762F3718003F173C2F012FFD2FFD2E2E2E2E2E002E2E2E2E2E2E2E2E2E3130014968B9000C000F496861B04
05258381137B9000FFFC038590103230B012303331B03251121028E4256888955425338959538FDC502DC034BF
CB501B9FE47034BFD3E01E1FE1F02C285FC3000020000000002DC03D0000B000E00594021010F0F40100E0D0A0
9080706020E0D0C0B0A060504000C0E040301040000010C46762F3718003F173C2F012E2E2E2E2E2E2E2E2E002
E2E2E2E2E2E2E3130014968B9000C000F496861B0405258381137B9000FFFC0385921230B01231303331B01330
3011121025D5A95965AC2C25A95965AC3FE6602DC0142FEBE01A501A6FEBD0143FE5B022AFC300000020000000
002DC03D00008000B0055401E010C0C400D0B0A08070605000B0A0905000403020201090B030200010946762F3
718003F3C3C2F012F3CFD3C2E2E2E2E2E002E2E2E2E2E2E3130014968B90009000C496861B0405258381137B90
00CFFC03859010311231103331B01251121026DD653D553ACACFDE602DC034BFE29FE8C017401D7FE82017E85F
C3000020000000002DC03D00009000C00644026010D0D400E0C0B080C0B0A09080706050403020100090205000
4030506050A0C010000010A46762F3718003F3C3C2F2F3CFD3C10FD3C012E2E2E2E2E2E2E2E2E2E2E2E2E002E2
E3130014968B9000A000D496861B0405258381137B9000DFFC03859290135012135211501210111210256FE300
164FEAD01A1FE9C0182FDAA02DC5302A55353FD5B037DFC3000040000000002DC0405000F00160019001C00614
026011D1D401E171B181716061C1A191817151002030A1C1A0413120E1901151411031000011946762F3718003
F173C3F2F2F3CFD3C012FFD2E2E2E2E2E2E2E002E2E2E2E2E3130014968B90019001D496861B0405258381137B
9001DFFC038590116151407062322272635343736333201232723072309011121010B0101B20F27131C2D190F2
6141B2D01025758FB5856012C016EFD2401D4666703DF16192D1A0D24161A2C1B0EFBFBFEFE036FFC9103D0FD7
20128FED80000030000000002DC03D0000F001200150087403C011616401710141009080706151211100F0C0B0
80705001413020301020E0D0A03090F0E040015130403020B0A040D0C111201050401030000011246762F37180
03F173C3F2F2F3CFD3C2F3CFD3C10FD3C012F173CFD173C2E2E2E2E2E2E2E2E2E2E2E002E2E2E2E2E2E3130014
968B900120016496861B0405258381137B90016FFC038592901352307230121152311331523113317112101110
3029BFEC8745856011F013BE59090E541FD2401635DFEFE034B45FED344FEAF4403D0FD72010CFEF4000004000
0FFC802DC03D0001D0020002C0039006F402D013A3A403B1E312C1E1D1C0F322D2921201F1E121101002A02161
52F020734040D23041A1F1020010D00012046762F3718003F3F2F2F2FFD10FD012FFD2F3CFD2E2E2E2E2E2E2E2
E2E2E2E002E2E2E2E2E2E3130014968B90020003A496861B0405258381137B9003AFFC0385901071617161F021
6070607062322270727372F032637363332173713112101262322070607061F011617253627262701163332373
63F0102955B0C09070B0904020E1B5D34486243483A5B1E110401021B3BAC673D4882FD2401F22C586C2411090
A0203010D015302060409FEDB2B594B282C070803619E1C2318354C50325CA94C2A567C229D5B642F32656AE75
57BFC7D03D0FEFD4C6431434D4D7C2D2CC92E51322DFE054C3338485400040000000002DC04050006000900190
01C005F4025011D1D401E1C1B1A1408061C1B1A0907050010031809070403020C1C050401040000011A46762F3
718003F173C2F2F3CFD3C012FFD2E2E2E2E2E2E2E002E2E2E2E2E3130014968B9001A001D496861B0405258381
137B9001DFFC0385921232723072301130B0113363332171615140706232227263534051121029A5758FB58560
12C66666735141B2D1A0F27131C2D190FFEEA02DCFEFE036FFDD30128FED802B50E2616192D1A0D24161A2C0CF
C3000030000000002DC03D0000F001200150085403B011616401715141109080706151413120F0C0B080705001
110020301020E0D0A03090F0E040012100403020B0A040D0C1315050401040000011346762F3718003F173C2F2
F3CFD3C2F3CFD3C10FD3C012F173CFD173C2E2E2E2E2E2E2E2E2E2E2E002E2E2E2E2E2E3130014968B90013001
6496861B0405258381137B90016FFC0385929013523072301211523113315231133251103011121029BFEC8745
856011F013BE59090E5FEC85DFEFA02DCFEFE034B45FED344FEAFFE010CFEF4028EFC3000040000FFC802DC03D
0001D002900360039006F402D013A3A403B39382E291D1C0F3938372F2A261E12110100270216152C020731040
D20041A371039000D00013746762F3718003F3F2F2F2FFD10FD012FFD2F3CFD2E2E2E2E2E2E2E2E2E2E2E002E2
E2E2E2E2E3130014968B90037003A496861B0405258381137B9003AFFC0385901071617161F021607060706232
2270727372F032637363332173707262322070607061F01161725362726270116333237363F0101112102955B0
C09070B0904020E1B5D34486243483A5B1E110401021B3BAC673D48682C586C2411090A0203010D01530206040
9FEDB2B594B282C0708FDE402DC03619E1C2318354C50325CA94C2A567C229D5B642F32656AE7557BB64C64314
34D4D7C2D2CC92E51322DFE054C333848540297FC3000000000000000007E0000007E0000007E0000007E00000
11400000210000002EC000003AE0000045A000004F8000005EC000006940000073A000007F8000008B80000093
A000009E000000A7C00000B6800000C1E00000D3000000DFC00000F0E00000F9C00001046000010C60000116A0
0001208000012960000133400001384000013DC0000142E000014C2000015C00000169E000017600000180C000
018A80000199C00001A4200001AEA00001BA800001C6600001CE800001D8C00001E2600001F1400001FCA00002
0DE000021A8000022BA00002346000023F00000247000002512000025AE0000263C000026DA000026DA000027A
80000288000002880000029AE00002A7400002B4A00002C7800002C7801F4003F0000000002DC000002DC00000
2DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002D
C000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC0
00002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000
002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC00000
2DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC000002DC00000262000002D
C000002DC000002DC000002DC000002DC000002DC000002DC000002DC00000002000000000000FF5E001800000
0000000000000000000000000000000000000440000000100020003002400250026002700280029002A002B002
C002D002E002F0030003100320033003400350036003700380039003A003B003C003D003E003F0040004400450
046004700480049004A004B004C004D004E004F0050005100520053005400550056005700580059005A005B005
C005D00AC0063009000C80091006E00A000A100000000000000030000000000000228000100000000001C00030
001000002280006020C00000000010100010000000000000000000000000000000100030000000000000002000
000000000000000000000000000000000000000000000000000000000000100000000000300000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000400050006000700080009000A000B000C000D000E000F001000110012001300140
0150016001700180019001A001B001C001D001E001F00200000000000000021002200230024002500260027002
80029002A002B002C002D002E002F0030003100320033003400350036003700380039003A00000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000003D0000000000000000000000000000003F00000000000000000000000
0000000410000000000000000000000000000004200000000003B003C003E00400043000400E20000001400100
00300040020005D007A00A000C600CA00D800E600F8FFFF000000200041006100A000C500CA00D800E500F8FFF
F000000000000000000000000000000000000000100140014004C007E007E0080008000800082FFFF000300040
0050006000700080009000A000B000C000D000E000F0010001100120013001400150016001700180019001A001
B001C001D001E001F0020002100220023002400250026002700280029002A002B002C002D002E002F003000310
0320033003400350036003700380039003A003B003C003D003E003F00400041004200000000000000100000004
809070500070707070707070707070707070707070707070707070707070707070707070707070707070707070
70707070707070707070707070707070705070707070707070700000A070500070707070707070707070707070
707070707070707070707070707070707070707070707070707070707070707070707070707070707070707060
70707070707070700000B080600080808080808080808080808080808080808080808080808080808080808080
80808080808080808080808080808080808080808080808080807080808080808080800000C090600090909090
909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090
90909090909090907090909090909090900000D0A07000A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0
A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A080A0A0A0A0A0A0A0A000
00E0A07000A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0
A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A090A0A0A0A0A0A0A0A00000F0B08000B0B0B0B0B0B0B0B0B0B0B0B0B0
B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B090
B0B0B0B0B0B0B0B0000100C08000C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0
C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0A0C0C0C0C0C0C0C0C0000110C09000C0C0C0C0
C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0
C0C0C0C0C0C0C0C0A0C0C0C0C0C0C0C0C0000120D09000D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0
D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0B0D0D0D0D0D0D0D0D000
0130E0A000E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0
E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0C0E0E0E0E0E0E0E0E0000140F0A000F0F0F0F0F0F0F0F0F0F0F0F0F0
F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0C0
F0F0F0F0F0F0F0F0000150F0B000F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0
F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0D0F0F0F0F0F0F0F0F000016100B00101010101
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101
0101010101010100D1010101010101010000017110C00111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111110E1111111111111111000
018120C00121212121212121212121212121212121212121212121212121212121212121212121212121212121
2121212121212121212121212121212120F12121212121212120000000102DC01900005000202BC028A0000008
F02BC028A000001C500320103000000000400000000000000000000030000000000000000000000004D4143520
040002000F80405FFAD00000405005300000001000000000000000100008000000002DC03D00000600003D0027
546616E746F6D65742020202020202020FFFFFFFF37FFFFFE46414E5230300000000000000001000000010000E
B5844855F0F3CF5000003E800000000B02FAE7B00000000B02FAE7B0000FFAD02DC04050000000300020001000
000000001000003D00000000002DC0000000002DC0001000000000000000000000000000000440001000000440
03D000400000000000200080040000A00000040008700010001
)
Hex .= Data
VarSetCapacity( fData,( nSize := StrLen(Hex)//2 ) ) 
Loop % nSize 
 NumPut( "0x" . SubStr(hex,2*A_Index-1,2), fData, A_Index-1, "Char" ) 
Return nSize    
}

______________________________

webpagepublicity.com over 6500 free fonts you can download to your computer and use for free.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
I'd recommend avoiding this:
OnExit, QuitScript
Return

[color=red]GuiEscape:
QuitScript:
GuiClose:[/color]
 DllCall( "RemoveFontMemResourceEx",UInt,fh ),       DllCall( "DeleteObject",UInt,hFont1 )
 [color=red]ExitApp[/color]
Return
When you close the GUI, GuiClose runs and calls ExitApp. Before AutoHotkey exits, it runs the OnExit subroutine. The script exits only when ExitApp is called by the OnExit subroutine.

In other words, if you close the GUI, it will call both functions twice before exiting. This is how I would write it (minus the explanatory comments):
OnExit, QuitScript
Return

GuiEscape:  ; Essentially:
GuiClose:   ;   GoSub QuitScript
ExitApp     ;   Exit
            ; If QuitScript doesn't ExitApp, this thread will still exit.
QuitScript:
 DllCall( "RemoveFontMemResourceEx",UInt,fh ),       DllCall( "DeleteObject",UInt,hFont1 )
; It is always 100% certain the thread will not continue past ExitApp, 
; so return is never necessary. (Some might like to use "return" to define
; the end of the subroutine, but I think it is misleading and redundant.)
ExitApp
It isn't necessary to call RemoveFontMemResourceEx before exiting the application:

Source: MSDN: AddFontMemResourceEx
To remove the fonts that were installed, call RemoveFontMemResourceEx. However, when the process goes away, the system will unload the fonts even if the process did not call RemoveFontMemResource.

I'm fairly confident DeleteObject isn't necessary when exiting either, but I don't have a link to confirm it. I typically don't explicitly clean up GDI resources on exit.

- end random criticism.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Thanks for the valuable information, Lexikos. :)

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007
My preferred way to ExitApp is
OnExit, QuitScript
Return

QuitScript:
GuiEscape:
GuiClose:
   DllCall( "RemoveFontMemResourceEx",UInt,fh ),       DllCall( "DeleteObject",UInt,hFont1 )
OnExit
ExitApp


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Quite simple.. Thanks Sean! :)