I was thinking yesterday about font-rendering on modern OSes. I found myself the need for a TRUE 3D font render technology, but I cannot cope with it alone. After imagining how to do the system call for such a render, I discovered we needed a function call like this:
writetext(charfname,wcharmessage,double x,double y,double z,double alpha, double beta,double gamma,int kern)
fname is the font name, while message is the actual text to be rendered. alpha, beta, gamma will be, respectively, the angles along x, y and z axis. The render will be done in the plane that covers those angles. The kern is how many additional units will be left between letters. It’s measured along the render plane.
After determining that, I though on adding the way to add an user-defined routine that has to be thread-safe, but not neccesarily reentrant, that captures each character before outputting it to the screen and alteres its position, plane and kerning, so nice fonts effects can be achieved. The system will call this routine BEFORE rendering each character. It’s code will be something like:
struct fontreder {
double dx, double dy, double dz,
double dalpha,double dbeta,double dgamma,
int dkern
};
int pretextrender(int thread_id,struct fontrender *frp){
/* Here the routine receives in frp the actual font rendering values and it has to return the DELTAS (i.e., relative increments/decrements) for those parameters in the same structure. The system will add those deltas to the actual values and then render the character. The routine will be called for each character on each thread. The thread-id parameter should be used to differentiate each thread and string */
return 0; /* returns 0 if all goes right, 1 in case of any error. In this case, the values returned will be ignored by the OS so font render won't be affected */
}
I know this idea can be used on normal 2D font rendering and extended to 3D in RC2. Just my two eurocents