! CREATING YOUR OWN SAS FONTS

CREATING YOUR OWN SAS FONTS Claus Jensen - Kreditforeningen Danmark ;--_ ....... _--_._ .. --- .. _---- you create this file depends on the system ...
Author: Patrick Moore
1 downloads 3 Views 948KB Size
CREATING YOUR OWN SAS FONTS Claus Jensen - Kreditforeningen Danmark

;--_

....... _--_._ .. --- .. _----

you create this file depends on the system you use for maintaining your fonts. We are using Print Management Facility (PMF), which is written in APL, and we have written a small APL routine to do the task. Use the following procedure to create the file: first key in theAPL routine in appendix A and save it in a workspace. Then start PMF, select "1" for FONT MANAGEMENT SERVICES, select "1" again for CHARACTER GROUP DEFINTI'lON, then key in the name of the character group and select "1" for EDIT. When the character group has been loaded, punch the ATTN key to break into PMF, copy the APL routine into the active workspace and run it. If your font contains more than one character group you will have to repeat the process and combine the output files. The output file is a print file with format FBA and LRECL=255. If you are using Font Library Service Facility (FLSF) instead of PMF, you can have FLSF create a file which can be converted quite easily to the desirable format.

... __ .... -.-._-_ ................ , ....... _-

!CREATING YOUR OWN SAS FONTS Glaus J·ensen Kreditforeningen Danmark

Creating your own SAS/GRAPH font is quite straightforward, really. All you have to do is to draw large letters in a coordinate system using only straight lines, and then key in the coordinates for·· the ending points of the lines. Then PROC GFONT will do the rest of the work! This means that SAS does 0.1 percent of the work while you do 99.9 percent, and that is not fair. Kreditforeningen Danmark is using 3812 and 3B20 printers for text processing, and we are using a font calc led SERIFA. Since it is possible to mix graphics from 8AS/GRAPH into text, it would be advantageous to have the serifa font available asa SAS/GRAPH font as well, thereby maintaining a hombgeneous typeface. This paper will show you, step by step, how we con- . verted an AFP font to a SAS/GRAPI-I font, and made SAS do most of the job.

[ID:LA2BOOOO··· j Width';"S7 ................. j Height=95

!,,!

!

",

This is part of our input file, showing the letter with character ID LA2BOOOO. It is one of the national charactersused in the Scandinavian countries. The first line contains the identification ID=LA2BOOOO and are followed by 95 lines containing B7 characters each. O-pels are represented by periods and 1-pels are represented by asterisks. As you can see, the letter is the letter A with a small circle above. We. are going to use this particular letter for a moment. Observe the dimensions of the character box: 95 times B7 -it is hardcoded in the examples to come. We will try to apply the GCONTOUR procedure to the character pattern in an attempt to vectorize the character. The GCONTOUR procedure is actually a landscape function, but why not consider the problem as a topographic problem. The input to PROC GCONTOUR is a dataset with 3 variables: X, Y and Z. X and Yare plane coordinates. and Z is the height. If we define the height as zero for periods and one for asterisks, we have sufficient information in our input file to apply the GCONTOUR procedure.

,.

* Take a 3800 font (raster pattern) * Create a SAS font (vector graphics)

The task is then to take an AFP font - which has an impossible format - and convert it to a SAS/GRAPH font. Since AFP fonts are by nature raster patterns as opposed to SAS/GRAPH fonts that are vector definitions, this means that we have to "recognize" the shapes made up by the raster patterns, surrounding them by lines. In other words: we need to perform a raster to vector conversion. But first of all we need a suitable input file for the process. The one we are going to lise is a sequential dataset, containing each character in expanded format, separated by the unique 8 byte character identifier. How

485

T50 ALLoe F(FONTPRT) DA(G1S055NO) SUR REUSE; DATA WORK (KEEP-X Y Z); INFILE FONTPRT; LENGTH D A07.; DO UNTIL (SUBSTR(D,4,8}··LA280000'); INPUT 02 D AB7.; END; DO Y'95 TO 1 BY -1' INPUT 02 D A07 .. ; DO X=1 TO 87; IF SUBSTR(D.X,I)··.· THEN Z-O; IF SUDSTR(D.X.I)-··· THEN Z-1; OUTPUT; END; END; STOP; PROe GeONTOUR DATA-WORK; PLOT Y'X-Z; RUN;

DO X-I TO 87; IF SUBSTR(D.X.1)··.· THEN Z'O; IF SUBSTR(D.X.1)· .. • THEN Z-1; OUTPUT; END; RND-

STOP;

:o.:~:tJ:Q«$:::){~:o.:~HM:~:~::::W:ii.:~;$:::f:(~::~::Q::I

PROe GCONTOUR

DATA~WORK;

P LOT Y' X· z

In the data .step we first search for the correct character - LA280000. We then loop through the Y values decreasing from 95 to 1. For each Y value we read a line and loop through the X values from 1 to 87. For each X value we study position X in the line; if it is a period. the Z value is set to zero. otherwise it is set to one. Then the PROC GCONTOUR is executed with the generated data as input...

Lt~!.~!l::~:(iiM~:~:~:~:~W:t

We insert two extra loops at the end of ·the data step. simulating rows of O-pels. first at the bottom and the top. and then at the left and the right side of the character box. The GOPTIONS HPOS and VPOS are specified to reduce the waste of space for margins. and the PROC GCONTOUR has been modified to show only the height of one. The NOAXIS and NOLEGEND options are specified to get rid of unnecessary noise on the screen.

jd r,,------------- ----------i(".#;·;;),'-i:---------------------------------------------! ''''-.~;::::;::.,.''

./~.,

lui l

·:u

j

?