From rherbst@pacbell.net Sun Mar 17 10:59:03 2002
Date: Sat, 16 Mar 2002 14:37:03 -0800
From: Richard Herbst <rherbst@pacbell.net>
To: Nick Whitelegg <bssnrw@bath.ac.uk>
Subject: Re: [Foxgui-users]Re: XLFT Font Demo

Nick Whitelegg wrote:

>>On Friday 15 March 2002 19:10, you wrote:
>>
>>>Hi Jeroen
>>>
>>>Sorry to bother you but I just wanted to make sure
>>>you got my email yesterday with the XLFD font demo
>>>program. If you try it I would be interested in your
>>>feedback. If you have questions about how it works
>>>I'll do my best to answer them.
>>>If you didn't get it I can resend it.
>>>
>>>Thanks,
>>>Richard
>>>
>>
>>I have gotten your code.  I know the XLFD matrix works
>>because I've played with it also; but your program definitely
>>demonstrates it in a much nicer way!
>>
>>
> 
> Richard,
> 
> Could you send me your program, as I am interested in rotated text? Is it
> just a standard X11 program which should compile on any X system?
> 
> Thanks,
> Nick
> 

Hi Nick,

I have written a small demo program of how to use the
XLFD font matrix to manipulate X11 scalable fonts.

The information I used is in the book:

"Programmer's Supplement for Release 6"
  Edited by Adrian Nye
  O'reilly & Associates 1995

I am able to do all the transformations for any of the scalable fonts:
1. Rotation - Note: The circle button takes a few seconds to draw (600Mhz P3).
2. Shearing - (like italics only variable both forward and backward)
3. Anamorphic Scaling - (variable condensed text)
4. Mirroring - (X and Y) maybe should be called (H and V)
5. Combinations of all the above by using matrix multiplication.

I had to derive a class from FXFont which I called FXRotatableFont.
This is to get at the [attributes] data in XCharStruct. Before
R6? the attribute data was undefined. But in R6 it's defined to
hold the spacing of the individual character that was transformed.
The other information needed is the Resolution number in the
X11 font string. This is used with the pixel matrix information
times the attributes to get the actual X and Y spacing for the
character. It actually works, the characters are automatically
spaced accurately under any transformation I have tried.
I have also included a simple 2D matrix class geared toward font
transformations. This has in it an output XLFD FXString function
to combine with and create the complete X11 font string.
Another function gets the resolution from the FXRotatableFont derived
function findmatch which is protected in FXFont.

The demo program draws to an FXImage which then draws to FXCanvas
so there is some delay before you see the output. This is especially
noticeable when drawing individual transformed characters, like the
circle. I do this so I can redraw fast if the screen gets covered up.
It would be nice to keep a font loaded and just change the XLFD
matrix but the book says it can't be done. :(

I seem to see some line wraping in the code when I send it by email.
Check this is OK. Let me know how you like it. I may post it to the
list.

Thanks,
Richard

