OpenType font

Another question is: How to find out, if font is OpenType?
JackKutiAsked:
Who is Participating?
 
Slick812Connect With a Mentor Commented:
const
NTM_TT_OPENTYPE    = $40000;


function ListFonts(const LogFontEx: TEnumLogFontEx; const NTM: TNewTextMetric;
  FontType: Integer; pStore: PChar): Integer; stdcall;
begin
Result := 1;
if NTM.ntmFlags and NTM_TT_OPENTYPE <> 0 then
  begin
  if lStrCmpI(@LogFontEx.elfLogFont.lfFaceName, pStore) <> 0 then
    begin
    StrCopy(pStore, @LogFontEx.elfLogFont.lfFaceName);
    MainForm.ListBox1.Items.Add(LogFontEx.elfLogFont.lfFaceName);
    end;
  end;
end;

procedure TMainForm.sbut_EnumFontsClick(Sender: TObject);
var
LogFont: TLogFont;
sDC: HDC;
begin
if not ((Win32Platform = VER_PLATFORM_WIN32_NT) and
       (Win32MajorVersion >= 5) and (Win32MinorVersion >=1))then
  begin
  ShowMessage('ERROR - OpenType Search requires win XP or newer');
  Exit;
  end;
ZeroMemory(@LogFont, sizeof(LogFont));
LogFont.lfCharset := DEFAULT_CHARSET;
//LogFont.lfFaceName := 'Arial'#0;
sDC := GetDC(0);
EnumFontFamiliesEx(sDC, LogFont, @ListFonts, Integer(@LogFont.lfFaceName), 0);
ReleaseDC(0, sDC);
end;


 = == = = = = = = = = = = = = = = = = = = = = = = =
If you are doing much with API fonts you should go to MSDN and access the About Fonts at -
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_371v.asp
and read every thing they have there about fonts, font functions and font info acess
0
 
Slick812Commented:
Ok, since you are not getting any other response here, what do you mean? Can you say what you mean by "font" in your question -->
   "  if font is "
0
 
JackKutiAuthor Commented:
I mean the type of font - eg. Arial = Open Type font; Book Antiqua= Open Type font ...
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Slick812Commented:
you did not understant what I was asking, I got what you just explained, what I mean  - - - ->  Is it a "System" font, a program installed font, or a font file?
But I guess from your statement, you want to get the properties of an installed system font and detect if it is and Open Type, , I guess you know that Open Type is only recognized in win  XP  and newer systems?

I beleive that the -
EnumFonts callback routine
in win  XP  and newer, has these added values in the  nFontType

OPENTYPE_FONTTYPE = $10000;


function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
  FontType: Integer; Data: Pointer): Integer; stdcall;

begin
Result := One;

if ((FontType and OPENTYPE_FONTTYPE) <> Zero)   then
   DoOpenType;



0
 
JackKutiAuthor Commented:
But there is no  OPENTYPE_FONTTYPE expression in the API EnumFontsProc function, only Raster_Fonttype, Device_Fonttype and Truetype_Fonttype. Even in the book on API font and text functions I have fount only these three possibilities.  So neither Delphi does recognize this  OPENTYPE_FONTTYPE expression. ( I have Win XP)
0
 
JackKutiAuthor Commented:
What does value  $40000 mean or where it can be found?
0
 
Slick812Commented:
??
I am not sure what you are asking? ? Or what you may mean (a reference to vocabulary) ?
it is found in my code above, , I can not say about what it means ? since I have no reference to it meaning anything, it's just a windows system number (acually a single "Bit" value) used as a value to indicate an OpenType - TrueType font (if that bit is set in the ntmFlag the font should be an OpenType TrueType), , , Maybe you mean where I got the value from, , It''s in a Microsoft C code Header file ( I think maybe WinGdi.h ) released by MS for the Visual studio or other MS programming languages. . . I got that one from code in a delphi pascal translation of the C code header file, I do not remember who translated that one, but the guys at the JEDI project usually try to produce pascal translations of the newer C code header files, however, if you come across a "New" constant identifier in the MSDN help and can not find it's value, you can go to the windows or C++ here at EE and ask for the value.
0
 
JackKutiAuthor Commented:
Yes, I was interested in the source of the value $4000. Thanks a lot.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.