Short: Antialiased fonts, works even on AGA Author: szulat@amiga.org.pl (Szymon Ulatowski) Uploader: szulat amiga org pl (Szymon Ulatowski) Type: util/wb Requires: graphics.library v39, 020+ Architecture: m68k-amigaos Introduction ============ Beautifont is a simple trick, that allows you to use antialiased fonts on Amiga's Workbench. Do you know something similar in Windows world? Really? No - on Windows it only works on high color screens. This trick here is better, it works on any colorindex screenmode. It's damned slow and has serious limitations - but it really works... How does it work ================ Beauifont patches Text() function from graphics.library. When you want to write something using a given font, it uses 2x bigger font and then scales the image down to its original size. Usage ===== Simply run it from shell or icon. To quit use ctrl-C, break or simply run Beautifont again. You started it and wondering why it doesn't work? Read on. Beautifont needs BIG font for each font you want to be antialiased. BIG font is a font that is twice as high as the original. When the application wants to draw the text, antialiasing routine checks if the BIG font is present in memory. If not, it simply uses original method but it also gives a signal to Beautifont, that starts to load this font. So there is a chance, that next time this font will be available (textdrawing routine doesn't wait for this font. This would be annoying for you, dear user, and it could cause deadlocks). This missing font notification is very simple, and in most cases, several notifications are required in order to load all needed fonts. Beautifont disables antialiasing, if the original font is "designed" (so it is the bitmap font) and the BIG font is not (that means it is produced from the original by diskfont.library). This prevents from using slow routine that would not bring any visual improvements (scaling the font up and down gives the same image). After you start Beautifont, you will see what fonts are loaded (unless you redirect output). If your default font is topaz 8, you would see: "Loading topaz.font/16..." This means some application wanted to use topaz.8 and beautifont needs BIG font for it. On most systems there is no designed topaz 16, so the diskfont.library will double topaz 8 and Beautifont will not use it for antialiasing. Tricks ====== Font will be "nicely" antialiased, if there is 2 x bigger version available. Use outline (vector) fonts - they will always have 2 x bigger version. You can even use nonexisiting sizes - important is only the BIG fonts. (eg. you have only times.24 on disk, but you can use antialiased times.12) Problems ======== It is slow. But not very slow - first version was 10x slower... Applications writing on other screens will not work properly in most cases (ie. use wrong colors). Prepare for crash when you use other patch after Beautifont and quit Beautifont before that patch. You cannot close Workbench while Beautifont is running. (but this is not really a problem...) If you want to use Beautifont togther with Birdie, start Beautifont first. Why it is all impossible... =========================== First of all, textdrawing routine doesn't know what are the colors of pixels, it has only pen indexes. This program assumes, that all graphics will be drawn on Workbench Screen and gets color information from here. This is of course wrong if there are other screens... Second problem is which pen should be used for smoothed pixels. On highcolor screenmodes you have all colors available. But here we have to allocate pen on a given screen (again it is Workbench Screen regerdless it is right or not). Pens are released when the program quits. The last big problem is how to access the screen. The text image is calculated pixel by pixel. Beautifont uses ReadPixelArray and WritePixelArray. Unfortunately all pixel based functions are very slow on planar (AGA) screens. BTW. WritePixelArray8 is used very often in recent applications and some people tried to make optimized version. There are at last 2 patches available: PatchWPA8 and NewWPA8. Both of them work wrong... NewWPA8 produces artifacts if used by more than one task simultaneously (as you can imagine, text drawing is very popular and many tasks want to write something at the same time). PatchWPA8 has another bug - it tries to be smart and perform its work directly into screen bitmap. In most cases it succeeds. In fact I considered this program good for a long time. But this tricky calculation doesn't work when used on window titlebar (and window titlebar is the place, where you expect some text, don't you?). Conclusion: there is no working WPA8 patch available :-(