How Text in DXF is Converted into Gerber
March 23, 2015
The DXF file format includes strings of text. There are actually two distinct text entities - regular text and MTEXT (multi-line) text.
The DXF file does not contain the actual font tables used to render the text. Instead, each string of text has a STYLE associated with it -- the STYLE points to a font.
AutoCAD originally used its own font files named with the extension .shx (also, when uncompiled these were named .shp) Later it added support for True Type font files. At one time there were a large number of AutoCAD supplied SHX files as well as third party SHX files though it is difficult to find many now.
ASM 500 was developed in 1989 back before True Type was available so it is only able to read SHX fonts.
In order to convert the text faithfully as it appears in AutoCAD:
a) you must have used a SHX file for the text's style.
b) you must have that same SHX file available to the translator.
Setting the SHX font in AutoCAD
Modern versions of AutoCAD tend to default to using Microsoft's True Type font for the STANDARD style. We want to change that to a SHX font. To do this, type STYLE at the AutoCAD command line.
A dialog such as this one will open up.
The default STYLE is called STANDARD. You can, if you like, create any number of styles but here we will assume that you are going to modify the STANDARD style.
Click on the Font Name pull down and scroll until you get to simplex.shx. Then select this as your font for the STANDARD style. Leave the height at 0.000. You may wish to tighten up the width factor from the default of 1.00 to something smaller such as 0.9 or even 0.8.
Below is a comparison of what the text in AutoCAD looks like with the default Arial True type font and the simplex.shx font.
What is the difference?
a) simplex is a stroke font with no "weight" to the stroke. The weight is assigned during plotting or( in our case) conversion.
b) Arial is an outline font - it consists of a number of outer boundaries and inner cutouts. Therefore it need not be assigned a weight.
c) you can see that the Simplex text is spread out relative to the Arial text.
How ASM 500 Handles Text in DXF
When ASM 500 scans a DXF file it looks for text entities. Finding them, it determines from the STYLE what the font used for that string is.
It then looks in the file directory that the user has defined for fonts and attempts to find the matching font.
If the font is not available, it has a substitute font that it has been instructed to use.
Let's look at the dialog in ASM 500 that controls these locations and names:
Directory - this entry tells ASM 500 where to look for available .SHX fonts. You are free to specify any directory but make sure you actually have copied your .SHX fonts there.
Default font - if ASM 500 finds a font in the DXF that has no matching name in the Directory, then it will instead substitute this font.Text Weight for Stick Fonts - this tells the converter how to assign a weight to the text since by definition, stick (also known as stroke) fonts have no thickness.
In Auto mode you can enter a ratio (height to weight) or in Manual mode an absolute D-code. If you enter a ratio the converter tries to find the closest aperture diameter that matches that ratio.
We take the same DXF file that has two strings of text - one using the simplex.shx and the other using the Arial.ttf fonts. The nominal height of the text is 0.4 mm. Since we set our ratio to 1/7 the stroke weight should be .0571 mm.
We run them into ASM 500 and set the text as in the dialog above.
We've made a number of apertures available ranging from 0.05 mm to 1.0 mm.
Here is our Gerber:
First, you will note that both strings share the same font. That's because since there is no arial font found, the ASM 500 substitutes the simplex.shx as specified in the dialog.
Second, the D-code use to stroke the text is D11 at 0.06 mm diameter. This is the closest D-code to the 1/7 value of the 0.4 mm height.
Third you will notice that the Arial version of the text seems to be "compressed" This is an enhancement we added because we noticed a lot of users let Arial default to simplex but were aggravated when the text ran out past the expected length.
Do You Need SHX Fonts
If you are stymied by not having access to SHX fonts we have a zip file containing about 30 different fonts.
shx_fonts.zip 2.55 MB zipped