Results 1 to 6 of 6

Thread: EnumFontFamiliesEx: ???FONTENUMPROC????

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    Look out your window.
    Posts
    54

    EnumFontFamiliesEx: ???FONTENUMPROC????

    Hey,

    Has anyone ever used this function? What it the documentation is saying and what is in the header files seem to be completely different. FONTENUMPROC, according to the documentation should be defined as...

    Code:
    typedef int CALLBACK (* FONTENUMPROCA)(ENUMLOGFONTEX *, NEWTEXTMETRICEX *, int, LPARAM);
    typedef FONTENUMPROCA FONTENUMPROC;
    But its not.

    This is a section of WinGDI.h, from the May 2002 SDK. This function is suppose to be available since WinNT 4.0, so should these headers have it? The definition I am finding is used with EnumFonts(), but... ehh... Anyway, if anyone could help with this it would be great.

    Code:
    #ifdef STRICT
    #if !defined(NOTEXTMETRIC)
    typedef int (CALLBACK* OLDFONTENUMPROCA)(CONST LOGFONTA *, CONST TEXTMETRICA *, DWORD, LPARAM);
    typedef int (CALLBACK* OLDFONTENUMPROCW)(CONST LOGFONTW *, CONST TEXTMETRICW *, DWORD, LPARAM);
    #ifdef UNICODE
    #define OLDFONTENUMPROC  OLDFONTENUMPROCW
    #else
    #define OLDFONTENUMPROC  OLDFONTENUMPROCA
    #endif // !UNICODE
    #else
    typedef int (CALLBACK* OLDFONTENUMPROCA)(CONST LOGFONTA *, CONST VOID *, DWORD, LPARAM);
    typedef int (CALLBACK* OLDFONTENUMPROCW)(CONST LOGFONTW *, CONST VOID *, DWORD, LPARAM);
    #ifdef UNICODE
    #define OLDFONTENUMPROC  OLDFONTENUMPROCW
    #else
    #define OLDFONTENUMPROC  OLDFONTENUMPROCA
    #endif // !UNICODE
    #endif
    
    typedef OLDFONTENUMPROCA    FONTENUMPROCA;
    typedef OLDFONTENUMPROCW    FONTENUMPROCW;
    #ifdef UNICODE
    typedef FONTENUMPROCW FONTENUMPROC;
    #else
    typedef FONTENUMPROCA FONTENUMPROC;
    #endif // UNICODE

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I suppose MS f***ed up. They seem to have reused the name FONTENUMPROC even though the parameters aren't correct. The only (bad) solution is to cast:
    C:
    EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)YourProc, lP, 0);
    C++:
    EnumFontFamiliesEx(hdc, &lf, reinterpret_cast<FONTENUMPROC>(YourProc), lP, 0);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    Look out your window.
    Posts
    54
    Yah, that was my only solution to this problem. I thought I may have been overlooking something obvious. I'm updating my PSDK right now... I wonder if they have noticed/fixed it yet...

    I figured there would have been an ENUMFONTPROCEX or something, but couldn't seem to find one.

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    Look out your window.
    Posts
    54
    No go on the update situation. Guess it's time to cast, and hope for the best.

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    Look out your window.
    Posts
    54
    So I casted and it works... even though this is just bad. Oh well... I'll make sure to document it, so that people who later maybe maintaining this won't think I'm a complete moron.

    Any idea why some of the enumerated fonts come back with an '@' in there name. Like it returns @Terminal, and Terminal... What's the difference between the two?

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No idea. Maybe it's documented somewhere in MSDN.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width