Hi Mike, I got an error in the line(function IsTrueType):
  EnumFontFamilies(DC, PChar(FontName),@SetFontTypeFlag, 0);
 The cursur parks in front of the "0" with error:
'veriable recquired' 
Can you give some advise please.
Thanks
Piet
----- Original Message ----- 
From: "Mike Shkolnik" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 30, 2005 10:18 AM
Subject: Re: [delphi-en] can I detect if a FONT selection is TrueType?


Piet,

use the next code to check if font is TrueType:

var boolTrueType: Boolean;

function SetFontTypeFlag(var LogFont: TEnumLogFont;
var ptm: TNewTextMetric;
      FontType: integer; Data: Pointer): Integer;
stdcall;
begin
  boolTrueType := (ptm.tmPitchAndFamily and
TMPF_TRUETYPE) = TMPF_TRUETYPE;
  Result := 0;
end;

function IsTrueType(FontName: string): Boolean;
var
  DC: HDC;
begin
  DC := GetDC(0);
  EnumFontFamilies(DC, PChar(FontName),
@SetFontTypeFlag, 0);
  Result := boolTrueType;
  ReleaseDC(0, DC);
end;

And use so:
if IsTrueType('Arial') then
  <do something>

With best regards, Mike Shkolnik
EMail: [EMAIL PROTECTED]
http://www.scalabium.com


--- Piet Henning <[EMAIL PROTECTED]> wrote:

> How can I detect if a FONT selection is TrueType?
> Thanks
> Piet


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to