CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Baton Rouge, LA
    Posts
    38

    Converting TTF's to bitmaps

    Can anyone guide me to any documentation, or API sets that will allow me to convert TTF's into a bitmap? The TTF is used on a "page" similar to that, of a Corel Draw application. Obviously, I have full access to the storage structure of the application, which contains the information and data of the TTF (size, position, font, etc.). The end result will take the "on screen" representation of the TTF, and store it in a bitmap format, in a file, on the HDD. The desire is to use the TTF font structure, along with the application's size and positioning information, and use a set of functions to create the BMP's. In quickly glancing at the MFC hierarchy, no classes seemed obvious to perform this task. Other sample code I have lends reading towards device contexts. Can anyone provide any theory, or recommended reading?

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    I don't know if I really understand your problem, but the most simple and straightforward way seems to me to just output the characters to an (offscreen) device context. Then you save the bitmap selected into that DC to a file.

  3. #3
    Join Date
    Oct 2003
    Location
    Baton Rouge, LA
    Posts
    38
    Originally posted by gstercken
    I don't know if I really understand your problem, but the most simple and straightforward way seems to me to just output the characters to an (offscreen) device context. Then you save the bitmap selected into that DC to a file.
    Yes you do seem understand what I am looking to do. Up until this point, I have not had a need to work with device contexts. In the initial research I have done, this seems to be the path I need to take (as you mention). I am just looking for further detail to read about device contexts, and possibly some sample code.

    Also, if this is the most direct and efficient means to creating a BMP, from a TTF. Is there another path I can take to obtain my results?

    For clarity, imagine a "job" laid out in Corel Draw, with both text (from TTF's), and various photos (jpg's, bmp's, etc). The result I am looking for would be a single bitmap of the job, similar to taking a screen grab (using Corel Capture, or like software), then saving that bitmap as a file. However, I need to create this programatically for efficiency, and to have the ability to control the level of grey (0 - 255), as well as the resolution (dpi).

    The application is used to drive laser engravers. Our "driver" uses bitmaps as input for the final parsing to the machine language of the controller. As you can imagine, when engraving awards, text is most common.

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