kapot
asked on
Font in Delphi
Hello,
How can I make sure that a font will be available for TEdit and TLabel component?
I meant, I have a TTF font, for example MyFont.TTF .
I want to use it for my TEdit and TLabel, how can I embed and assign it into my app ?
Thanks for any help.
How can I make sure that a font will be available for TEdit and TLabel component?
I meant, I have a TTF font, for example MyFont.TTF .
I want to use it for my TEdit and TLabel, how can I embed and assign it into my app ?
Thanks for any help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Nice .. new one for me :o)
Hi.
kapot wants fonts to be available in other computers.
Mokule is right.
I wasnt quick enough... :/
kapot wants fonts to be available in other computers.
Mokule is right.
I wasnt quick enough... :/
hi friend ...
it is so easy ...
just distribute your font file with your program , and then by this code , instal that to target os :
AddFontResource(PChar('you rFont.TTF' ));
SendMessage(HWND_BROADCAST , WM_FONTCHANGE, 0, 0);
it is so easy ...
just distribute your font file with your program , and then by this code , instal that to target os :
AddFontResource(PChar('you
SendMessage(HWND_BROADCAST
here'san example from
The Unofficial Newsletter of Delphi Users - Issue #18 - November 1996
on how to embed anything into your exe (i.e. your font, so you can install it on client's computer)
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
Put Anything In Your Delphi EXE!
by William A. Portillo - hallcom@wantree.com.au
I don't know if this is useful stuff but after a couple of weeks of playing with the resources side of Delphi, I ended up writing a routine that will "extract" other files out of a Delphi EXE. I found this useful for distributing little picture or sound files with the application or as a setup program with internal files. No doubt many of you will find other uses for this technique.
First, I create an RC project with NOTEPAD.EXE and ARJ.EXE in it as follows (we'll call it RESJUNK.RC):
NOTEPAD EXEFILE C:\WINDOWS\NOTEPAD.EXE
ARJ EXEFILE C:\UTILS\ARJ.EXE
then I compile it with BRCC32 into a RES file. After this I include it in my Delphi project by using the $R compiler directive like this:
{$R RESJUNK.RES}
and extract this files by using the TResourceStream class.
procedure ExtractRes(ResType, ResName, ResNewName : String);
var
Res : TResourceStream;
begin
Res := TResourceStream.Create(Hin stance, Resname, Pchar(ResType));
Res.SavetoFile(ResNewName) ;
Res.Free;
end;
The Unofficial Newsletter of Delphi Users - Issue #18 - November 1996
on how to embed anything into your exe (i.e. your font, so you can install it on client's computer)
--------------------------
Put Anything In Your Delphi EXE!
by William A. Portillo - hallcom@wantree.com.au
I don't know if this is useful stuff but after a couple of weeks of playing with the resources side of Delphi, I ended up writing a routine that will "extract" other files out of a Delphi EXE. I found this useful for distributing little picture or sound files with the application or as a setup program with internal files. No doubt many of you will find other uses for this technique.
First, I create an RC project with NOTEPAD.EXE and ARJ.EXE in it as follows (we'll call it RESJUNK.RC):
NOTEPAD EXEFILE C:\WINDOWS\NOTEPAD.EXE
ARJ EXEFILE C:\UTILS\ARJ.EXE
then I compile it with BRCC32 into a RES file. After this I include it in my Delphi project by using the $R compiler directive like this:
{$R RESJUNK.RES}
and extract this files by using the TResourceStream class.
procedure ExtractRes(ResType, ResName, ResNewName : String);
var
Res : TResourceStream;
begin
Res := TResourceStream.Create(Hin
Res.SavetoFile(ResNewName)
Res.Free;
end;
It might not be available if it isnt a True Type Font.