Hi Peter

Thanks for the response.  I have tried several things:

In the rc file, I added double quotes round the file name. I suspect 
that these are only necessary if there is a space in the file name 
somewhere. Anyway the result was the same.

I was aware of the  {$R 'MyResource.res' 'MyResource.rc'} syntax but had 
never got it to compile, even on Build and after modifying the rc file 
in case the compiler was really clever. I think that the quotes are not 
required. I had not tried it in the project file. I have now but still I 
cannot get it to compile. However, this is not a problem, as I can 
compile rc to res with the bat file containing brcc32.exe.

In the rc file FONT gives an error whereas RT_FONT compiles without error.

I had a look for my original discs but failed. I also looked for an 
on-line download of Resource Workshop but didn't find it anywhere.

Has anyone used Fonts in a Resource file successfully?


Bobby
 




Peter Luijer wrote:
>
>
> As far as I know, you can't use Delphi-constants like "RT_FONT" inside
> resource-scripts; you'll have to use the literal text like:
>
> ==================================================================
> ABC1 FONT "C:\PathToFontfile\FontName.ttf"
> ==================================================================
>
> You can examine how a resource is compiled into your application with
> a resource-viewer/editor like the one that came with Delphi called
> "Resource Workshop" which can be found on the Delphi-CD and has to be
> installed separately or similar.
>
> My personal favorite is PE Explorer, but it's not free...
> http://www.heaventools.com <http://www.heaventools.com>
>
> BTW. You can automatically let Delphi compile the resource-script
> by using this line into your project-file (*.dpr):
>
> ==================================================================
> program MyProject;
>
> {$R 'MyResource.res' 'MyResource.rc'}
>
> uses
> Forms,
> ...
> ==================================================================
>
> Don't forget to "Build" your project after changing a resource;
> when you use "Compile" they won't be re-compiled.
>
> Greetz,
>
> Peter.
>
> -----Oorspronkelijk bericht-----
> Van: [email protected] <mailto:delphi-en%40yahoogroups.com> 
> [mailto:[email protected] 
> <mailto:delphi-en%40yahoogroups.com>]Namens
> Bobby Clarke
> Verzonden: zaterdag 27 juni 2009 16:25
> Aan: [email protected] <mailto:delphi-en%40yahoogroups.com>
> Onderwerp: [delphi-en] Failure to use font as a resource
>
> I am trying to use fonts in my program without installing them on the
> user's (target) computer as this requires a re-boot before the fonts are
> available. I have done many of the steps but something is missing. Any
> help would be appreciated. Thanks in advance for any help offered.
>
> Bobby Clarke
>
> Here are the steps I have taken:
>
> Created file resource.rc containing two lines of text:
>
> ABC1 RT_FONT C:\...\ABC01.ttf
> ABC2 RT_FONT C:\...\ABC02.ttf
>
> Used brcc32.exe in a batch file to compile to resource.res
>
> In the Delphi program, I have
>
> implementation
>
> {$R *.dfm}
> {$R resource.res}
>
> procedure TFMain.FormCreate(Sender: TObject);
> var
> hFind : THandle;
>
> begin
>
> hFind := FindResource(Handle,'ABC1',RT_FONT); // returns zero
> if hFind = 0 then
> ShowMessage(' FindResource failed. Error: '+IntToStr(GetLastError))
>
> 


[Non-text portions of this message have been removed]

Reply via email to