Announcement

Collapse
No announcement yet.

Convert font to its vector representation...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert font to its vector representation...

    Hello,

    I'm very close to finishing a dxf to g-code converter, and was wondering if it might be possible to include text in the conversion as well. I suppose one could do the conversion in the cad app itself, but it seems much more elegant to have my app do it. I suppose the key is to get at the vector representation of a particular font, but I'm sure this is no easy feat. I've taken a look at the FreeType library, but boy, it's seems there's huge mountain to climb there in terms of what functions are really required to do what I want. Anyone have any advise on FreeType or another way of attacking the problem?

    -CMR

  • #2
    CM,

    I looked into fonts fairly intently 3 yrs ago, I wanted to see if I could use the technology to create a custom scalable font for displaying antialiased drawings for the web, I quickly realized how much work had already been done with the truetype formats, I suggest "why reinvent the wheel"?, I doubt anyone could improve on the algo's much reguardless of how many hours were thrown at it

    B

    Comment


    • #3
      Brad,

      Perhaps I posed my question incorrectly, but I'm certainly not suggesting I want to reinvent the wheel. Instead, given a truetype font, for instance, what I'm asking is how might one get at its outline - i.e., the lines and curves that make of the font perimeter in the first place.

      -CMR

      Comment


      • #4
        ok, there are some good web pages out there, I'll try to find, and the best book I've found for details is,

        Windows Graphics Programming: Win32 GDI and DirectDraw

        http://www.fengyuan.com/

        Comment


        • #6
          I remember using GetGlyphOutline many years ago to do what you are after.
          Dominic Mitchell
          Phoenix Visual Designer
          http://www.phnxthunder.com

          Comment


          • #7
            Hmmm...GetGlyphOutline...right there under my nose in the windows API. Now I suppose it's just a matter of learning to select a TrueType font into a specified device context, and then I *might* be of and running. Is selecting a font into a device context similar to selecting a bitmap into a device context?

            -CMR

            Comment


            • #8
              The short answer is yes.
              Code:
              hFontOld = SelectObject(hDC, hFont)
              
              ' Do stuff here
              
              SelectObject hDC, hFontOld
              
              ' hDC = screen|memory|printer device context
              Dominic Mitchell
              Phoenix Visual Designer
              http://www.phnxthunder.com

              Comment

              Working...
              X