next up previous contents index
Next: t1lib and PostScript: Notes Up: Transformation of Fonts Previous: Fontlevel Transformations   Contents   Index

Transformation at Rastering Time

This kind of transformation is the most generic one and allows arbitrary transformations. A transformation of a given location is given by the following set of linear equations:


Here, the matrix


is referred to as the transformation matrix. In t1lib the following type definition is used for such transformation matrices:
typedef struct
{
  double cxx;  /* corresponds to a11 */
  double cyx;  /* corresponds to a21 */
  double cxy;  /* corresponds to a12 */
  double cyy;  /* corresponds to a22 */
} T1_TMATRIX;
Each of the rastering functions expects to get a pointer to an object of type T1_MATRIX, or NULL if no transformation is to be applied. If any transformation has been specified, the resulting glyph is never kept in cache memory. Thus, if for some reason caching should be disabled for non-transformed characters, simply a pointer to the unity matrix could be specified to the rastering function to achieve this.

The user has the possibility of either allocating and creating the transformation matrices by himself or to use predefined functions of t1lib. There are 8 different functions for generating transformed characters. Figure [*] gives an example of each function using the character ``g''.

Figure: Typical examples for the predefined functions for generating transformation matrices in t1lib, applied to the character ``g''.

width 0ptT1_MirrorHMatrix() T1_MirrorVMatrix() T1_ShearHMatrix()

width 0ptT1_ShearVMatrix() T1_ExtendHMatrix() T1_ExtendVMatrix()

width 0ptT1_RotateMatrix() T1_TransformMatrix()

Before describing each particular function we should discuss the first argument because this is common to all matrix transformation functions. This first argument, in case it is not NULL, is expected to be a pointer to an already existent valid T1_TMATRIX object. The transformation to be applied is then done by multiplying the existent matrix with the new matrix. In other words, the existent matrix is replaced by the concatenation of the two matrices. If a NULL is specified as argument, the new matrix is allocated by the respective function and then set to the concatenation of the unity matrix with the desired transformation. Thus, to remove a matrix from memory, the pointer simply has to be given to free(), no matter how many transformations have been applied to this matrix before.

We should now describe the functions for generating transformation matrices:

 T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix)

to 0pt and

 T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix)

to 0pt simply change the sign of the matrix coefficients and respectively. This has the optical effect of mirroring the character at the horizontal line or at the vertical line , respectively. These functions represent a specialized form of

 T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, float extent)

to 0pt and

 T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, float extent)

to 0pt These functions allow arbitrary scaling in the respective coordinate direction. Specifying
extent=-1 exactly yields mirroring at the corresponding axis.

Furthermore, there are two transformations where one coordinate depends on itself and on the other coordinate. This is called shearing, slanting or also obliqueing. It is possible in both directions using the functions

 T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, float shear)

to 0pt and

 T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, float shear)

to 0pt In case of horizontal shearing, the factor shear is equal to , where may be interpreted as the italic angle. It is measured from the positive vertical axis in mathematical negative direction. Correspondingly, for vertical shearing shear equals , where is the angle measured from the horizontal axis in mathematically positive direction.

Rotation of glyphs is achieved using

 T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, float angle)

to 0pt This function evaluates the trigonometric functions at the value of angle and concatenates the transformation matrix with


is expected to be specified in degrees. It is measured according standard mathematical conventions.

There is one more function which allows to set all matrix coefficients explicitly. It gives thus complete control over the transformation. This might be necessary to typeset text in a circle, for example. The syntax of this function is

 T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, 
                                 float cxx, float cyx,
                                 float cxy, float cyy)

to 0pt


next up previous contents index
Next: t1lib and PostScript: Notes Up: Transformation of Fonts Previous: Fontlevel Transformations   Contents   Index
2005-01-12