CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: True Type Fonts

  1. #1
    Guest

    True Type Fonts

    Hi,

    I'm regurarly working with fonts and I'm kinda sick of opening the fontviewer for every font when I want a preview of it without installing the font in Windows.
    So I decided to create a fontviewer using VC++ and MFC.

    On of the first things I came across is the following:

    How do I show an external True Type Font file in a window without installing the font in Windows? When it is not possible to use the font without installing the font how can I temporarily install and remove the font?

    Thanks in advance.

    Regards,

    Patrick


  2. #2
    Join Date
    May 1999
    Location
    Glendale Heights, Illinois, USA
    Posts
    44

    Re: True Type Fonts

    From Platform SDK:

    ----------------

    AddFontResource

    The AddFontResource function adds the font resource from the specified file to the system font table. The font can subsequently be used for text output by any Win32-based application.

    int AddFontResource(
    LPCTSTR lpszFilename // pointer to font-resource filename
    );



    ----------------

    RemoveFontResource

    The RemoveFontResource function removes the fonts in the specified file from the system font table.

    BOOL RemoveFontResource(
    LPCTSTR lpFileName // pointer to font-resource filename
    );






  3. #3
    Guest

    Re: True Type Fonts

    Thanks Steve,

    Right after I posted this message I found them too. I should have looked further befre crying out for help.

    Now the only problem I have is how to use it. In order to use it I need the facename within Windows.

    The AddResource function doesn't give me this name. Nor is there any function (not that I know of) that gives me this name.

    Any Ideas???

    Thanks in advance,

    Patrick







  4. #4
    Join Date
    May 1999
    Location
    Glendale Heights, Illinois, USA
    Posts
    44

    Re: True Type Fonts

    This will take a bit more work. In your MSDN library, look under Specifications\True Type 1.0 Font Files...\The TrueType Font File\Data Types. It goes into detail about the format of a TrueType font file. You can manually extract the name that way, but it's a pain.


  5. #5
    Join Date
    Apr 1999
    Location
    France
    Posts
    9

    I have exatly the same pb. > Add some lines

    hello.
    I would like exactly the same thing....
    If you want that your font be used by the other, don' t forget to put
    SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
    in your code to say it to the others.

    In response to the other mail :

    This will take a bit more work. In your MSDN library, look under Specifications\True Type 1.0 Font Files...\The TrueType Font File\Data Types. It goes into detail about the format of a TrueType font file. You can manually extract the name that way, but it's a pain.


    It seems not very easy !! Another idea ?
    If I found a response, I'll post a mail back, if you find, thanks to reply to me:
    [email protected]

    Stéphane


  6. #6
    Guest

    Re: True Type Fonts

    Thanks.

    I think you're right about the crime part.
    This is not going to be an easy job.

    Regards,

    Patrick



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

Featured