Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!darren From: darren@cbmvax.commodore.com (Darren Greenwald) Newsgroups: comp.sys.amiga.programmer Subject: Re: Bitmapped font scaling? AmigaMail! Message-ID: <22779@cbmvax.commodore.com> Date: 28 Jun 91 14:59:51 GMT References: <1124.2867637f@vger.nsu.edu> <22695@cbmvax.commodore.com> <1991Jun27.104700.24636@wehi.dn.mu.oz> <22736@cbmvax.commodore.com> <1991Jun28.165053.24639@wehi.dn.mu.oz> Reply-To: darren@cbmvax.commodore.com (Darren Greenwald) Organization: Commodore, West Chester, PA Lines: 103 In article <1991Jun28.165053.24639@wehi.dn.mu.oz> baxter_a@wehi.dn.mu.oz writes: >In article <22736@cbmvax.commodore.com>, darren@cbmvax.commodore.com (Darren Greenwald) writes: >> What do you want to rotate? The font data, or the output from Text()? >> > >Well, either. I want to write sideways and make it look like its the same >font. It is a little harder than rotating a bit map (which is what I thought >would do until one of you kind guys provided the code) because of the variable >screen aspect ratio. > >Regards Alan Yes, its a bit harder, though you can start with a scaled font (using a new call in diskfont.library to generate a scaled font with adjusted aspect ratio, and rotate that). The new 2.0 call to look for is NewScaledDiskFont() in diskfont.library. You give it a TextFont structure (the font to scale), and a TextAttr structure which has the new size, and possibly tags indicating the destination X:Y aspect ratio. Use that for drawing, and rotate the entire line. Rotating the font data just doesn't work out well because fonts have a fixed Y size, and variable X size. The result of a rotation is just not clear (even just a 90 degree rotation). For example: Lets suppose I have these 2 characters: X=5 X = 13 --------------------- | * | ** ** | | | * * * * | 8 pixels | * | * * * * | Tall | * | * * * * | | * | * * * | | * | * * | | * | * * | | * | * * | --------------------- Do you rotate it like this? X = 5 X = 13 --------------------- | | | | | *********** | 8 pixels | | * | Tall |*** *| * | | | * | | | * | <- Notice that if we were to print the 'i', and | | *********** | then move down and print the 'M' the 'i' wouldn't | | | be as tall as the 'M', and the spacing between --------------------- characters is off. Or do you rotate it like this? X = 8 X = 8 ------------------- | |********| | | *| 8 pixels | | * | Tall |****** *| * | | | * | <- Notice that the characters were scaled to fit | | * | be non-proportional - the original Y size was | | *| use for the new X size, and the original X | |********| size is ignored. Our prop font is now mono-spaced. ------------------- Or do you rotate like so? X = 8 X = 8 ------------------- | | | | |********| |****** *| *| | | * | | | * | 13 pixels | | * | Tall | | * | | | * | | | * | <- Pick the widest font as the final | | * | Y size; X size for all characters is original | | *| Y size; rotate 90 degrees; Pad thinner characters | |********| with extra space to fit in new Y. | | | ------------------- A variation on this idea is to scale, instead of Pad. The most obvious problem with this last scheme is that the final Y is arbitrary (based on the widest character in the set, or maybe some average. The final data is also mono-spaced. -------------------------------------------------------------- Darren M. Greenwald | Commodore-Amiga Software Engineering | USENET: uunet!cbmvax!darren -------------------------------------------------------------- Quote: "It would be impossible to discuss the subject without a common frame of reference." - Spock