BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

How do I add a new font to sas registry? Is there any code for doing that?

I already have the font installed on my PC but I need it in sas

 

17 REPLIES 17
data_null__
Jade | Level 19

Check the online documentation...

 

 

Registering Fonts with PROC FONTREG

PROC FONTREG is used to register fonts in the SAS Registry. For example, if you have a Type1 or OpenType font in your Windows font directory, you can register the font by submitting the following code:
proc fontreg mode=add;
fontpath '!SYSTEMROOT\fonts';
run;
This code will register all of the other font files in the Windows font directory.
proc_freq
Calcite | Level 5
Thanks for the code. I'm on a unix server and transferred the fonts I wanted to the unix server and changed the path to point to the new folder. I can use all the fonts I want now!
Anita_n
Pyrite | Level 9

Hello, thanks for the reply. I have already tried that code but it didn't work. Do I need to do something else before running that code?

the font I want to include is Frutiger LT. Its already installed on my pc

Cynthia_sas
SAS Super FREQ

Hi:
Keep in mind that if you use the Frutiger LT font to produce output and you send that output to people who do not have the font, it means that they will get some system default when the font is not found.

For that reason, we recommend using the most common fonts that are loaded on most systems: Times New Roman, Courier New and Helvetica (or Arial).

Cynthia

data_null__
Jade | Level 19

How do you know it didn't work?  Why didn't you say that to begin with and why don't you provide code/sas log etc.

 


@Anita_n wrote:

Hello, thanks for the reply. I have already tried that code but it didn't work. Do I need to do something else before running that code?

the font I want to include is Frutiger LT. Its already installed on my pc


 

 

ballardw
Super User

Did you read the section in Proc Fontreg in the concepts section about Font Naming?

Specifically that imported fonts may require a prefix to the name when used:

 

When a font is added to the SAS registry, the font name is prefixed with a three-character tag, enclosed in angle brackets (< >). This prefix indicates the font type. For example, if you add the TrueType font Arial to the SAS registry, then the name in the registry is <ttf> Arial. This naming convention enables you to add and distinguish between fonts that have the same name but are of different types.

When you specify a font in a SAS program (for example, in the TEMPLATE procedure or in the STYLE= option in the REPORT procedure), use the three-character tag to distinguish between fonts that have the same name:
proc report data=sashelp.class nowd
            style(header)=[font_face='<ttf> Palatino Linotype'];
run;

 

 

Anita_n
Pyrite | Level 9

Hello Cynthia, thanks for your reply and the info. My client uses Frutiger LT and he wants the font the same. That is why am looking for a means to import that into my sas registry

mkeintz
PROC Star

@Anita_n

 

If you want help, you first have to help yourself.  That means when saying "I tried it and it didn't work" is un(self)-helpful.  Describe the symptoms - a common prerequisite to diagnosis and remedy.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Anita_n
Pyrite | Level 9

This is the message I got in the log after running the code

NOTE: SAS initialization used:
      real time           2.85 seconds
      cpu time            0.96 seconds

1    proc fontreg mode=add;
2    fontpath '!systemroot\fonts';
3    run;

SUMMARY:
  Files processed: 613
  Unusable files: 213
  Files identified as fonts: 400
  Fonts that were processed: 439
  Fonts replaced in the SAS registry: 0
  Fonts added to the SAS registry: 111
  Fonts that could not be used: 328
  Font Families removed from SAS registry: 0

NOTE: PROCEDURE FONTREG used (Total process time):
      real time           1.28 seconds
      cpu time            0.79 seconds

ballardw
Super User

You can run this code to see which TrueType fonts were registered:

proc registry 
   startat='core\printing\freetype\fonts'
   list
   levels=1
   ;
run;

I don't have any Type1 or OpenType fonts installed so can't actually test but I think replacing "freetype" above with "type1" or "opentype" might find fonts of those types if registered.

 

The list command will send the font details to the LOG. The Levels=1 only sends the first level of information, the name of the font such as

[ <ttf> Albany AMT]

 

If the font name you want doesn't appear then it might have been one of the "Fonts that could not be used: 328"

Anita_n
Pyrite | Level 9

Hi bellardw,

thanks for that code. I got the list of registed fonts but frutiger LT was not included in the list. that means its one of those that could not be used. I tried replace freetype with type1 and opentype but I got an error message that says:

Trying to open a key that does not exist: core\printing \opentype\fonts

 

I copied the fonts directly to SASHome\ReportFontsforClients but sas doesn't seems to recognise that.

Anita_n
Pyrite | Level 9

Hello all,

since I have being tring to solve this problem without any success. I wish to add more details maybe someone may be able the help me.

I used this code to register the new font I wish to add to sas registry

proc fontreg mode =all;
fontpath 'C:\Windows\fonts';
run;

and this was the output I got in my log:

SUMMARY:

Files processed:613

Unusable files:213

Files identified as fonts: 400

Fonts that were processd:439

Fonts replaced in SAS registry:0

Fonts added to SAS registry:111

Fonts that could not be used:328

Font Families removed from SAS registry:0

 

I then used this code to list the registered fonts

proc registry list startat= 'core\printing\freetype\fonts'
list
levels=1
;
run;

I got a very long list of fonts.

The first note stating the following: this did not include the actual font I was expecting (Frutiger LT)

NOTE: Contents of SASHELP Registry starting at subkey [core\printing\freetype\fonts]

with for example the following list of fonts:

<ttf> Arial]

<ttf> Batang]

.

.

.

.

etc

 

and the second note stating the following: this includes the actual font I need (Frutiger LT)

NOTE: Contents of SASUSER Registry starting at subkey [core\printing\freetype\fonts]

 

with for example the following list of fonts:

<atl> Frutiger LT]

<ttf> Arial]

<ttf> Bell MT

<ttf> Frutiger LT 45 Light]

<ttf> Frutiger LT 47 LightCn]

<ttf> Frutiger LT 5 Roman]

<ttf> Frutiger LT 87 ExtraBlackCn]

<ttf> Frutiger LT 95 UltraBlack]

.

.

.

.

etc

 

I tried using the following code to test if the font can be used to printout a text

options sysprintfont= ("Frutiger LT  95 UltraBlack");

proc report data=sashelp.class nowd
style(header)=[font_face='<ttf> Frutiger LT 95 UltraBlack'

and get an error message saying that the font is not found

 

Is there anything am doing here wrong??

I don' really know why this not working

 

Cynthia_sas
SAS Super FREQ
Hi:
This might be an instance where you need to open a track with Tech Support for more help.
Cynthia
Cynthia_sas
SAS Super FREQ

Hi:

  I had a chance to run a test on my personal machine, where I have a Charles Rennie Mackintosh font installed. I ran PROC FONTREG to add the font to the registry and then in my PROC REPORT code, I had this:

ods rtf file='c:\temp\use_macfont.rtf';
ods html file='c:\temp\use_macfont.html';
ods pdf file='c:\temp\use_macfont.pdf';
proc report data=sashelp.class nowd
   style(header)={font_face='CRMackintosh' font_size=12pt}
   style(column)={font_face='CRMackintosh' font_size=12pt};  
run;
ods _all_ close;

In the registry list I did see <ttf> in front of the name, but I only needed the font name (exactly as it was spelled) without the <ttf>.

 

And I got this output:

use_mac_font.png

which shows the Mackintosh font being used in RTF, PDF and HTML.

 

Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 5133 views
  • 6 likes
  • 6 in conversation