Is it possible to load my own font, and then use it? I've tried this:
First I link my font with my rc file, so I write in my rc file:
123 RCDATA "kimberle.ttf"
In my application I load the font/rcdata:
invoke FindResource,hInstance,123,RT_RCDATA
mov SizeFont,eax
Invoke LoadResource,hInstance,eax
invoke LockResource,eax
mov NewFont,eax
Then I create a file:
invoke CreateFile,addr NameOfFont,GENERIC_WRITE,FILE_SHARE_WRITE,0,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,0
mov hFile,eax
invoke SetFilePointer,hFile,0,0,FILE_END
invoke SizeofResource,hInstance,SizeFont
invoke WriteFile,hFile,NewFont,eax,addr SizeReadWrite,0 ;Kimberleyrc.ttf HAS BEEN CREATED!
invoke Sleep,5000
And then what I do next fails, CreateScalableFontResource returns 0:
invoke CreateScalableFontResource,0,addr NameOfFont2,addr NameOfFont,addr NewDirectory
.if eax != 0
invoke AddFontResource,addr NameOfFont2
.if eax != 0
invoke WriteProfileString,addr Fontz, addr NameOfFontUse,addr NameOfFont2
.if eax!=0
invoke SendMessage,HWND_BROADCAST,WM_FONTCHANGE,0,0
.endif
.endif
.else
invoke MessageBox,0,0,0,MB_OK
.endif
Invoke CreateFont,15,10,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_TT_ONLY_PRECIS,CLIP_DEFAULT_PRECIS,PROOF_QUALITY,DEFAULT_PITCH,addr NameOfFontUse
mov MyFont,eax
Here's my data:
Fontz db 'Fonts',0
NameOfFont db "Kimberleyrc.ttf",0
NameOfFont2 db "C:\WINDOWS\SYSTEM\KIMBERLEYRC.FOT",0
NameOfFontUse db 'Kimberley',0
NewDirectory db "C:\WINDOWS\SYSTEM\"
I'm really confused, can someone help me out?
Thanks in advance
kemicza,
Welcome Aboard :U
The forum 'Search' and your favorite search engine will answer many questions before we can and save you time. :dance:
Use this font installer software to fill in the gaps of what you don't have yet.
1. It helps to copy the font where Windows expect it. ( Fonts directory )
2. Register it in the Registry.
3. Post a System Message to 'Notify' windows of it's availability.
In the code is a removal for doing updates to the font, if it's installed with an old version.
Many fonts have copyrights and I am hoping your using this one properly.
Regards, P1 :8)
PS: I know this is not the only solution. But this was quick and easy for kemicza to start with.
[attachment deleted by admin]
Works perfectly P1 :U. You have to admit I was pretty close :bg :dance: . Congrats with your 1000 posts btw :cheekygreen:
From me, too! :thumbu
Where's the party? :8)