> Hi Rudy
> I did have a look at all those functions in MSDN before getting here
> :)
>
> The problem with those functions is that you need to assign a font
> (name et al) to the DC before being able to retrieve tjhe related
> data. However, how would i know the font names while adding them to
> the system font resource ? Thanks again
I have no idea how to read them from the fonts on disk. Followup to
.nativeapi.win32.
--
Rudy Velthuis [TeamB] http://rvelthuis.de
"Courage: Two cannibals having oral sex."
ok
Below, is what i am doing to load the fonts. Now i can read and load the
font file from disk but i need to know the name of the font .. and findfont
cannot supply font name and related data until i apply the font to the
concerned DC and so i have looped to what i was askin in the first place ..
how to get the font name from a font file ? :)
Thanks and Best Regards
if FindFirst(sPath + '*.*', faAnyFile, SR) = 0 then
begin
repeat
if SR.Attr <> faDirectory then
begin
Ext := AnsiUpperCase(ExtractFileExt(SR.Name));
if (Ext = '.TTF') then
begin
FExtList.Add(SR.Name);
Num := Num + AddFontResource(PChar(sPath + SR.Name));
end;
end;
until FindNext(SR) <> 0;
FindCLose(SR);
end;
if FExtList.Count > 0 then
begin
SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
ListBox1.Items.Clear;
ListBox1.Items := Screen.Fonts;
end;
"Rudy Velthuis [TeamB]" <newsg...@rvelthuis.de> wrote in message
news:xn0f77cbac4...@teamb.com...
1) an undocumented way :
procedure TForm1.Button1Click(Sender: TObject);
var
dwLength: DWORD;
hDll: THandle;
GetFontResourceInfo: function(wzFontName: PWideChar; var
dwBufSiz: DWORD;
wzBuffer: PWideChar; dwInfo: DWORD): DWORD; stdcall;
wzFontInfo: array[0..MAX_PATH] of WideChar;
begin
hDll := GetModuleHandle(gdi32);
GetFontResourceInfo := GetProcAddress(hDll,
'GetFontResourceInfoW');
dwLength := SizeOf(wzFontInfo);
GetFontResourceInfo('Arial.ttf', dwLength, wzFontInfo, 1);
ShowMessage('Font name = ' + wzFontInfo);
end;
2) a documented way :
Retrieving font name from TTF file
http://www.codeproject.com/gdi/fontnamefromfile.asp
Best regards,
Jean-Marie
"Mr. X" <no...@here.yet> wrote in message
news:4669...@newsgroups.borland.com...
> Hi Rudy,
>
> ok
> Below, is what i am doing to load the fonts. Now i can read and load
> the font file from disk but i need to know the name of the font ..
> and findfont cannot supply font name and related data until i apply
> the font to the concerned DC and so i have looped to what i was askin
> in the first place .. how to get the font name from a font file ? :)
Go Googling for
TTF font file format
The first hits look quite promising...
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Best Regards
"Jean-Marie Pierrard" <jmpie...@hotmail.com> wrote in message
news:466938fe$1...@newsgroups.borland.com...
Best Regards
"Peter Below (TeamB)" <none> wrote in message
news:xn0f77ly...@newsgroups.borland.com...