Font Mapping Node
- Last UpdatedMar 24, 2025
- 5 minute read
When the input drawing uses fonts that are not available when viewing the SVG, a default font will be used. They may also be mapped to specific fonts, where such fonts are available on the machine where the SVG will be viewed, or converted to polylines when the input drawing’s font is available to the Gateway. Some mappings may be specific to the input drawing type, for example, DWG drawings may contain SHX and TTF fonts, while DGN drawings may contain RSC, SHX or TTF fonts.
Font mapping also allows you to change the font size and how it is formatted to be varied compared to the input drawing.
In the <fonts> node, an input font definition of fontfamily="Courier, SansSerif" would be replaced in the output SVG with fontfamily="Arial, Lucida Console, Consolas". This is because the input definition means ‘use Courier if available; otherwise, use SansSerif’ which is replaced in the output to mean ‘use Arial if available, otherwise, use Lucida Console if available; otherwise, use Consolas.’
Multiple font mappings are applied to each text item in the order of the mappings until a match is made. Therefore, if the example mapping is used and an input text item has a 'Courier' font, then subsequent font mappings won't be applied to that text as the first font mapping matched its font.
'font' attributes:
-
from/to: Maps a font in the input drawing (from) to another font(s) in the output SVG (to). It is possible to list more than one font in the "to" attribute value. When one font is not available, the next font will be used. The font name may be specified in RegEx format.
-
from="#missingFonts#": The 'to' value becomes the default value in the output SVG when any of the output fonts are missing. This means that the last font on the prioritized list will be replaced.
-
to="#equivalentTTF#": Supports automatic font mapping by the SHX or RSC font name specified in the from parameter, see Automatic font mapping from SHX or RSC to TTF fonts.
-
sizeFactor: Used to vary the size of the font in the output SVG. Size factor value has to be between 0.01 and 100.0. Default sizeFactor = 1.
-
italic/bold: Used to select italic or bold formats of the font, if available. If not specified, no change is made.
The following Process Flow diagram describes how font mapping and transformation are handled by the Gateway for input files of type DWG, DGN, IGR or PID:

Note: The IGR and PID files only contain TTF fonts.
When mapping SHX or RSC fonts to polylines the machine that hosts the Gateway should have the SHX font(s) installed, so it can accurately render the equivalent shape in polylines.
When mapped to TTF, the user's machine used to view the SVG should have the target font(s) installed, however, this is not required when SHX or RSC fonts are transformed to polylines.
The text size set in the input file applies to the input font. When it is being mapped to a different font, the output text size may be adjusted by the Gateway if the input font shape is a different size to the output font shape. If the input font is not available, the Gateway sets the output font size to be the same as the input font.
Notes:
If the default Simplex.shx or CHAR_FAST_FONT.rsc font is not available on the Gateway machine, then the input font will be used in the SVG, and when rendered on the user’s machine the SVG viewer’s default font will be used.
-
Where possible choose an output font that has a similar shape to the input font, otherwise, it may not fit the same space as the text in the input drawing.
-
For defining the font locations:
-
SHX font: For more information about SHX fonts, refer to section "Fonts and Support". If the location of the SHX fonts and shapes is not added to "ACAD" environment variable (it is not automatically added by Autodesk applications), and you want to use these fonts during Gateways processing, then add this path to the list of Paths in "Fonts and Support" Folder group of Extractor's settings.
-
RSC font: Add the path to the relevant font(s) in "Fonts and Support" Folder group of Extractor's settings.
-
RSC fonts must be available to the Gateway in the fonts folder, otherwise, the Gateway will not be able to recognize those RSC fonts, so it classifies all missing fonts as CHAR_FAST_FONT.RSC by default, and can be further mapped to any desired TTF font, for example:
<fonts>
<font from="CHAR_FAST_FONT.RSC " to="Tahoma" />
</fonts>
Note: This is different behavior from SHX fonts, where SHX fonts are recognized regardless of whether the SHX fonts are available to the Gateway in the fonts folder.
-
When relevant RSC fonts are not available in fonts folder and no mappings are available, the Gateway will convert the text to polylines in CHAR_FAST_FONT.RSC style.
-
-
TTF font: TTF fonts need to be registered in the Windows system.
-
Automatic font mapping from SHX or RSC to TTF fonts
It is possible to map SHX or RSC fonts using the #equivalentTTF# parameter, for example:
<fonts>
<font from="iso123.shx" to="#equivalentTTF#" />
</fonts>
If an iso123.shx font was used in the input DWG drawing, or an iso123.rsc font was used in the input DGN drawing, then the relevant text in the output SVG file will have its font-family set to 'iso123'.
Use of this parameter also supports regular expressions being used in the from field:
<fonts>
<font from=".*.shx" to="#equivalentTTF#" regEx="true"/>
</fonts>
In this case, the Gateway maps all SHX fonts to equivalent TTF fonts. For example, 'romand.shx' might be mapped to 'romand.ttf' and 'ukraine.shx' might be mapped to 'ukraine.ttf', and so on.
Regular expressions can be used to filter which font families should be mapped:
<fonts>
<font from="roman..shx" to="#equivalentTTF#" regEx="true"/>
</fonts>
In this case, if the input drawing contained text in romans.shx, romand.shx, iso123.shx and simplex.shx fonts, then the resultant mapping in the SVG file would be:
-
romans.shx text is assigned a font-family romans.ttf.
-
romand.shx text is assigned a font-family romand.ttf.
-
iso123.shx text is vectorized to polylines.
-
simplex.shx text is vectorized to polylines.
Note: The Gateway doesn't check whether the mapped TTF font file exists, it only uses the name of the SHX or RSC font to generate the name of the TTF font-family. If the SVG is viewed on a machine that doesn't have that TTF font then the SVG viewer will use a default font.