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''.
width 0pt T1_MirrorHMatrix()
T1_MirrorVMatrix()
T1_ShearHMatrix()
width 0pt T1_ShearVMatrix()
T1_ExtendHMatrix()
T1_ExtendVMatrix()
width 0pt T1_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)
T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix)
T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, float extent)
T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, float extent)
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)
T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, float shear)
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)
angle
and concatenates the transformation matrix with
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)