Monday, January 21, 2008

Converting AutoCAD blocks/polygons (DWG) to fonts (TTF)

Theoretically, this should be an easy task. AutoCAD is vector based, true type fonts are vector based, so, where is the conversion tool? Unfortunately, there isn't one.

The only way to convert between the two is to do it somewhat manually. I've looked and even tried to program this myself, it just isnt within my capability. Incidentally, if some enterprising young programmer out there was willing to do this, I would be very appreciative!

So, anyhow, this is my methodology for converting AutoCAD polygons/blocks to fonts (in my case, so they can be used as markers in ArcGIS).

1) Save your CAD file as a BMP or a TIF, or some other uncompressed raster image. I would recommend saving it at a scale that you feel you will use the most as a font (even though fonts are scalable).

2) You need a font creation program. There is currently no way around this. If you have the money, there are several programs you can buy for 50-700 USD. If, like me, you dont have this kind of budget for a piece of software you will not be frequently using, then there is a fairly good free software option out there. It has one major drawback, however....

It's not windows software! Which is a drawback when you are clearly using both ESRI ArcGIS and AutoDesk AutoCAD in a Windows environment.

Anyhow, the software is called Font Forge (Google it, it should be at Sourceforge). To even get this program to work and start making your ArcGIS compatible fonts, you need to install Cygwin, which is an application that simulates a UNIX environment.

Once you have gone though the headache of installing that program - there is a very good guide on their website - you are ready to start converting AutoCAD into a font. From within cygwin type:

$ twm &

$ fontforge -new

Read the fontforge guide on how to create fonts. I would highly recommend the autotrace program - if it will work on your system - it will streamline the conversion process somewhat. Once you have created a new .font be sure to import it into your control panel>font folder. Windows will now have a new font that, hopefully, has characters that resemble your original AutoCAD file.

Be sure to read my upcoming article on using these newly created fonts to create ArcGIS markers.