Back to index

tetex-bin  3.0
Defines | Functions
t1trans.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "../type1/ffilest.h"
#include "../type1/types.h"
#include "parseAFM.h"
#include "../type1/objects.h"
#include "../type1/spaces.h"
#include "../type1/util.h"
#include "../type1/fontfcn.h"
#include "../type1/regions.h"
#include "t1types.h"
#include "t1extern.h"
#include "t1trans.h"
#include "t1base.h"

Go to the source code of this file.

Defines

#define T1TRANS_C

Functions

int T1_ExtendFont (int FontID, double extend)
double T1_GetExtend (int FontID)
int T1_SlantFont (int FontID, double slant)
double T1_GetSlant (int FontID)
int T1_TransformFont (int FontID, T1_TMATRIX *matrix)
T1_TMATRIX T1_GetTransform (int FontID)
int T1_SetLinePosition (int FontID, int linetype, float value)
int T1_SetLineThickness (int FontID, int linetype, float value)
float T1_GetLinePosition (int FontID, int linetype)
float T1_GetLineThickness (int FontID, int linetype)
T1_TMATRIXT1_RotateMatrix (T1_TMATRIX *matrix, double angle)
T1_TMATRIXT1_MirrorHMatrix (T1_TMATRIX *matrix)
T1_TMATRIXT1_MirrorVMatrix (T1_TMATRIX *matrix)
T1_TMATRIXT1_ShearHMatrix (T1_TMATRIX *matrix, double shear)
T1_TMATRIXT1_ShearVMatrix (T1_TMATRIX *matrix, double shear)
T1_TMATRIXT1_ExtendHMatrix (T1_TMATRIX *matrix, double extent)
T1_TMATRIXT1_ExtendVMatrix (T1_TMATRIX *matrix, double extent)
T1_TMATRIXT1_TransformMatrix (T1_TMATRIX *matrix, double cxx, double cyx, double cxy, double cyy)
int T1_StrokeFont (int FontID, int dostroke)
int T1_SetStrokeFlag (int FontID)
int T1_ClearStrokeFlag (int FontID)
int T1_GetStrokeMode (int FontID)
int T1_SetStrokeWidth (int FontID, float strokewidth)
float T1_GetStrokeWidth (int FontID)

Define Documentation

#define T1TRANS_C

Definition at line 29 of file t1trans.c.


Function Documentation

int T1_ClearStrokeFlag ( int  FontID)

Definition at line 600 of file t1trans.c.

{
  /* First, check for font residing in memory: */
  if ( T1_CheckForFontID(FontID) != 1 ) {
    T1_errno = T1ERR_INVALID_FONTID;
    return -1;
  }

  /* Reset stroke flag */
  pFontBase->pFontArray[FontID].info_flags &= ~RASTER_STROKED;
  
  return 0;
  
}

Here is the call graph for this function:

int T1_ExtendFont ( int  FontID,
double  extend 
)

Definition at line 68 of file t1trans.c.

{
  
  /* First, check for font residing in memory: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }
  
  /* Second, check whether size-dependent data exists: */
  if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1); 
  }
  
  pFontBase->pFontArray[FontID].extend=extend;
  pFontBase->pFontArray[FontID].FontTransform[0] = extend;
  return(0);
}

Here is the call graph for this function:

T1_TMATRIX* T1_ExtendHMatrix ( T1_TMATRIX matrix,
double  extent 
)

Definition at line 459 of file t1trans.c.

{
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  matrix->cxx *=extent;
  matrix->cyx *=extent;
  return( matrix);
  
}
T1_TMATRIX* T1_ExtendVMatrix ( T1_TMATRIX matrix,
double  extent 
)

Definition at line 485 of file t1trans.c.

{
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  matrix->cxy *=extent;
  matrix->cyy *=extent;
  return( matrix);
  
}
double T1_GetExtend ( int  FontID)

Definition at line 95 of file t1trans.c.

{
  /* First, check for font residing in memory: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }

  return( pFontBase->pFontArray[FontID].extend);
}

Here is the call graph for this function:

float T1_GetLinePosition ( int  FontID,
int  linetype 
)

Definition at line 269 of file t1trans.c.

{

  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }

  if (linetype & T1_UNDERLINE)
    return( pFontBase->pFontArray[FontID].UndrLnPos);
  if (linetype & T1_OVERLINE)
    return( pFontBase->pFontArray[FontID].OvrLnPos);
  if (linetype & T1_OVERSTRIKE)
    return( pFontBase->pFontArray[FontID].OvrStrkPos);
  
  /* The linetype was bad */
  T1_errno=T1ERR_INVALID_PARAMETER;
  return( 0.0);
  
}

Here is the call graph for this function:

float T1_GetLineThickness ( int  FontID,
int  linetype 
)

Definition at line 292 of file t1trans.c.

{

  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }

  if (linetype & T1_UNDERLINE)
    return( pFontBase->pFontArray[FontID].UndrLnThick);
  if (linetype & T1_OVERLINE)
    return( pFontBase->pFontArray[FontID].OvrLnThick);
  if (linetype & T1_OVERSTRIKE)
    return( pFontBase->pFontArray[FontID].OvrStrkThick);
  
  /* The linetype was bad */
  T1_errno=T1ERR_INVALID_PARAMETER;
  return( 0.0);

}

Here is the call graph for this function:

double T1_GetSlant ( int  FontID)

Definition at line 141 of file t1trans.c.

{
  /* First, check for font residing in memory: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }

  return( pFontBase->pFontArray[FontID].slant);
}

Here is the call graph for this function:

int T1_GetStrokeMode ( int  FontID)

Definition at line 625 of file t1trans.c.

{
  int outval = 0;
  
  /* First, check for font residing in memory: */
  if ( T1_CheckForFontID( FontID) != 1 ) {
    T1_errno = T1ERR_INVALID_FONTID;
    return -1;
  }

  if ( (pFontBase->pFontArray[FontID].info_flags & CACHE_STROKED) != 0 ) 
    outval |= 0x02;
  
  if ( (pFontBase->pFontArray[FontID].info_flags & RASTER_STROKED) != 0 ) 
    outval |= 0x01;
  
  return outval;
    
}

Here is the call graph for this function:

float T1_GetStrokeWidth ( int  FontID)

Definition at line 692 of file t1trans.c.

{
  /* First, check for font residing in memory: */
  if ( T1_CheckForFontID( FontID) != 1 ) {
    T1_errno = T1ERR_INVALID_FONTID;
    return 0.0f;
  }

  return pFontBase->pFontArray[FontID].StrokeWidth;  
}

Here is the call graph for this function:

Definition at line 188 of file t1trans.c.

{
  T1_TMATRIX tmatrix={0.0, 0.0, 0.0, 0.0};
  
  /* First, check for font residing in memory: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(tmatrix);
  }

  tmatrix.cxx=pFontBase->pFontArray[FontID].FontTransform[0];
  tmatrix.cxy=pFontBase->pFontArray[FontID].FontTransform[1];
  tmatrix.cyx=pFontBase->pFontArray[FontID].FontTransform[2];
  tmatrix.cyy=pFontBase->pFontArray[FontID].FontTransform[3];
  
  return( tmatrix);
}

Here is the call graph for this function:

Definition at line 356 of file t1trans.c.

{
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  matrix->cxx *=-1.0;
  matrix->cyx *=-1.0;
  return( matrix);
}

Definition at line 381 of file t1trans.c.

{
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  matrix->cxy *=-1.0;
  matrix->cyy *=-1.0;
  return( matrix);
  
}
T1_TMATRIX* T1_RotateMatrix ( T1_TMATRIX matrix,
double  angle 
)

Definition at line 324 of file t1trans.c.

{
  T1_TMATRIX tmat;
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  memcpy( &tmat, matrix, sizeof(T1_TMATRIX));
  /* Convert angle to radians: */
  angle=angle*PI/180.0;
  /* multiply matrices */
  matrix->cxx=cos((double)angle) * tmat.cxx - sin((double)angle) * tmat.cxy;
  matrix->cyx=cos((double)angle) * tmat.cyx - sin((double)angle) * tmat.cyy;
  matrix->cxy=sin((double)angle) * tmat.cxx + cos((double)angle) * tmat.cxy;
  matrix->cyy=sin((double)angle) * tmat.cyx + cos((double)angle) * tmat.cyy;
  return( matrix);
}

Here is the call graph for this function:

int T1_SetLinePosition ( int  FontID,
int  linetype,
float  value 
)

Definition at line 212 of file t1trans.c.

{

  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }

  if (linetype & T1_UNDERLINE){
    pFontBase->pFontArray[FontID].UndrLnPos=value;
    return( 0);
  }
  if (linetype & T1_OVERLINE){
    pFontBase->pFontArray[FontID].OvrLnPos=value;
    return( 0);
  }
  if (linetype & T1_OVERSTRIKE){
    pFontBase->pFontArray[FontID].OvrStrkPos=value;
    return( 0);
  }
    
  /* The linetype was bad */
  T1_errno=T1ERR_INVALID_PARAMETER;
  return( -1);
  
}

Here is the call graph for this function:

int T1_SetLineThickness ( int  FontID,
int  linetype,
float  value 
)

Definition at line 241 of file t1trans.c.

{

  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }

  if (linetype & T1_UNDERLINE){
    pFontBase->pFontArray[FontID].UndrLnThick=value;
    return( 0);
  }
  if (linetype & T1_OVERLINE){
    pFontBase->pFontArray[FontID].OvrLnThick=value;
    return( 0);
  }
  if (linetype & T1_OVERSTRIKE){
    pFontBase->pFontArray[FontID].OvrStrkThick=value;
    return( 0);
  }
    
  /* The linetype was bad */
  T1_errno=T1ERR_INVALID_PARAMETER;
  return( -1);
  
}

Here is the call graph for this function:

int T1_SetStrokeFlag ( int  FontID)

Definition at line 579 of file t1trans.c.

{
  /* First, check for font residing in memory: */
  if ( T1_CheckForFontID(FontID) != 1 ) {
    T1_errno = T1ERR_INVALID_FONTID;
    return -1;
  }
  
  /* Set stroke flag to true */
  pFontBase->pFontArray[FontID].info_flags |= RASTER_STROKED;
  
  return 0;
  
}

Here is the call graph for this function:

int T1_SetStrokeWidth ( int  FontID,
float  strokewidth 
)

Definition at line 651 of file t1trans.c.

{
  /* First, check for font residing in memory: */
  if ( T1_CheckForFontID( FontID) != 1 ) {
    T1_errno = T1ERR_INVALID_FONTID;
    return -1;
  }

  /* Second, check whether caching stroked characters is enabled
     for this font and glyph data is already existing. In this case
     the operation is forbidden, unless the previous non-zero value
     is just restored! */
  if ( ((pFontBase->pFontArray[FontID].info_flags & CACHE_STROKED) != 0) &&
       (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL) &&
       (pFontBase->pFontArray[FontID].SavedStrokeWidth != strokewidth)
       ) {
    T1_errno = T1ERR_OP_NOT_PERMITTED;
    return -1; 
  }

  /* OK, accept stroke width after ensuring a numerically meaningful
     value */
  if ( strokewidth < 0.0f ) {
    T1_errno = T1ERR_INVALID_PARAMETER;
    return -1;
  }

  pFontBase->pFontArray[FontID].StrokeWidth = strokewidth;
  
  if ( strokewidth != 0.0f )
    pFontBase->pFontArray[FontID].SavedStrokeWidth = strokewidth;
  
  return 0;
    
}

Here is the call graph for this function:

T1_TMATRIX* T1_ShearHMatrix ( T1_TMATRIX matrix,
double  shear 
)

Definition at line 407 of file t1trans.c.

{
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  matrix->cxx +=shear*matrix->cxy;
  matrix->cyx +=shear*matrix->cyy;
  return( matrix);
  
}
T1_TMATRIX* T1_ShearVMatrix ( T1_TMATRIX matrix,
double  shear 
)

Definition at line 433 of file t1trans.c.

{
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  matrix->cxy +=shear*matrix->cxx;
  matrix->cyy +=shear*matrix->cyx;
  return( matrix);
  
}
int T1_SlantFont ( int  FontID,
double  slant 
)

Definition at line 114 of file t1trans.c.

{
  
  /* First, check for font residing in memory: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }
  
  /* Second, check whether size-dependent data exists: */
  if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1); 
  }
  
  pFontBase->pFontArray[FontID].slant=slant;
  pFontBase->pFontArray[FontID].FontTransform[2] = slant;
  return(0);
}

Here is the call graph for this function:

int T1_StrokeFont ( int  FontID,
int  dostroke 
)

Definition at line 545 of file t1trans.c.

{
  
  /* First, check for font residing in memory: */
  if ( T1_CheckForFontID( FontID) != 1 ) {
    T1_errno = T1ERR_INVALID_FONTID;
    return -1;
  }
  
  /* Second, check whether size-dependent data exists: */
  if ( pFontBase->pFontArray[FontID].pFontSizeDeps != NULL ) {
    T1_errno = T1ERR_OP_NOT_PERMITTED;
    return -1; 
  }

  if ( dostroke != 0 ) {
    pFontBase->pFontArray[FontID].info_flags |= RASTER_STROKED;
    pFontBase->pFontArray[FontID].info_flags |= CACHE_STROKED;
  }
  else {
    pFontBase->pFontArray[FontID].info_flags &= ~RASTER_STROKED;
    pFontBase->pFontArray[FontID].info_flags &= ~CACHE_STROKED;
  }
  

  return 0;
}

Here is the call graph for this function:

int T1_TransformFont ( int  FontID,
T1_TMATRIX matrix 
)

Definition at line 159 of file t1trans.c.

{
  
  /* First, check for font residing in memory: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }
  
  /* Second, check whether size-dependent data exists: */
  if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1); 
  }
  
  pFontBase->pFontArray[FontID].FontTransform[0] = matrix->cxx;
  pFontBase->pFontArray[FontID].FontTransform[1] = matrix->cxy;
  pFontBase->pFontArray[FontID].FontTransform[2] = matrix->cyx;
  pFontBase->pFontArray[FontID].FontTransform[3] = matrix->cyy;
  return(0);
}

Here is the call graph for this function:

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

Definition at line 511 of file t1trans.c.

{
  T1_TMATRIX tmat;
  
  if (matrix==NULL){
    if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return( NULL);
    }
    matrix->cxx=1.0;
    matrix->cyx=0.0;
    matrix->cxy=0.0;
    matrix->cyy=1.0;
  }
  memcpy( &tmat, matrix, sizeof(T1_TMATRIX));
  matrix->cxx=cxx * tmat.cxx + cyx * tmat.cxy;
  matrix->cyx=cxx * tmat.cyx + cyx * tmat.cyy;
  matrix->cxy=cxy * tmat.cxx + cyy * tmat.cxy;
  matrix->cyy=cxy * tmat.cyx + cyy * tmat.cyy;
  
  return( matrix);
}

Here is the call graph for this function: