How to debug 5 common SAS® software font issues

1

When using SAS software, you might occasionally encounter a font-related issue. This post helps you debug the following five font issues:

  • Listing registered SAS fonts
  • Registering new fonts
  • Getting SAS SG procedures to use a new font
  • Circumventing an error indicating that the device driver cannot find any fonts
  • Resolving an error that references SASFont

1. How can I tell which fonts are registered to SAS?

To see which fonts are currently registered to SAS, submit the following code:


proc registry startat="\CORE\PRINTING\FREETYPE\FONTS" list levels=1;
run;

2. How can I register or add a new font to SAS?

If you want to use a new font with SAS, you first must register the font by using the FONTREG procedure. Here is example code:


proc fontreg mode=all msglevel=verbose;
fontfile “/path/fontname.ttf”;
run;

For example, if you are running SAS on Windows and want to register the Arial font, which resides in C:\Windows\Fonts, submit the following code:


proc fontreg mode=all msglevel=verbose;
fontfile “C:\Windows\Fonts\arial.ttf”;
run;

Note that the code above registers the new font in the user’s SASUSER directory. In this case, the font is registered only for the user who submits the PROC FONTREG code.

It is possible to register the font for all users. To accomplish this, the person submitting the code must be a SAS administrator who not only has Update access to the SASHELP directory but who also has exclusive Update access to SASHELP (so that no other users or processes can be using SAS at the time the code is run). The administrator must add the USESASHELP option to the PROC FONTREG statement. Here is example code:


proc fontreg mode=all msglevel=verbose usesashelp;
fontfile “/path/fontname.ttf”;
run;

3. When running on UNIX systems, how do I get the SAS SG procedures (such as SGPLOT) to recognize and use a new font?

To get the SAS SG procedures to use a new font on UNIX systems, complete these steps:

  1. Register the new font to SAS using PROC FONTREG (as described above).
  2. Place a copy of the TrueType font file in the following UNIX directory:

!SASROOT/SASPrivateJavaRuntimeEnvironment/9.4/jre/lib/fonts

Note: In the directory above, !SASROOT is your default SAS install directory.

4. Why do I get an error indicating that the device driver cannot find any fonts?

In certain situations, the following error might be written to the SAS log:

Error: The <device driver> driver cannot find any fonts.

This error typically occurs when the SAS system option FONTSLOC is not set properly. First, check the current value of the FONTSLOC system option by submitting the following code:


proc options option=fontsloc;
run;

The directory that the FONTSLOC option points to is written to the log. With a typical install of SAS, the FONTSLOC system option should point to the following directory: !SASROOT\ReportFontsforClients\9.4

Note: In the directory above, !SASROOT is your default SAS install directory.

If the FONTSLOC system option is not set correctly, edit your SAS configuration file and modify the value for the FONTSLOC option.

If the FONTSLOC system option is set correctly, make sure that the directory that the FONTSLOC option points to exists. If the directory does exist, check the contents of this directory, which should contain numerous TrueType font files (with an extension of .ttf). If this directory is missing as part of your SAS install or exists but contains no .ttf font files, contact SAS Technical Support.

5. When invoking the SAS Display Manager System (DMS) on Windows, why do I receive an error that references SASFont?

In certain situations, when invoking SAS DMS on Windows, you might receive the following error:

Error: The SAS system could not get metrics for font “SASFont”

This error is typically caused by a Windows issue that cannot be directly addressed from SAS software. However, to circumvent this issue, modify your SAS configuration file and add the following statement to the top of your configuration file:

-FONT “Courier New” 10

After saving the modified sasv9.cfg file, restart SAS (for this change to take effect). Note that your SAS configuration file is typically named sasv9.cfg and resides in the following Windows directory:

!SASROOT\nls\en

Note: In the directory above, !SASROOT is your default SAS install directory.

Summary

While the information above might not address all your font issues, it should cover most of the more common font issues that you are likely to run into. For detailed information about the FONTREG procedure, consult the SAS online documentation for PROC FONTREG.

Share

About Author

Martin Mincey

Senior Technical Support Analyst, SAS Technical Support

Martin Mincey is a Senior Principal Technical Support Analyst in the Foundation SAS group in Technical Support. He has been in SAS Technical Support since 1984. His main areas of expertise are SAS/GRAPH, ODS, and ODS Graphics.

1 Comment

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Top