Back to index

tetex-bin  3.0
Functions
t1outline.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

T1_OUTLINET1_GetCharOutline (int FontID, char charcode, float size, T1_TMATRIX *transform)
T1_OUTLINET1_GetStringOutline (int FontID, char *string, int len, long spaceoff, int modflag, float size, T1_TMATRIX *transform)
T1_OUTLINET1_ConcatOutlines (T1_OUTLINE *path1, T1_OUTLINE *path2)
T1_OUTLINET1_ScaleOutline (T1_OUTLINE *path, float scale)
T1_OUTLINET1_GetMoveOutline (int FontID, int deltax, int deltay, int modflag, float size, T1_TMATRIX *transform)
void T1_DumpPath (T1_OUTLINE *path)
void T1_AbsolutePath (T1_OUTLINE *rpath)
void T1_RelativePath (T1_OUTLINE *apath)
void T1_ManipulatePath (T1_OUTLINE *path, void(*manipulate)(fractpel *x, fractpel *y, int type))
T1_OUTLINET1_CopyOutline (T1_OUTLINE *path)
void T1_FreeOutline (T1_OUTLINE *path)
struct regionfontfcnB (int FontID, int modflag, struct XYspace *S, char **ev, unsigned char index, int *mode, psfont *Font_Ptr, int do_raster, float strokewidth)
struct regionfontfcnB_string (int FontID, int modflag, struct XYspace *S, char **ev, unsigned char *string, int no_chars, int *mode, psfont *Font_Ptr, int *kern_pairs, long spacewidth, int do_raster, float strokewidth)
struct regionfontfcnB_ByName (int FontID, int modflag, struct XYspace *S, char *charname, int *mode, psfont *Font_Ptr, int do_raster)

Function Documentation

struct region* fontfcnB ( int  FontID,
int  modflag,
struct XYspace S,
char **  ev,
unsigned char  index,
int mode,
psfont Font_Ptr,
int  do_raster,
float  strokewidth 
) [read]

Definition at line 277 of file fontfcn.c.

{
 
  psobj *charnameP; /* points to psobj that is name of character*/
  FontInfo *pAFMData=NULL;
  int i=-1;
  int j=0;
  int numPieces=1;
  int N;
  T1_PATHPOINT currdisp;
  int basechar;
  
  psdict *CharStringsDictP; /* dictionary with char strings     */
  psobj   CodeName;   /* used to store the translation of the name*/
  psobj  *SubrsArrayP;
  psobj  *theStringP;
  int localmode=0;
  
  struct segment *charpath=NULL;   /* the path for this character   */           
  struct segment *tmppath1=NULL;
  struct segment *tmppath2=NULL;
  struct segment *tmppath3=NULL;
  struct segment *tmppath4=NULL;
  
   
  /* set the global font pointer to the address of already allocated
     structure and setup pointers*/
  FontP=Font_Ptr;
  CharStringsDictP =  FontP->CharStringsP;
  SubrsArrayP = &(FontP->Subrs);
  charnameP = &CodeName;

  if (ev==NULL){  /* font-internal encoding should be used */
    charnameP->len = FontP->fontInfoP[ENCODING].value.data.arrayP[index].len;
    charnameP->data.stringP = (unsigned char *) FontP->fontInfoP[ENCODING].value.data.arrayP[index].data.arrayP;
  }
  else{           /* some user-supplied encoding is to be used */
    charnameP->len = strlen(ev[index]);
    charnameP->data.stringP = (unsigned char *) ev[index];
  }
  strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len);
  CurCharName[charnameP->len]='\0';
  
 
  /* search the chars string for this charname as key */
  basechar = SearchDictName(CharStringsDictP,charnameP);
  if (basechar<=0) {
    /* Check first, whether a char in question is a composite char */
    if ((i=isCompositeChar( FontID, CurCharName))>-1) {
      /* i is now the index of the composite char definitions
        (starting at 0). At this point it is clear that AFM-info
        must be present -> fetch first component of composite char. */
      pAFMData=pFontBase->pFontArray[FontID].pAFMData;
      charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName);
      charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName;
      numPieces=pAFMData->ccd[i].numOfPieces;
      
      if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) {
       /* this is bad, AFM-file and font file do not match. This 
          will most probably lead to errors or inconsistencies later.
          However, we substitute .notdef and inform the user via
          logfile and T1_errno. */
       sprintf( err_warn_msg_buf,
               "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)",
               pAFMData->ccd[i].pieces[0].pccName,
               pAFMData->ccd[i].ccName, FontID);
       T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING);
       T1_errno=T1ERR_COMPOSITE_CHAR;
      }
    }
  }
  
  if (basechar<=0) { /* This  means the requested char is unknown or the
                     base char of a composite is not found ->
                     we substitute .notdef */
    charnameP = &CodeName;
    charnameP->len = 7;
    charnameP->data.stringP = (unsigned char *) notdef;
    basechar = SearchDictName(CharStringsDictP,charnameP);
    localmode=FF_NOTDEF_SUBST;
    /* Font must be completely damaged if it doesn't define a .notdef */
    if (basechar<=0) {
      *mode=FF_PARSE_ERROR;
      return(NULL);
    }
  } /* if (basechar<=0) */
  /* basechar is now the index of the base character in the CharStrings
     dictionary */

  /* we provide the Type1Char() procedure with the name of the character
     to rasterize for debugging purposes */
  strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len);
  CurCharName[charnameP->len]='\0';
  /* get CharString and character path */
  theStringP = &(CharStringsDictP[basechar].value);
  tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL,
                                     FontP->BluesP,mode,CurCharName,strokewidth);
  /* if Type1Char reported an error, then return */
  if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR)
    return(NULL);
  
  /* Defer rastering to later, we first have to handle the composite
     symbols */
  for (j=1; j<numPieces; j++) {
    /* get composite symbol name */
    charnameP->len=strlen( pAFMData->ccd[i].pieces[j].pccName);
    charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName;
    /* get CharString definition */
    if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) {
      /* handling of errors, see comments above ... */
      sprintf( err_warn_msg_buf,
              "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)",
              pAFMData->ccd[i].pieces[j].pccName,
              pAFMData->ccd[i].ccName, FontID);
      T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING);
      charnameP = &CodeName;
      charnameP->len = 7;
      charnameP->data.stringP = (unsigned char *) notdef;
      N = SearchDictName(CharStringsDictP,charnameP);
      localmode=FF_NOTDEF_SUBST;
      /* damaged Font */
      if (N<=0) {
       *mode=FF_PARSE_ERROR;
       if (charpath!=NULL) {
         KillPath( charpath);
       }
       return(NULL);
      }
    }
    theStringP = &(CharStringsDictP[N].value);
    tmppath1=(struct segment *)ILoc(S,
                                pAFMData->ccd[i].pieces[j].deltax,
                                pAFMData->ccd[i].pieces[j].deltay);
    
    strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len);
    CurCharName[charnameP->len]='\0';
    charpath=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL,
                                    FontP->BluesP,mode,CurCharName,strokewidth);
    /* return if Type1Char reports an error */
    if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR)
      return(NULL);
    /* get escapement of current symbol */
    currdisp=getDisplacement( charpath);
    /* concat displacement and symbol path */
    charpath=(struct segment *)Join(tmppath1,charpath);
    /* for composite symbols we have to step back the char escapement.
       this is, in order to be able to use accents that cause a
       non zero displacement of the current point! We further have to
       step back the displacement from composite char data. */
    tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y);
    tmppath3=(struct segment *)ILoc(S,
                                -pAFMData->ccd[i].pieces[j].deltax,
                                -pAFMData->ccd[i].pieces[j].deltay);
    tmppath3=(struct segment *)Join(tmppath1,tmppath3);
    /* create path, or, respectively, append to existing path */
    if (tmppath4==NULL) {
      tmppath4=(struct segment *)Join(charpath,tmppath3);
    }
    else {
      charpath=(struct segment *)Join(charpath,tmppath3);
      tmppath4=(struct segment *)Join(tmppath4,charpath);
    }
  }

  /* concat composite symbols and base char */
  if (tmppath4==NULL) { /* no previous composite symbols */
    charpath=tmppath2; /* a simple char */
  }
  else { 
    charpath=(struct segment *)Join(tmppath4,tmppath2);
  }
  
  
  if (do_raster) { 
    /* fill with winding rule unless path was requested */
    if (*mode != FF_PATH) {
      charpath =  (struct segment *)Interior(charpath,WINDINGRULE+CONTINUITY);
    }
  }

  if (*mode==0)
    *mode=localmode;
  
  return((xobject) charpath);
}

Here is the caller graph for this function:

struct region* fontfcnB_ByName ( int  FontID,
int  modflag,
struct XYspace S,
char *  charname,
int mode,
psfont Font_Ptr,
int  do_raster 
) [read]

Here is the caller graph for this function:

struct region* fontfcnB_string ( int  FontID,
int  modflag,
struct XYspace S,
char **  ev,
unsigned char *  string,
int  no_chars,
int mode,
psfont Font_Ptr,
int kern_pairs,
long  spacewidth,
int  do_raster,
float  strokewidth 
) [read]

Definition at line 629 of file fontfcn.c.

{
 
  psobj *charnameP; /* points to psobj that is name of character*/
  FontInfo *pAFMData=NULL;
  int i=-1;
  int j=0;
  int k=0;
  long acc_width=0;
  int numPieces=1;
  int N;
  T1_PATHPOINT currdisp;
  int basechar;
  
  psdict *CharStringsDictP; /* dictionary with char strings     */
  psobj   CodeName;   /* used to store the translation of the name*/
  psobj  *SubrsArrayP;
  psobj  *theStringP;
  int localmode=0;
  
  struct segment *charpath=NULL;   /* the path for this character   */           
  struct segment *tmppath1=NULL;
  struct segment *tmppath2=NULL;
  struct segment *tmppath3=NULL;
  struct segment *tmppath4=NULL;
  struct segment *tmppath5=NULL;
  
   
  /* set the global font pointer to the address of already allocated
     structure and setup pointers*/
  FontP=Font_Ptr;
  CharStringsDictP =  FontP->CharStringsP;
  SubrsArrayP = &(FontP->Subrs);
  charnameP = &CodeName;

  
  /* In the following for-loop, all characters are processed, one after
     the other. Between them, the amount of kerning is inserted.
     The number of path variables used is somewhat numerous. We use the
     follwing conventions:

     charpath:  the overall path of the string.
     tmppath5:  the overall path of one component (possibly a composite symbol)
     tmppath2:  the path of a simple char or base char of a composite
     tmppath4:  the path of all "accents" of a composite symbol
  */
  for (k=0; k<no_chars;k++) {
    if (ev==NULL){  /* font-internal encoding should be used */
      charnameP = &CodeName;
      charnameP->len = FontP->fontInfoP[ENCODING].value.data.arrayP[string[k]].len;
      charnameP->data.stringP = (unsigned char *) FontP->fontInfoP[ENCODING].value.data.arrayP[string[k]].data.arrayP;
    }
    else {           /* some user-supplied encoding is to be used */
      charnameP = &CodeName;
      charnameP->len = strlen(ev[string[k]]);
      charnameP->data.stringP = (unsigned char*) ev[string[k]];
    }
    
    /* Spacing is to be under users control: => if space is the charname, don't
       raster it. Rather, generate a horizontal movement of spacewidth: */
    if (strcmp((char *)charnameP->data.stringP, "space")==0){
      tmppath5=(struct segment *)ILoc(S, spacewidth,0);
      acc_width += spacewidth;
    }
    else {
      /* here a character or composite character is to be constructed */
      strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len);
      CurCharName[charnameP->len]='\0';
      
      /* search the CharString for this charname as key */
      basechar = SearchDictName(CharStringsDictP,charnameP);
      if (basechar<=0) {
       /* Check first, whether a char in question is a composite char */
       if ((i=isCompositeChar( FontID, CurCharName))>-1) {
         /* i is now the index of the composite char definitions
            (starting at 0). At this point it is clear that AFM-info
            must be present -> fetch first component of composite char. */
         pAFMData=pFontBase->pFontArray[FontID].pAFMData;
         charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName);
         charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName;
         numPieces=pAFMData->ccd[i].numOfPieces;
         
         if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) {
           /* this is bad, AFM-file and font file do not match. This 
              will most probably lead to errors or inconsistencies later.
              However, we substitute .notdef and inform the user via
              logfile and T1_errno. */
           sprintf( err_warn_msg_buf,
                   "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)",
                   pAFMData->ccd[i].pieces[0].pccName,
                   pAFMData->ccd[i].ccName, FontID);
           T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING);
           T1_errno=T1ERR_COMPOSITE_CHAR;
         }
       }
      }
      
      if (basechar<=0) { /* This  means the requested char is unknown or the
                         base char of a composite is not found ->
                         we substitute .notdef */
       charnameP = &CodeName;
       charnameP->len = 7;
       charnameP->data.stringP = (unsigned char *) notdef;
       basechar = SearchDictName(CharStringsDictP,charnameP);
       localmode=FF_NOTDEF_SUBST;
       /* Font must be completely damaged if it doesn't define a .notdef */
       if (basechar<=0) {
         *mode=FF_PARSE_ERROR;
         return(NULL);
       }
      } /* if (basechar<=0) */
      /* basechar is now the index of the base character in the CharStrings
        dictionary */
      
      /* we provide the Type1Char() procedure with the name of the character
        to rasterize for debugging purposes */
      strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len);
      CurCharName[charnameP->len]='\0';
      /* get CharString and character path */
      theStringP = &(CharStringsDictP[basechar].value);
      tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL,
                                         FontP->BluesP,mode,CurCharName,strokewidth);
      strcpy( BaseCharName, CurCharName);
      /* if Type1Char reports an error, clean up and return */
      if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) {
       if (charpath!=NULL) {
         KillPath( charpath);
       }
       if (tmppath1!=NULL) {
         KillPath( tmppath1);
       }
       if (tmppath2!=NULL) {
         KillPath( tmppath2);
       }
       if (tmppath3!=NULL) {
         KillPath( tmppath3);
       }
       if (tmppath4!=NULL) {
         KillPath( tmppath4);
       }
       if (tmppath5!=NULL) {
         KillPath( tmppath5);
       }
       return(NULL);
      }
       
      /* Defer rastering to later, we first have to handle the composite
        symbols */
      for (j=1; j<numPieces; j++) {
       /* get composite symbol name */
       charnameP->len=strlen( pAFMData->ccd[i].pieces[j].pccName);
       charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName;
       /* get CharString definition */
       if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) {
         /* handling of errors, see comments above ... */
         sprintf( err_warn_msg_buf,
                 "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)",
                 pAFMData->ccd[i].pieces[j].pccName,
                 pAFMData->ccd[i].ccName, FontID);
         T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING);
         charnameP = &CodeName;
         charnameP->len = 7;
         charnameP->data.stringP = (unsigned char *) notdef;
         N = SearchDictName(CharStringsDictP,charnameP);
         localmode=FF_NOTDEF_SUBST;
         /* an undefined .notdef is fatal -> clean up and return */
         if (N<=0) {
           *mode=FF_PARSE_ERROR;
           if (charpath!=NULL) {
             KillPath( charpath);
           }
           if (tmppath1!=NULL) {
             KillPath( tmppath1);
           }
           if (tmppath2!=NULL) {
             KillPath( tmppath2);
           }
           if (tmppath3!=NULL) {
             KillPath( tmppath3);
           }
           if (tmppath4!=NULL) {
             KillPath( tmppath4);
           }
           if (tmppath5!=NULL) {
             KillPath( tmppath5);
           }
           return(NULL);
         }
       }
       theStringP = &(CharStringsDictP[N].value);
       tmppath1=(struct segment *)ILoc(S,
                                   pAFMData->ccd[i].pieces[j].deltax,
                                   pAFMData->ccd[i].pieces[j].deltay);
    
       strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len);
       CurCharName[charnameP->len]='\0';
       tmppath5=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL,
                                        FontP->BluesP,mode,CurCharName,strokewidth);
       /* return if Type1Char reports an error */
       if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR)
         return(NULL);
       /* get escapement of current symbol */
       currdisp=getDisplacement( tmppath5);
       /* concat displacement and symbol path */
       tmppath5=(struct segment *)Join(tmppath1,tmppath5);
       /* for composite symbols we have to step back the char escapement.
          this is, in order to be able to use accents that cause a
          non zero displacement of the current point! We further have to
          step back the displacement from composite char data. */
       tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y);
       tmppath3=(struct segment *)ILoc(S,
                                   -pAFMData->ccd[i].pieces[j].deltax,
                                   -pAFMData->ccd[i].pieces[j].deltay);
       tmppath3=(struct segment *)Join(tmppath1,tmppath3);
       /* create path, or, respectively, append to existing path */
       if (tmppath4==NULL) {
         tmppath4=(struct segment *)Join(tmppath5,tmppath3);
       }
       else {
         tmppath5=(struct segment *)Join(tmppath5,tmppath3);
         tmppath4=(struct segment *)Join(tmppath4,tmppath5);
       }
      }
      
      /* concat composite symbols and base char. We use tmppath5 to store
        the path of the resulting (possibly composite) character. */
      if (tmppath4==NULL) { /* no previous composite symbols */
       tmppath5=tmppath2; /* a simple char */
      }
      else { 
       tmppath5=(struct segment *)Join(tmppath4,tmppath2);
      }
      

      /* Accumulate displacement, but be careful: In case of composite
        characters, we have to take the escapement of the base char only
        into account, because accents do not cause spacing. The path is
        constructed in a way that this automatically matches.
      */
      if (numPieces>1) { /* composite character */
       acc_width +=pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[string[k]]+1)].wx;
      }
      else { /* ordinary character */
       acc_width +=pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[string[k]]-1].wx;
      }
      
    } /* else (if (char==space) */

    /* character path is now stored in tmppath5. It may be a composite character.
       Insert kerning amount, if it is not the last character of the string. */
    if (k<no_chars-1){
      tmppath2=(struct segment *)ILoc(S,kern_pairs[k],0); 
      tmppath5=(struct segment *)Join(tmppath5,tmppath2);
      acc_width += kern_pairs[k];
    }
    if (charpath!=NULL){
      charpath=(struct segment *)Join(charpath,tmppath5);
    }
    else{
      charpath=(struct segment *)tmppath5;
    }
    /* reset the temporary paths so that constructing composite
       characters wiil continue to work properly in the next interation. */
    tmppath1=NULL;
    tmppath2=NULL;
    tmppath3=NULL;
    tmppath4=NULL;
    tmppath5=NULL;
    /* reset composition parameters */
    i=-1;
    numPieces=1;
    
  } /* for (k<no_chars) */
  
  
  /* Take care for underlining and such */
  if (modflag & T1_UNDERLINE){
    tmppath2=(struct segment *)Type1Line(FontP,S,
                                    pFontBase->pFontArray[FontID].UndrLnPos,
                                    pFontBase->pFontArray[FontID].UndrLnThick,
                                    (float) acc_width,strokewidth);
    charpath=(struct segment *)Join(charpath,tmppath2);
  }
  if (modflag & T1_OVERLINE){
    tmppath2=(struct segment *)Type1Line(FontP,S,
                                    pFontBase->pFontArray[FontID].OvrLnPos,
                                    pFontBase->pFontArray[FontID].OvrLnThick,
                                    (float) acc_width,strokewidth);
    charpath=(struct segment *)Join(charpath,tmppath2);
  }
  if (modflag & T1_OVERSTRIKE){
    tmppath2=(struct segment *)Type1Line(FontP,S,
                                    pFontBase->pFontArray[FontID].OvrStrkPos,
                                    pFontBase->pFontArray[FontID].OvrStrkThick,
                                    (float) acc_width,strokewidth);
    charpath=(struct segment *)Join(charpath,tmppath2);
  }
  
  /*
  printf("charpath->type: %x\n",charpath->type);
  printf("path1->type: %x\n",path1->type);
  printf("path2->type: %x\n",path2->type);
  */

  /* if Type1Char reported an error, then return */

  if ( *mode == FF_PARSE_ERROR)  return(NULL);
  if ( *mode == FF_PATH_ERROR)  return(NULL);
  if (do_raster) { 
    /* fill with winding rule unless path was requested */
    if (*mode != FF_PATH) {
      charpath = (struct segment *) Interior((path) charpath,WINDINGRULE+CONTINUITY);
    }
  }
  
  if (*mode==0)
    *mode=localmode;

  return((path)charpath);
}

Here is the caller graph for this function:

Definition at line 573 of file t1outline.c.

{

  struct segment *ipath;
  fractpel xcurr=0, ycurr=0;
  
  /* Step through the path list */
  ipath=(struct segment *)rpath;

  do {
    if (ipath->type==LINETYPE){
      ipath->dest.x +=xcurr;
      ipath->dest.y +=ycurr;
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Line-Segment: -> (%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF));
#endif
      xcurr=ipath->dest.x;
      ycurr=ipath->dest.y;
    }
    if (ipath->type==MOVETYPE){
      ipath->dest.x +=xcurr;
      ipath->dest.y +=ycurr;
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Move-Segment: -> (%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF));
#endif
      xcurr=ipath->dest.x;
      ycurr=ipath->dest.y;
    }
    if (ipath->type==BEZIERTYPE){
      ((struct beziersegment *)ipath)->B.x +=xcurr;
      ((struct beziersegment *)ipath)->B.y +=ycurr;
      ((struct beziersegment *)ipath)->C.x +=xcurr;
      ((struct beziersegment *)ipath)->C.y +=ycurr;
      ipath->dest.x +=xcurr;
      ipath->dest.y +=ycurr;
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n",
            (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF));
#endif
      xcurr=ipath->dest.x;
      ycurr=ipath->dest.y;
    }
    ipath=ipath->link;
  } while (ipath!=NULL);
  
}

Here is the call graph for this function:

T1_OUTLINE* T1_ConcatOutlines ( T1_OUTLINE path1,
T1_OUTLINE path2 
)

Definition at line 462 of file t1outline.c.

{

  return( (T1_OUTLINE *) t1_Join( (struct segment *) path1,
                              (struct segment *) path2));
  
}

Here is the call graph for this function:

Definition at line 749 of file t1outline.c.

{

  return( (T1_OUTLINE *) CopyPath( (struct segment *)path));
         
}

Definition at line 538 of file t1outline.c.

{

  struct segment *ipath;

  /* Step through the path list */
  ipath=(struct segment *)path;

  do {
    if (ipath->type==LINETYPE){
      printf("Line-Segment: -> (%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF));
    }
    if (ipath->type==MOVETYPE){
      printf("Move-Segment: -> (%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF));
    }
    if (ipath->type==BEZIERTYPE){
      printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n",
            (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF));
    }
    ipath=ipath->link;
  } while (ipath!=NULL);
  
}

Here is the call graph for this function:

Definition at line 759 of file t1outline.c.

{
  
  KillPath( (struct segment *)path);
  return;
  
}
T1_OUTLINE* T1_GetCharOutline ( int  FontID,
char  charcode,
float  size,
T1_TMATRIX transform 
)

Definition at line 92 of file t1outline.c.

{
  int i;
  int mode;
  T1_PATHSEGMENT *charpath;
  struct XYspace *Current_S;
  unsigned char ucharcode;
  
  
  FONTSIZEDEPS *font_ptr;
  FONTPRIVATE  *fontarrayP;
  
  /* We don't implement underlining for characters, but the rasterer
     implements it. Thus, we use a modflag of constant 0 */
  int modflag=0;

  
  /* We return to this if something goes wrong deep in the rasterizer */
  if ((i=setjmp( stck_state))!=0) {
    T1_errno=T1ERR_TYPE1_ABORT;
    sprintf( err_warn_msg_buf, "t1_abort: Reason: %s",
            t1_get_abort_message( i));
    T1_PrintLog( "T1_GetCharOutline()", err_warn_msg_buf,
              T1LOG_ERROR);
    return( NULL);
  }

  ucharcode=(unsigned char)charcode;

  
  /* First, check for a correct ID */
  i=T1_CheckForFontID(FontID);
  if (i==-1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  /* if necessary load font into memory */
  if (i==0)
    if (T1_LoadFont(FontID))
      return(NULL);

  /* Check for valid size */
  if (size<=0.0){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NULL);
  }

  fontarrayP=&(pFontBase->pFontArray[FontID]);
  
  /* font is now loaded into memory =>
     Check for size: */
  if ((font_ptr=T1int_QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){
    font_ptr=T1int_CreateNewFontSize( FontID, size, NO_ANTIALIAS);
    if (font_ptr==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return(NULL);
    }
  }
  
  /* Setup an appropriate charspace matrix. Note that the rasterizer
     assumes vertical values with inverted sign! Transformation should
     create a copy of the local charspace matrix which then still has
     to be made permanent. */
  if (transform!=NULL) {
    Current_S=(struct XYspace *) 
      Permanent(Scale(Transform (font_ptr->pCharSpaceLocal,
                             transform->cxx, - transform->cxy,
                             transform->cyx, - transform->cyy),
                    DeviceSpecifics.scale_x, DeviceSpecifics.scale_y));
  }
  else{
    Current_S=(struct XYspace *)
      Permanent(Scale(Transform(font_ptr->pCharSpaceLocal,
                            1.0, 0.0, 0.0, -1.0),
                    DeviceSpecifics.scale_x, DeviceSpecifics.scale_y));
  }

  
  /* fnt_ptr now points to the correct FontSizeDeps-struct =>
     lets now raster the character */
  mode=0;
  charpath=(T1_PATHSEGMENT *)fontfcnB( FontID, modflag, Current_S,
                                   fontarrayP->pFontEnc,
                                   ucharcode, &mode,
                                   fontarrayP->pType1Data,
                                   DO_NOT_RASTER,0.0f);
  KillSpace (Current_S);

  return((T1_OUTLINE *)charpath);
}

Here is the call graph for this function:

T1_OUTLINE* T1_GetMoveOutline ( int  FontID,
int  deltax,
int  deltay,
int  modflag,
float  size,
T1_TMATRIX transform 
)

Definition at line 358 of file t1outline.c.

{
  int i;
  FONTSIZEDEPS *font_ptr;
  struct segment *path, *tmppath;
  struct XYspace *Current_S;
  psfont *FontP;
  float length;
  

  /* We return to this if something goes wrong deep in the rasterizer */
  if ((i=setjmp( stck_state))!=0) {
    T1_errno=T1ERR_TYPE1_ABORT;
    sprintf( err_warn_msg_buf, "t1_abort: Reason: %s",
            t1_get_abort_message( i));
    T1_PrintLog( "T1_GetMoveOutline()", err_warn_msg_buf,
              T1LOG_ERROR);
    return( NULL);
  }


  /* First, check for a correct ID */
  i=T1_CheckForFontID(FontID);
  if (i==-1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  /* if necessary load font into memory */
  if (i==0)
    if (T1_LoadFont(FontID))
      return(NULL);

  /* Check for valid size */
  if (size<=0.0){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NULL);
  }

  FontP=pFontBase->pFontArray[i].pType1Data;
  
  /* font is now loaded into memory =>
     Check for size: */
  if ((font_ptr=T1int_QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){
    font_ptr=T1int_CreateNewFontSize( FontID, size, NO_ANTIALIAS);
    if (font_ptr==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return(NULL);
    }
  }

  /* Setup an appropriate charspace matrix. Note that the rasterizer
     assumes vertical values with inverted sign! Transformation should
     create a copy of the local charspace matrix which then still has
     to be made permanent. */
  if (transform!=NULL){
    Current_S=(struct XYspace *) 
      Permanent(Scale(Transform (font_ptr->pCharSpaceLocal,
                             transform->cxx, - transform->cxy,
                             transform->cyx, - transform->cyy),
                    DeviceSpecifics.scale_x, DeviceSpecifics.scale_y));
  }
  else{
    Current_S=(struct XYspace *)
      Permanent(Scale(Transform(font_ptr->pCharSpaceLocal,
                            1.0, 0.0, 0.0, -1.0),
                    DeviceSpecifics.scale_x, DeviceSpecifics.scale_y));
  }
  
  
  path=(struct segment *)ILoc( Current_S, deltax, deltay); 

  /* Take care for underlining and such */
  length=(float) deltax;
  if (modflag & T1_UNDERLINE){
    tmppath=(struct segment *)Type1Line(FontP,Current_S,
                                   pFontBase->pFontArray[FontID].UndrLnPos,
                                   pFontBase->pFontArray[FontID].UndrLnThick,
                                   length);
    path=(struct segment *)Join(path,tmppath);
  }
  if (modflag & T1_OVERLINE){
    tmppath=(struct segment *)Type1Line(FontP,Current_S,
                                   pFontBase->pFontArray[FontID].OvrLnPos,
                                   pFontBase->pFontArray[FontID].OvrLnThick,
                                   length);
    path=(struct segment *)Join(path,tmppath);
  }
  if (modflag & T1_OVERSTRIKE){
    tmppath=(struct segment *)Type1Line(FontP,Current_S,
                                   pFontBase->pFontArray[FontID].OvrStrkPos,
                                   pFontBase->pFontArray[FontID].OvrStrkThick,
                                   length);
    path=(struct segment *)Join(path,tmppath);
  }
      
  KillSpace( Current_S);
  
  return( (T1_OUTLINE *)path);
  
}

Here is the call graph for this function:

T1_OUTLINE* T1_GetStringOutline ( int  FontID,
char *  string,
int  len,
long  spaceoff,
int  modflag,
float  size,
T1_TMATRIX transform 
)

Definition at line 188 of file t1outline.c.

{
  int i;
  int mode;
  /* initialize this to NULL just to be on the safe side */
  T1_PATHSEGMENT *charpath = NULL;
  struct XYspace *Current_S;
  int *kern_pairs;       /* use for accessing the kern pairs if kerning is
                         requested */
  int no_chars=0;        /* The number of characters in the string */
  static int lastno_chars=0;
  long spacewidth;       /* This is given to fontfcnb_string() */
  
  
  FONTSIZEDEPS *font_ptr;
  FONTPRIVATE  *fontarrayP;
  
  static int *pixel_h_anchor_corr=NULL;
  static int *flags=NULL;

  unsigned char *ustring;


  /* We return to this if something goes wrong deep in the rasterizer */
  if ((i=setjmp( stck_state))!=0) {
    T1_errno=T1ERR_TYPE1_ABORT;
    sprintf( err_warn_msg_buf, "t1_abort: Reason: %s",
            t1_get_abort_message( i));
    T1_PrintLog( "T1_GetStringOutline()", err_warn_msg_buf,
              T1LOG_ERROR);
    return( NULL);
  }

  /* force string elements into unsigned */
  ustring=(unsigned char*)string;
  
  /* First, check for a correct ID */
  i=T1_CheckForFontID(FontID);
  if (i==-1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  /* if necessary load font into memory */
  if (i==0)
    if (T1_LoadFont(FontID))
      return(NULL);

  /* If no AFM info is present, we return an error */
  if (pFontBase->pFontArray[FontID].pAFMData==NULL) {
    T1_errno=T1ERR_NO_AFM_DATA;
    return(NULL);
  }

  /* Check for valid size */
  if (size<=0.0){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NULL);
  }

  fontarrayP=&(pFontBase->pFontArray[FontID]);
  
  /* font is now loaded into memory =>
     Check for size: */
  if ((font_ptr=T1int_QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){
    font_ptr=T1int_CreateNewFontSize( FontID, size, NO_ANTIALIAS);
    if (font_ptr==NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      return(NULL);
    }
  }
  
  /* Now comes string specific stuff: Get length of string and create an
     array of integers where to store the bitmap positioning dimens: */
  if (len<0){  /* invalid length */
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NULL);
  }
  
  if (len==0) /* should be computed assuming "normal" 0-terminated string */
    no_chars=strlen(string);
  else        /* use value given on command line */
    no_chars=len;

  /* If necessary, allocate memory */
  if (no_chars>lastno_chars){
    if (pixel_h_anchor_corr!=NULL){
      free(pixel_h_anchor_corr);
    }
    if (flags!=NULL){
      free(flags);
    }
    
    pixel_h_anchor_corr=(int *)calloc(no_chars, sizeof(int));
    flags=(int *)calloc(no_chars, sizeof(int));
    lastno_chars=no_chars;
  }
  else{
    /* Reset flags  and position array */
    for (i=0; i<no_chars; i++){
      flags[i]=0;
      pixel_h_anchor_corr[i]=0;
    }
  }
  
  /* Setup an appropriate charspace matrix. Note that the rasterizer
     assumes vertical values with inverted sign! Transformation should
     create a copy of the local charspace matrix which then still has
     to be made permanent. */
  if (transform!=NULL){
    Current_S=(struct XYspace *) 
      Permanent(Scale(Transform (font_ptr->pCharSpaceLocal,
                             transform->cxx, - transform->cxy,
                             transform->cyx, - transform->cyy),
                    DeviceSpecifics.scale_x, DeviceSpecifics.scale_y));
  }
  else{
    Current_S=(struct XYspace *)
      Permanent(Scale(Transform(font_ptr->pCharSpaceLocal,
                            1.0, 0.0, 0.0, -1.0),
                    DeviceSpecifics.scale_x, DeviceSpecifics.scale_y));
  }
  
  /* Compute the correct spacewidth value (in charspace units). The
     value supplied by the user is interpreted as an offset in
     char space units:
     */
  spacewidth=T1_GetCharWidth(FontID,fontarrayP->space_position)+spaceoff;
  
  mode=0;
  kern_pairs=(int *)calloc(no_chars, sizeof(int));
  if ((modflag & T1_KERNING))
    for (i=0; i<no_chars -1; i++)
      kern_pairs[i]=T1_GetKerning( FontID, ustring[i], ustring[i+1]);
  charpath=(T1_PATHSEGMENT *) fontfcnB_string( FontID, modflag, Current_S,
                                          fontarrayP->pFontEnc,
                                          (unsigned char *)string,
                                          no_chars, &mode,
                                          fontarrayP->pType1Data,
                                          kern_pairs, spacewidth,
                                          DO_NOT_RASTER,0.0f);
  KillSpace (Current_S);
  
  /* In all cases, free memory for kerning pairs */
  free(kern_pairs);
  
  /* fill the string_glyph-structure */
  if (mode != 0) {
    sprintf( err_warn_msg_buf, "fontfcnB_string() set mode=%d", mode);
    T1_PrintLog( "T1_GetStringOutline()", err_warn_msg_buf, T1LOG_WARNING);
    T1_errno=mode;
    /* make sure to get rid of path if it's there */
    if (charpath){
      KillRegion (charpath);
    }
    return(NULL);
  }
  if (charpath == NULL){
    T1_PrintLog( "T1_GetStringOutline()", "path=NULL returned by fontfcnB_string()", T1LOG_WARNING);
    T1_errno=mode;
    return(NULL);
  }
  
  return( (T1_OUTLINE *)charpath);
}

Here is the call graph for this function:

void T1_ManipulatePath ( T1_OUTLINE path,
void(*)(fractpel *x, fractpel *y, int type manipulate 
)

Definition at line 693 of file t1outline.c.

{

  struct segment *ipath;
  
  
  /* Step through the path list */
  ipath=(struct segment *)path;

  do {
    if (ipath->type==LINETYPE){
      manipulate( &(ipath->dest.x), &ipath->dest.y, LINETYPE);
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Line-Segment: -> (%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF));
#endif
    }
    if (ipath->type==MOVETYPE){
      manipulate( &(ipath->dest.x), &ipath->dest.y, MOVETYPE);
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Move-Segment: -> (%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF));
#endif
    }
    if (ipath->type==BEZIERTYPE){
      manipulate( &((struct beziersegment *)ipath)->B.x,
                &((struct beziersegment *)ipath)->B.y,
                BEZIERTYPE);
      manipulate( &((struct beziersegment *)ipath)->C.x,
                &((struct beziersegment *)ipath)->C.y,
                BEZIERTYPE);
      manipulate( &((struct beziersegment *)ipath)->dest.x,
                &((struct beziersegment *)ipath)->dest.y,
                BEZIERTYPE);
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n",
            (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF));
#endif
    }
    ipath=ipath->link;
  } while (ipath!=NULL);
  
}

Here is the call graph for this function:

Definition at line 632 of file t1outline.c.

{
  
  struct segment *ipath;
  fractpel xcurr=0, ycurr=0;
  
  
  /* Step through the path list */
  ipath=(struct segment *)apath;
  
  do {
    if (ipath->type==LINETYPE){
      ipath->dest.x -=xcurr;
      ipath->dest.y -=ycurr;
      xcurr +=ipath->dest.x;
      ycurr +=ipath->dest.y;
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Line-Segment: -> (%f,%f), curr=(%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF),
            xcurr/(double)(0xFFFF), -ycurr/(double)(0xFFFF));
#endif
    }
    if (ipath->type==MOVETYPE){
      ipath->dest.x -=xcurr;
      ipath->dest.y -=ycurr;
      xcurr +=ipath->dest.x;
      ycurr +=ipath->dest.y;
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Move-Segment: -> (%f,%f), curr=(%f,%f)\n",
            (ipath->dest.x)/(double)(0xFFFF),
            -(ipath->dest.y)/(double)(0xFFFF),
            xcurr/(double)(0xFFFF), -ycurr/(double)(0xFFFF));
#endif
    }
    if (ipath->type==BEZIERTYPE){
      ipath->dest.x -=xcurr;
      ipath->dest.y -=ycurr;
      ((struct beziersegment *)ipath)->C.x -=xcurr;
      ((struct beziersegment *)ipath)->C.y -=ycurr;
      ((struct beziersegment *)ipath)->B.x -=xcurr;
      ((struct beziersegment *)ipath)->B.y -=ycurr;
      xcurr +=ipath->dest.x;
      ycurr +=ipath->dest.y;
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n",
            (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF),
            (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF),
            -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF));
#endif
    }
    ipath=ipath->link;
  } while (ipath!=NULL);
  
}

Here is the call graph for this function:

T1_OUTLINE* T1_ScaleOutline ( T1_OUTLINE path,
float  scale 
)

Definition at line 472 of file t1outline.c.

{
  struct segment *ipath;

  /* Step through the path list */
  ipath=(struct segment *)path;

  do {
    if (ipath->type==LINETYPE){
      ipath->dest.x = (fractpel) (ipath->dest.x * scale);
      ipath->dest.y = (fractpel) (ipath->dest.y * scale);
    }
    if (ipath->type==CONICTYPE){
      ((struct conicsegment *)ipath)->dest.x =
       (fractpel) ((struct conicsegment *)ipath)->dest.x * scale;
      ((struct conicsegment *)ipath)->dest.y =
       (fractpel) ((struct conicsegment *)ipath)->dest.y * scale;
      ((struct conicsegment *)ipath)->M.x =
       (fractpel) ((struct conicsegment *)ipath)->M.x * scale;
      ((struct conicsegment *)ipath)->M.y =
       (fractpel) ((struct conicsegment *)ipath)->M.y * scale;
    }
    if (ipath->type==MOVETYPE){
      ipath->dest.x = (fractpel) (ipath->dest.x * scale);
      ipath->dest.y = (fractpel) (ipath->dest.y * scale);
    }
    if (ipath->type==BEZIERTYPE){
      ((struct beziersegment *)ipath)->B.x =
       (fractpel) (((struct beziersegment *)ipath)->B.x * scale);
      ((struct beziersegment *)ipath)->B.y =
       (fractpel) (((struct beziersegment *)ipath)->B.y * scale);
      ((struct beziersegment *)ipath)->C.x =
       (fractpel) (((struct beziersegment *)ipath)->C.x * scale);
      ((struct beziersegment *)ipath)->C.y =
       (fractpel) (((struct beziersegment *)ipath)->C.y * scale);
      ((struct beziersegment *)ipath)->dest.x =
       (fractpel) (((struct beziersegment *)ipath)->dest.x * scale);
      ((struct beziersegment *)ipath)->dest.y =
       (fractpel) (((struct beziersegment *)ipath)->dest.y * scale);
    }
    if (ipath->type==HINTTYPE){
      ((struct hintsegment *)ipath)->dest.x =
       (fractpel) (((struct hintsegment *)ipath)->dest.x * scale);
      ((struct hintsegment *)ipath)->dest.y =
       (fractpel) (((struct hintsegment *)ipath)->dest.y * scale);
      ((struct hintsegment *)ipath)->ref.x =
       (fractpel) (((struct hintsegment *)ipath)->ref.x * scale);
      ((struct hintsegment *)ipath)->ref.y =
       (fractpel) (((struct hintsegment *)ipath)->ref.y * scale);
      ((struct hintsegment *)ipath)->width.x =
       (fractpel) (((struct hintsegment *)ipath)->width.x * scale);
      ((struct hintsegment *)ipath)->width.y =
       (fractpel) (((struct hintsegment *)ipath)->width.y * scale);
    }
    if (ipath->type==TEXTTYPE)
      ;
    ipath=ipath->link;

  } while (ipath!=NULL);
  
  return( path);
  
}