svermeulen%Ins.MRC.AdhocNet.CA@UNCAEDU.BITNET (Steve Vermeulen) (05/17/88)
REN An Amiga Font Renaming Utility Copyright 1988 By Stephen Vermeulen 3635 Utah Dr. N.W. Calgary, Alberta, CANADA, T2N 4A6 (403) 282-7990 ----------------------------------------- This program may be freely redistributed, so long as this file is distributed with the program and the Copyright notice in the program remains intact. ----------------------------------------- Introduction: REN is a CLI based utility program for the Amiga that exploits a little understood feature of the Amiga Font System to allow the font data files to be placed elsewhere than in the default FONTS: directory. This capability even allows fonts to be spread across several disks. There are several advantages to doing this: much needed space is freed up on the boot disk, many more fonts may be on line at once, the number of fonts is not restricted by the size of a single disk media, and the font directory scans faster. Syntax: The syntax of REN is quite simple: REN filename.font newpath where filename.font is the COMPLETE path to a ".font" file that needs changing, and newpath is the new path to the font data, this may be relative to FONTS: (eg. Garnet) or may be absolute (eg. Font_1:Garnet). Examples: To change the working name of the Garnet family of fonts to another name (let's use Xyzzy) several things must be done. The following is the complete list of things that must be done: rename FONTS:Garnet FONTS:Xyzzy rename FONTS:Garnet.font FONTS:Xyzzy.font ren FONTS:Xyzzy.font Xyzzy This will just change the name of the Garnet font to be the Xyzzy font. In order to put the data files that describe the characters of the Garnet font somewhere else (eg. on a disk named Font_1:) the following commands are used: makedir Font_1:Garnet copy FONTS:Garnet Font_1:Garnet all delete FONTS:Garnet all ren FONTS:Garnet.font Font_1:Garnet Now, whenever a program tries to open the Garnet font to use it the system will search through the FONTS: directory to find the Garnet.font file. It will then look in this file to find out where the actual font data is stored. This data is now on another disk named Font_1: (note that the FONTS: directory would normally be assigned to a completly different disk, normally the boot disk). If the disk Font_1: is not in a disk drive a standard system requester will appear asking you to insert the Font_1: disk into a drive. It should now be clear that the ONLY files that must be in the FONTS: directory are the filename.font files, since these files are used to locate the font data files. The great benefit this provides is of almost entirely removing the limit to the number of fonts that may be accessed at any one time that the size of disk media imposes. The filename.font files are very small so that even on a crowded boot disk there is usually room for many of these if the font data files can be moved elsewhere. More Background: A note to beginners, the font data files are the files that are named by a number which indicates the height of the font. For example doing a: dir FONTS: will produce a list of files with the ".font" suffix as well as a list of directories. The directories are where the system usually stores the font data files. To see the various data files for the Garnet font do a: dir FONTS:Garnet This should list two files: 9 and 16. The file that is named "Garnet.font" in the FONTS: directory tells the system where to find the data files (the 9 and 16 files) that contain the bit patterns for the Garnet font. The REN utility works its magic by exploiting a feature of the ".font" files that has not been used until now. -------------------- Cut Here and Compile the Following ------------------- /***************************************************** ren.c This program allows one to rename the directory which contains the font data files. Copyright 1988 By Stephen Vermeulen This program may be freely redistributed so long as the Copyright messages remain intact and the program is distributed with the supplied documentation. syntax: ren thisfont.font path ******************************************************/ #include <stdio.h> char newname[256], oldname[256]; main(argc, argv) int argc; char *argv[]; { FILE *font; long j, pos; short i, n; if (argc != 3) { printf("ren filename.font newpath\n"); printf("Copyright 1988 By Stephen Vermeulen\n"); printf("3635 Utah Dr. N.W., Calgary, Alberta, CANADA, T2N 4A6\n"); } else { font = fopen(argv[1], "r+"); if (font) { /******************************************** now determine how many sizes this font has *********************************************/ fread(&n, 2, 1, font); /** throw away **/ fread(&n, 2, 1, font); /** number of sizes **/ printf("Font %s has %d sizes\n", argv[1], n); for (i = 0; i < n; ++i) { /** for each size we rename it... **/ fseek(font, 4L + 260L * i, 0); fread(oldname, 256, 1, font); printf("name was: %s ", oldname); for (j = 255; j > 0; --j) if (oldname[j] == '/') break; strcpy(newname, argv[2]); strcat(newname, oldname + j); fseek(font, 4L + 260L * i, 0); printf("now is: %s\n", newname); fwrite(newname, 256, 1, font); } fclose(font); } } }
kodiak@amiga.UUCP (Robert R. Burns) (05/19/88)
In article <880516163456.013@Ins.MRC.AdhocNet.CA> svermeulen%Ins.MRC.AdhocNet.CA@UNCAEDU.BITNET (Steve Vermeulen) writes: > REN is a CLI based utility program for the Amiga that exploits > a little understood feature of the Amiga Font System to allow > the font data files to be placed elsewhere than in the default > FONTS: directory. This is great. I'm glad you took the opportunity to make use of the obscure implications of the font contents file (the .font file). There are a couple of things that come with 1.3 that y'all should know about. They do not adversly affect REN. 1. The 1.3 disk contains the "FixFonts" utility, that will (with the 1.3 diskfont.library), search drawers in the FONTS: drawer for valid fonts and build appropriate font contents files, so instead of... >Examples: > > To change the working name of the Garnet family of fonts to another > name (let's use Xyzzy) several things must be done. The following > is the complete list of things that must be done: > > rename FONTS:Garnet FONTS:Xyzzy > rename FONTS:Garnet.font FONTS:Xyzzy.font > ren FONTS:Xyzzy.font Xyzzy > > This will just change the name of the Garnet font to be the Xyzzy > font. ...you can rename FONTS:garnet FONTS:xyzzy delete FONTS:garnet.font FixFonts Note that the capitalization of the font name will come from the directory name. You could also, prior to FixFonts invocation, alter the contents of the font directory, e.g. delete some of the sizes, and FixFonts will create an appropriate .font file. 2. Programmers have always been able to say OpenDiskFont("MyApp:fonts/myapp.font", &textAttr); For 1.2 and earlier, the file name in myapp.font that referred to the font file itself was opened relative to FONTS:. For 1.3, it is opened relative to MyApp:fonts. REN's capability to move the font directories elsewhere than the FONTS: drawer is a feature not affected by or supplanted by 1.3 system tools. - Kodiak