New features of the diskfont.library 45.1 and above The diskfont.library 45.1 comes with an optional font directory caching mechanism. If turned on, reading the font list is speed up considerably. Hence, font requesters will pop up much faster than they used to, and keeping hundreds of fonts on your HD is much less of a problem than it used to be; you don't have to wait for ages until the font list pops up. The font cache is competely transparent for the software and for you, you do not need to care about it when installing new fonts. The library will recognize the installation of new fonts and will update the cache automatically for you. It is a "turn on and forget" feature. How to enable the automatic font caching By default, the new release of the diskfont.library will come with the cache dis- abled. To enable it, proceed as follows: i) The global font caching must be turned on. This switch is located in the environment variable "diskfont". Open a shell, and edit the file "ENVARC:diskfont" with an editor of your choice. If this file did not yet exist, the editor will create it for you. In the following, we assume that you use the system editor "Ed". Enter the following command in the shell Ed ENVARC:diskfont and press RETURN. The editor should now present the contents of the file; it might be empty. Please type in the following line: CACHE=yes Now save the file back. For "Ed", either use the menu, or press "Esc" followed by "x" and RETURN. For details about Ed, please consider its manual. ii) Font caching directories must be supplied. The diskfont.library needs a place to store the cache file; it is kept in the directory "_Cache" in the FONTS: device. To create it, enter the following command in the shell window: MakeDir FONTS:_Cache and press RETURN. This is all; now reboot the machine. The font cache is now enabled, but not yet created. The diskfont.library will do that for you as soon as you open a font requester. The FIRST font requester will therefore be as slow as usual since no caching took place and the library has to create the cache. However, all subsequent font requesters will be speed up dramatically. Multiple font caches In case you work with multiple font sources, as for example disk packages containing FONT directories, you may build font caches for them as well. For that, just create the directory "_Cache" within the font directory on these disks. All the rest is done by the diskfont.library. It will build the cache as soon as you try to read the font contents of this disk, and will use it later if you re-insert this disk. You may mix disks with and without a font cache freely, this causes no problem for the diskfont.library whatsoever. Do I need to update the cache? No. In case you install new fonts, or delete old fonts, the contents of the cache does no longer reflect the contents of the font directory. However, you DO NOT NEED to worry about this situation. The diskfont.library will detect this automatically and will rebuild the cache file for you. This will, however, not work on MS-Dos (CrossDos) disks since the FAT filing system does not keep the modification date of directories correctly. Hence, do NOT enable font caching, i.e. do not create a _Cache directory on MS-Dos disks, or in case your computer doesn't include a real time clock. In case you want to enforce a cache rebuild, for whatever reason, delete the file "_Cache/FontCache". Advanced features The cache comes with an additional feature which is left to experts: The library may optionally sort the font list for you. This has no advantage for the system font requester since it sorts the font list itself. It will speed up the requester a bit since the sorting algorithm used by the diskfont library is more advanced than that of the ASL requester. It may also help other programs which present the font list itself. However, some old programs expect the font list in a specific order and will fail, or will return strange results. Note that there has never been any documented order in the font list, hence programs depending on this should be considered broken anyhow; nevertheless, FOR MAXIMAL COMPATIBILITY, LEAVE THIS FEATURE OFF. To enable it, include the keywords "ASCENDING" or "DESCENDING" in the ENVARC:diskfont variable, depending on whether the font list should be sorted in ascending or decreasing order. Even though the system requester sorts fonts ascending, you get maximum speed with "DESCENDING" due to the sort algorithm used by the requester. Programmer notes There is no documented interface to the font cache. The AvailFonts() call works in the same way as it ever did, except that it will try to load from the cache, or will try to recreate the cache if it finds it outdated. Especially, the format of the cache file is undocumented, has changed in the past and will continue to change. Do not make assumptions about its contents and do not parse it itself.