Back to index

tetex-bin  3.0
Classes | Defines | Typedefs | Functions | Variables
t1lib.h File Reference

Go to the source code of this file.

Classes

struct  GLYPH
struct  T1_TMATRIX
struct  BBox
struct  METRICSINFO
struct  T1_PATHPOINT
struct  pathsegment
struct  bezierpathsegment
struct  T1_COMP_PIECE
struct  T1_COMP_CHAR_INFO
struct  GLYPH.metrics

Defines

#define T1LIB_VERSION   5
#define T1LIB_REVISION   0
#define T1LIB_PATCHLEVEL   1
#define T1LIB_VERSIONSTRING   "5.0.1"
#define PAD(bits, pad)   (((bits)+(pad)-1)&-(pad))
#define NO_LOGFILE   0x0
#define LOGFILE   0x1
#define IGNORE_FONTDATABASE   0x2 /* Default is to read database */
#define IGNORE_CONFIGFILE   0x4 /* Default is to read config file */
#define T1_AA_CACHING   0x8 /* Cache aa-bytes */
#define T1_NO_AFM   0x10 /* Do not load or generate AFM data */
#define T1_YES   0x1
#define T1_NO   0x0
#define T1LOG_ERROR   1
#define T1LOG_WARNING   2
#define T1LOG_STATISTIC   3
#define T1LOG_DEBUG   4
#define T1_PFAB_PATH   0x01
#define T1_AFM_PATH   0x02
#define T1_ENC_PATH   0x04
#define T1_FDB_PATH   0x08
#define T1_APPEND_PATH   0x00
#define T1_PREPEND_PATH   0x01
#define T1_DEFAULT   0x0000
#define T1_UNDERLINE   0x0001
#define T1_OVERLINE   0x0002
#define T1_OVERSTRIKE   0x0004
#define T1_DOUBLEOVERSTRIKE   0x0008
#define T1_RIGHT_TO_LEFT   0x0010
#define T1_SUBSCRIPT   0x0100
#define T1_SUPERSCRIPT   0x0200
#define T1_STROKED   0x1000
#define T1_KERNING   0x2000
#define T1_AA_NONE   1
#define T1_AA_LOW   2
#define T1_AA_HIGH   4
#define T1ERR_SCAN_FONT_FORMAT   -5
#define T1ERR_SCAN_FILE_OPEN_ERR   -4
#define T1ERR_SCAN_OUT_OF_MEMORY   -3
#define T1ERR_SCAN_ERROR   -2
#define T1ERR_SCAN_FILE_EOF   -1
#define T1ERR_PATH_ERROR   1
#define T1ERR_PARSE_ERROR   2
#define T1ERR_TYPE1_ABORT   3
#define T1ERR_INVALID_FONTID   10
#define T1ERR_INVALID_PARAMETER   11
#define T1ERR_OP_NOT_PERMITTED   12
#define T1ERR_ALLOC_MEM   13
#define T1ERR_FILE_OPEN_ERR   14
#define T1ERR_UNSPECIFIED   15
#define T1ERR_NO_AFM_DATA   16
#define T1ERR_X11   17
#define T1ERR_COMPOSITE_CHAR   18
#define T1ERR_SCAN_ENCODING   19
#define T1_IGNORE_FORCEBOLD   0x0001
#define T1_IGNORE_FAMILYALIGNMENT   0x0002
#define T1_IGNORE_HINTING   0x0004
#define T1_DEBUG_LINE   0x0100
#define T1_DEBUG_REGION   0x0200
#define T1_DEBUG_PATH   0x0400
#define T1_DEBUG_FONT   0x0800
#define T1_DEBUG_HINT   0x1000
#define FRACTBITS   16 /* number of fractional bits in 'fractpel' */
#define T1_TOPATHPOINT(p)   (((long)p)<<FRACTBITS)
#define PPHALF   (1<<(FRACTBITS-1))
#define T1_NEARESTPOINT(fp)   (((fp)+PPHALF)>>FRACTBITS)
#define T1_PATHTYPE_LINE   0x10
#define T1_PATHTYPE_BEZIER   0x12
#define T1_PATHTYPE_MOVE   0x15
#define T1_SUBSET_DEFAULT   0x00
#define T1_SUBSET_FORCE_REENCODE   0x01
#define T1_SUBSET_SKIP_REENCODE   0x02
#define T1_SUBSET_ENCRYPT_BINARY   0x04
#define T1_SUBSET_ENCRYPT_NONE   0x08

Typedefs

typedef struct pathsegment T1_PATHSEGMENT
typedef struct bezierpathsegment T1_BEZIERSEGMENT
typedef T1_PATHSEGMENT T1_OUTLINE

Functions

voidT1_InitLib (int log)
int T1_CloseLib (void)
int T1_AddFont (char *fontfilename)
void T1_PrintLog (char *func_ident, char *msg_txt, int level,...)
void T1_SetLogLevel (int level)
int T1_CheckForInit (void)
int T1_CheckForFontID (int FontID)
char * T1_GetFontFileName (int FontID)
int T1_GetNoFonts (void)
int T1_SetDeviceResolutions (float x_res, float y_res)
int T1_CopyFont (int FontID)
int T1_QueryX11Support (void)
int T1_CheckEndian (void)
int T1_SetBitmapPad (int pad)
int T1_GetBitmapPad (void)
char * T1_GetLibIdent (void)
void T1_SetRasterFlags (int flags)
char * T1_GetAfmFileName (int FontID)
int T1_SetAfmFileName (int FontId, char *afm_name)
char * T1_GetFontFilePath (int FontID)
char * T1_GetAfmFilePath (int FontID)
const char * T1_StrError (int t1err)
int T1_DeleteSize (int FontID, float size)
int T1_DeleteAllSizes (int FontID)
int T1_FreeGlyph (GLYPH *glyph)
int T1_FreeCompCharData (T1_COMP_CHAR_INFO *cci)
int T1_DeleteFont (int FontID)
char ** T1_LoadEncoding (char *FileName)
int T1_DeleteEncoding (char **encoding)
int T1_ReencodeFont (int FontID, char **Encoding)
int T1_SetDefaultEncoding (char **encoding)
char * T1_GetEncodingScheme (int FontID)
int T1_SetFileSearchPath (int type, char *pathname)
int T1_AddToFileSearchPath (int pathtype, int mode, char *pathname)
char * T1_GetFileSearchPath (int type)
int T1_SetFontDataBase (char *filename)
int T1_AddFontDataBase (int mode, char *filename)
int T1_GetKerning (int FontID, char char1, char char2)
int T1_GetCharWidth (int FontID, char char1)
BBox T1_GetCharBBox (int FontID, char char1)
float T1_GetUnderlinePosition (int FontID)
float T1_GetUnderlineThickness (int FontID)
float T1_GetItalicAngle (int FontID)
int T1_GetIsFixedPitch (int FontID)
char * T1_GetFontName (int FontID)
char * T1_GetFullName (int FontID)
char * T1_GetFamilyName (int FontID)
char * T1_GetWeight (int FontID)
char * T1_GetVersion (int FontID)
char * T1_GetNotice (int FontID)
char * T1_GetCharName (int FontID, char char1)
int T1_QueryLigs (int FontID, char char1, char **successors, char **ligatures)
int T1_GetEncodingIndex (int FontID, char *char1)
intT1_GetEncodingIndices (int FontID, char *char1)
int T1_GetStringWidth (int FontID, char *string, int len, long spaceoff, int kerning)
BBox T1_GetStringBBox (int FontID, char *string, int len, long spaceoff, int kerning)
METRICSINFO T1_GetMetricsInfo (int FontID, char *string, int len, long spaceoff, int kerning)
BBox T1_GetFontBBox (int FontID)
char ** T1_GetAllCharNames (int FontID)
int T1_GetNoKernPairs (int FontID)
int T1_GetNoCompositeChars (int FontID)
int T1_QueryCompositeChar (int FontID, char char1)
T1_COMP_CHAR_INFOT1_GetCompCharData (int FontID, char char1)
T1_COMP_CHAR_INFOT1_GetCompCharDataByIndex (int FontID, int index)
int T1_IsInternalChar (int FontID, char char1)
int T1_LoadFont (int FontID)
voidT1_QueryFontSize (int FontID, float size, int aa)
GLYPHT1_SetChar (int FontID, char charcode, float size, T1_TMATRIX *transform)
GLYPHT1_SetString (int FontID, char *string, int len, long spaceoff, int modflag, float size, T1_TMATRIX *transform)
GLYPHT1_SetRect (int FontID, float size, float width, float height, T1_TMATRIX *transform)
GLYPHT1_CopyGlyph (GLYPH *glyph)
void T1_DumpGlyph (GLYPH *glyph)
GLYPHT1_ConcatGlyphs (GLYPH *glyph1, GLYPH *glyph2, int x_off, int y_off, int modflag)
void T1_DumpPixmap (GLYPH *glyph)
GLYPHT1_FillOutline (T1_OUTLINE *path, int modflag)
int T1_ExtendFont (int FontID, double extend)
int T1_SlantFont (int FontID, double slant)
int T1_TransformFont (int FontID, T1_TMATRIX *matrix)
double T1_GetExtend (int FontID)
double T1_GetSlant (int FontID)
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)
GLYPHT1_AASetChar (int FontID, char charcode, float size, T1_TMATRIX *transform)
GLYPHT1_AASetString (int FontID, char *string, int len, long spaceoff, int modflag, float size, T1_TMATRIX *transform)
GLYPHT1_AASetRect (int FontID, float size, float width, float height, T1_TMATRIX *transform)
int T1_AASetGrayValues (unsigned long white, unsigned long gray75, unsigned long gray50, unsigned long gray25, unsigned long black)
int T1_AAHSetGrayValues (unsigned long *grayvals)
int T1_AANSetGrayValues (unsigned long bg, unsigned long fg)
int T1_AAGetGrayValues (long *pgrayvals)
int T1_AAHGetGrayValues (long *pgrayvals)
int T1_AANGetGrayValues (long *pgrayvals)
int T1_AASetBitsPerPixel (int bpp)
int T1_AAGetBitsPerPixel (void)
int T1_AASetLevel (int level)
int T1_AAGetLevel (void)
GLYPHT1_AAFillOutline (T1_OUTLINE *path, int modflag)
int T1_AASetSmartLimits (float limit1, float limit2)
int T1_AASetSmartMode (int smart)
int T1_WriteAFMFallbackFile (int FontID)
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)(long *x, long *y, int type))
T1_OUTLINET1_CopyOutline (T1_OUTLINE *path)
void T1_FreeOutline (T1_OUTLINE *path)
char * T1_SubsetFont (int FontID, char *mask, unsigned int flags, int linewidth, unsigned long maxblocksize, unsigned long *bufsize)
char * T1_GetCharString (int FontID, char *charname, int *len)
int T1_GetlenIV (int FontID)

Variables

int T1_errno

Class Documentation

struct GLYPH

Definition at line 49 of file t1lib.h.

Class Members
char * bits
unsigned long bpp
struct GLYPH metrics
struct GLYPH metrics
void * pFontCacheInfo
struct T1_TMATRIX

Definition at line 67 of file t1lib.h.

Class Members
double cxx
double cxy
double cyx
double cyy
struct BBox

Definition at line 173 of file parseAFM.h.

Class Members
int llx
int lly
int urx
int ury
struct METRICSINFO

Definition at line 87 of file t1lib.h.

Collaboration diagram for METRICSINFO:
Class Members
BBox bbox
int * charpos
int numchars
int width
struct T1_PATHPOINT

Definition at line 197 of file t1lib.h.

Class Members
long x
long y
struct pathsegment

Definition at line 204 of file t1lib.h.

Collaboration diagram for pathsegment:
Class Members
unsigned char context
T1_PATHPOINT dest
unsigned char flag
struct pathsegment * last
struct pathsegment * link
short references
unsigned char size
char type
struct bezierpathsegment

Definition at line 216 of file t1lib.h.

Collaboration diagram for bezierpathsegment:
Class Members
T1_PATHPOINT B
T1_PATHPOINT C
unsigned char context
T1_PATHPOINT dest
unsigned char flag
T1_PATHSEGMENT * last
T1_PATHSEGMENT * link
short references
unsigned char size
char type
struct T1_COMP_PIECE

Definition at line 248 of file t1lib.h.

Class Members
int deltax
int deltay
int piece
struct T1_COMP_CHAR_INFO

Definition at line 257 of file t1lib.h.

Collaboration diagram for T1_COMP_CHAR_INFO:
Class Members
int compchar
int numPieces
T1_COMP_PIECE * pieces
struct GLYPH.metrics

Definition at line 52 of file t1lib.h.

Class Members
int advanceX
int advanceY
int ascent
int descent
int leftSideBearing
int rightSideBearing

Define Documentation

#define FRACTBITS   16 /* number of fractional bits in 'fractpel' */

Definition at line 190 of file t1lib.h.

#define IGNORE_CONFIGFILE   0x4 /* Default is to read config file */

Definition at line 105 of file t1lib.h.

#define IGNORE_FONTDATABASE   0x2 /* Default is to read database */

Definition at line 104 of file t1lib.h.

#define LOGFILE   0x1

Definition at line 103 of file t1lib.h.

#define NO_LOGFILE   0x0

Definition at line 102 of file t1lib.h.

#define PAD (   bits,
  pad 
)    (((bits)+(pad)-1)&-(pad))

Definition at line 98 of file t1lib.h.

#define PPHALF   (1<<(FRACTBITS-1))

Definition at line 193 of file t1lib.h.

#define T1_AA_CACHING   0x8 /* Cache aa-bytes */

Definition at line 106 of file t1lib.h.

#define T1_AA_HIGH   4

Definition at line 148 of file t1lib.h.

#define T1_AA_LOW   2

Definition at line 147 of file t1lib.h.

#define T1_AA_NONE   1

Definition at line 146 of file t1lib.h.

#define T1_AFM_PATH   0x02

Definition at line 125 of file t1lib.h.

#define T1_APPEND_PATH   0x00

Definition at line 128 of file t1lib.h.

#define T1_DEBUG_FONT   0x0800

Definition at line 185 of file t1lib.h.

#define T1_DEBUG_HINT   0x1000

Definition at line 186 of file t1lib.h.

#define T1_DEBUG_LINE   0x0100

Definition at line 182 of file t1lib.h.

#define T1_DEBUG_PATH   0x0400

Definition at line 184 of file t1lib.h.

#define T1_DEBUG_REGION   0x0200

Definition at line 183 of file t1lib.h.

#define T1_DEFAULT   0x0000

Definition at line 133 of file t1lib.h.

#define T1_DOUBLEOVERSTRIKE   0x0008

Definition at line 137 of file t1lib.h.

#define T1_ENC_PATH   0x04

Definition at line 126 of file t1lib.h.

#define T1_FDB_PATH   0x08

Definition at line 127 of file t1lib.h.

#define T1_IGNORE_FAMILYALIGNMENT   0x0002

Definition at line 179 of file t1lib.h.

#define T1_IGNORE_FORCEBOLD   0x0001

Definition at line 178 of file t1lib.h.

#define T1_IGNORE_HINTING   0x0004

Definition at line 180 of file t1lib.h.

#define T1_KERNING   0x2000

Definition at line 142 of file t1lib.h.

#define T1_NEARESTPOINT (   fp)    (((fp)+PPHALF)>>FRACTBITS)

Definition at line 194 of file t1lib.h.

#define T1_NO   0x0

Definition at line 113 of file t1lib.h.

#define T1_NO_AFM   0x10 /* Do not load or generate AFM data */

Definition at line 107 of file t1lib.h.

#define T1_OVERLINE   0x0002

Definition at line 135 of file t1lib.h.

#define T1_OVERSTRIKE   0x0004

Definition at line 136 of file t1lib.h.

#define T1_PATHTYPE_BEZIER   0x12

Definition at line 232 of file t1lib.h.

#define T1_PATHTYPE_LINE   0x10

Definition at line 231 of file t1lib.h.

#define T1_PATHTYPE_MOVE   0x15

Definition at line 233 of file t1lib.h.

#define T1_PFAB_PATH   0x01

Definition at line 124 of file t1lib.h.

#define T1_PREPEND_PATH   0x01

Definition at line 129 of file t1lib.h.

#define T1_RIGHT_TO_LEFT   0x0010

Definition at line 138 of file t1lib.h.

#define T1_STROKED   0x1000

Definition at line 141 of file t1lib.h.

#define T1_SUBSCRIPT   0x0100

Definition at line 139 of file t1lib.h.

#define T1_SUBSET_DEFAULT   0x00

Definition at line 237 of file t1lib.h.

#define T1_SUBSET_ENCRYPT_BINARY   0x04

Definition at line 240 of file t1lib.h.

#define T1_SUBSET_ENCRYPT_NONE   0x08

Definition at line 243 of file t1lib.h.

#define T1_SUBSET_FORCE_REENCODE   0x01

Definition at line 238 of file t1lib.h.

#define T1_SUBSET_SKIP_REENCODE   0x02

Definition at line 239 of file t1lib.h.

#define T1_SUPERSCRIPT   0x0200

Definition at line 140 of file t1lib.h.

#define T1_TOPATHPOINT (   p)    (((long)p)<<FRACTBITS)

Definition at line 192 of file t1lib.h.

#define T1_UNDERLINE   0x0001

Definition at line 134 of file t1lib.h.

#define T1_YES   0x1

Definition at line 112 of file t1lib.h.

#define T1ERR_ALLOC_MEM   13

Definition at line 168 of file t1lib.h.

#define T1ERR_COMPOSITE_CHAR   18

Definition at line 173 of file t1lib.h.

#define T1ERR_FILE_OPEN_ERR   14

Definition at line 169 of file t1lib.h.

#define T1ERR_INVALID_FONTID   10

Definition at line 165 of file t1lib.h.

#define T1ERR_INVALID_PARAMETER   11

Definition at line 166 of file t1lib.h.

#define T1ERR_NO_AFM_DATA   16

Definition at line 171 of file t1lib.h.

#define T1ERR_OP_NOT_PERMITTED   12

Definition at line 167 of file t1lib.h.

#define T1ERR_PARSE_ERROR   2

Definition at line 162 of file t1lib.h.

#define T1ERR_PATH_ERROR   1

Definition at line 161 of file t1lib.h.

#define T1ERR_SCAN_ENCODING   19

Definition at line 174 of file t1lib.h.

#define T1ERR_SCAN_ERROR   -2

Definition at line 158 of file t1lib.h.

#define T1ERR_SCAN_FILE_EOF   -1

Definition at line 159 of file t1lib.h.

#define T1ERR_SCAN_FILE_OPEN_ERR   -4

Definition at line 156 of file t1lib.h.

#define T1ERR_SCAN_FONT_FORMAT   -5

Definition at line 155 of file t1lib.h.

#define T1ERR_SCAN_OUT_OF_MEMORY   -3

Definition at line 157 of file t1lib.h.

#define T1ERR_TYPE1_ABORT   3

Definition at line 163 of file t1lib.h.

#define T1ERR_UNSPECIFIED   15

Definition at line 170 of file t1lib.h.

#define T1ERR_X11   17

Definition at line 172 of file t1lib.h.

#define T1LIB_PATCHLEVEL   1

Definition at line 44 of file t1lib.h.

#define T1LIB_REVISION   0

Definition at line 43 of file t1lib.h.

#define T1LIB_VERSION   5

Definition at line 42 of file t1lib.h.

#define T1LIB_VERSIONSTRING   "5.0.1"

Definition at line 45 of file t1lib.h.

#define T1LOG_DEBUG   4

Definition at line 120 of file t1lib.h.

#define T1LOG_ERROR   1

Definition at line 117 of file t1lib.h.

#define T1LOG_STATISTIC   3

Definition at line 119 of file t1lib.h.

#define T1LOG_WARNING   2

Definition at line 118 of file t1lib.h.


Typedef Documentation

Definition at line 229 of file t1lib.h.

typedef struct pathsegment T1_PATHSEGMENT

Function Documentation

GLYPH* T1_AAFillOutline ( T1_OUTLINE path,
int  modflag 
)

Definition at line 1672 of file t1aaset.c.

{
  
  GLYPH *glyph;   /* pointer to bitmap glyph */
  static GLYPH aaglyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */
  long asc, dsc, ht, wd;
  long i;
  long n_horz, n_horz_pad, n_vert, n_asc, n_dsc;
  long v_start, v_end;
  char *target_ptr;
  long offset;
  char *ptr;
  int y;
  long lsb, aalsb, aahstart;
  int memsize;
  LONG paddedW;
 

  /* Reset character glyph, if necessary */
  if (aaglyph.bits!=NULL){
    free(aaglyph.bits);
    aaglyph.bits=NULL;
  }
  aaglyph.metrics.leftSideBearing=0;
  aaglyph.metrics.rightSideBearing=0;
  aaglyph.metrics.advanceX=0;
  aaglyph.metrics.advanceY=0;
  aaglyph.metrics.ascent=0;
  aaglyph.metrics.descent=0;
  aaglyph.pFontCacheInfo=NULL;
  aaglyph.bpp=T1aa_bpp;


  /* First, scale outline appropriately: */
  path=T1_ScaleOutline( path, T1aa_level);
  
  /* Second, call routine to fill outline, all error checking is
     done in this function: */ 
  if ((glyph=T1_FillOutline( path, modflag))==NULL)
    return(NULL); /* An error occured */
  
  /* In case there are no black pixels, we simply set the dimensions and
     then return */
  if ( glyph->bits == NULL) {
    aaglyph.bits=NULL;
    aaglyph.metrics.leftSideBearing=0;
    aaglyph.metrics.rightSideBearing=0;
    aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
    aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
    aaglyph.metrics.ascent=0;
    aaglyph.metrics.descent=0;
    aaglyph.pFontCacheInfo=NULL;
    return(&aaglyph);
  }

  /* Get dimensions of bitmap: */
  asc=glyph->metrics.ascent;
  dsc=glyph->metrics.descent;
  lsb=glyph->metrics.leftSideBearing;
  ht=asc-dsc;
  wd=glyph->metrics.rightSideBearing-lsb;
  

  if (T1aa_level==T1_AA_NONE){
    /* we only convert bitmap to bytemap */
    aaglyph=*glyph;
    aaglyph.bpp=T1aa_bpp;
    /* Compute scanline length and such */
    n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3;
    /* Allocate memory for glyph, we alloc 12 bytes more to simplify
       subsampling! */
    memsize = n_horz_pad*ht*8;
    aaglyph.bits = (char *)malloc(memsize*sizeof( char) +12);
    if (aaglyph.bits == NULL) {
      T1_errno=T1ERR_ALLOC_MEM;
      return(NULL);
    }
    paddedW=PAD(wd,pFontBase->bitmap_pad)>>3;
    ptr=glyph->bits;
    target_ptr=aaglyph.bits;
    for (i = 0; i < ht; i++) {
      T1_DoLine ( wd, paddedW, ptr, target_ptr );
      ptr += paddedW;
      target_ptr += n_horz_pad;
    }
    return(&aaglyph);
  }
  

  /* Set some looping parameters for subsampling */
  if (lsb<0){
    aalsb=lsb/T1aa_level-1;
    aahstart=T1aa_level+(lsb%T1aa_level);
  }
  else{
    aalsb=lsb/T1aa_level;
    aahstart=lsb%T1aa_level;
  }
  
  /* The horizontal number of steps: */
  n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level;
  /* And the padded value */
  n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3;
  
  /* vertical number of steps: */
  if (asc % T1aa_level){ /* not aligned */
    if ( asc > 0){
      n_asc=asc/T1aa_level+1;
      v_start=asc % T1aa_level;
    }
    else{
      n_asc=asc/T1aa_level;
      v_start=T1aa_level + (asc % T1aa_level); 
    }
  }
  else{
    n_asc=asc/T1aa_level;
    v_start=T1aa_level;
  }
  if (dsc % T1aa_level){ /* not aligned */
    if ( dsc < 0){
      n_dsc=dsc/T1aa_level-1;
      v_end=-(dsc % T1aa_level);
    }
    else{
      n_dsc=dsc/T1aa_level;
      v_end=T1aa_level - (dsc % T1aa_level);
    }
  }
  else{
    n_dsc=dsc/T1aa_level;
    v_end=T1aa_level;
  }
  /* the total number of lines: */
  n_vert=n_asc-n_dsc;
  
  /* Allocate memory for glyph */
  memsize = n_horz_pad*n_vert;
  
  aaglyph.bits = (char *)malloc(memsize*sizeof( char)+12);
  if (aaglyph.bits == NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    return(NULL);
  }
  
  paddedW=PAD(wd,pFontBase->bitmap_pad)/8;
  offset=0;
  target_ptr=aaglyph.bits;
  
  /* We must check for n_vert==1 because the computation above is not
     valid in this case */
  if (n_vert==1)
    v_start=v_start < v_end ? v_start : v_end;

  ptr = glyph->bits;
  for (i = 0; i < n_vert; i++) {
    if (i==0)
      y=v_start;
    else if (i==n_vert-1)
      y=v_end;
    else
      y=T1aa_level;
    T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart );
    ptr += y * paddedW;
    target_ptr += n_horz_pad;
  }
  
  /* .. and set them in aaglyph */
  aaglyph.metrics.leftSideBearing=aalsb;
  aaglyph.metrics.rightSideBearing=aalsb + n_horz;
  aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
  aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
  aaglyph.metrics.ascent=n_asc;
  aaglyph.metrics.descent=n_dsc;
  aaglyph.pFontCacheInfo=NULL;

  return(&aaglyph);
}

Here is the call graph for this function:

Definition at line 1629 of file t1aaset.c.

{
  return( T1aa_bpp);
  
}
int T1_AAGetGrayValues ( long *  pgrayvals)

Definition at line 1524 of file t1aaset.c.

{
  int i;
  
  if (T1_CheckForInit()) {
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }

  if (pgrayvals==NULL) {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(-1);
  }
  
  for ( i=0; i<5; i++) { /* bg (i=0)  to fg (i=4) */
    pgrayvals[i]=gv[i];
  }
  return( 0);
  
}

Here is the call graph for this function:

Definition at line 1665 of file t1aaset.c.

{
  return( T1aa_level);
}

Here is the caller graph for this function:

int T1_AAHGetGrayValues ( long *  pgrayvals)

Definition at line 1550 of file t1aaset.c.

{
  int i;

  if (T1_CheckForInit()) {
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }

  if (pgrayvals==NULL) {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(-1);
  }

  for ( i=0; i<17; i++) { /* bg (i=0)  to fg (i=16) */
    pgrayvals[i]=gv[i];
  }
  return( 0);
}

Here is the call graph for this function:

int T1_AAHSetGrayValues ( unsigned long *  grayvals)

Definition at line 1470 of file t1aaset.c.

{
  int i;
  
  if (T1_CheckForInit()){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }

  /* 0==white(background) ... 16==black(foreground) */
  for (i=0; i<17; i++){
    gv_h[i]=(unsigned T1_AA_TYPE32)grayvals[i];
  }
  

  T1aa_bg=grayvals[0];
  
  if ((T1_AAInit( T1_AA_HIGH)))
    return(-1);
  return(0);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_AANGetGrayValues ( long *  pgrayvals)

Definition at line 1575 of file t1aaset.c.

{

  if (T1_CheckForInit()) {
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }

  if (pgrayvals==NULL) {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(-1);
  }
  pgrayvals[0]=gv[0]; /* background */
  pgrayvals[1]=gv[1]; /* foreground */
  return( 0);
}

Here is the call graph for this function:

int T1_AANSetGrayValues ( unsigned long  bg,
unsigned long  fg 
)

Definition at line 1500 of file t1aaset.c.

{
  
  if (T1_CheckForInit()){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }

  gv_n[0]=bg;
  gv_n[1]=fg;
  
  T1aa_bg=bg;
  
  if ((T1_AAInit( T1_AA_NONE)))
    return(-1);
  return(0);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1597 of file t1aaset.c.

{
  
  if (T1_CheckForInit()){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }
  

  /* T1aa_level = 0; */

  if (bpp==8){
    T1aa_bpp=8;
    return(0);
  }
  if (bpp==16){
    T1aa_bpp=16;
    return(0);
  }
  if ((bpp==32)|(bpp==24)){
    T1aa_bpp=32;
    return(0);
  }

  T1_errno=T1ERR_INVALID_PARAMETER;
  return(-1);
}

Here is the call graph for this function:

GLYPH* T1_AASetChar ( int  FontID,
char  charcode,
float  size,
T1_TMATRIX transform 
)

Definition at line 746 of file t1aaset.c.

{
  
  GLYPH *glyph;   /* pointer to bitmap glyph */
  static GLYPH aaglyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */
  long asc, dsc, ht, wd;
  long i;
  long n_horz, n_horz_pad, n_vert, n_asc, n_dsc;
  long v_start, v_end;
  char *target_ptr;
  long offset;
  char *ptr;
  int y;
  long lsb, aalsb, aahstart;
  int memsize;
  LONG paddedW;
  int savelevel;
  FONTSIZEDEPS *font_ptr=NULL;
  unsigned char ucharcode;
  

  /* Reset character glyph, if necessary */
  if (aaglyph.bits!=NULL){
    free(aaglyph.bits);
    aaglyph.bits=NULL;
  }
  aaglyph.metrics.leftSideBearing=0;
  aaglyph.metrics.rightSideBearing=0;
  aaglyph.metrics.advanceX=0;
  aaglyph.metrics.advanceY=0;
  aaglyph.metrics.ascent=0;
  aaglyph.metrics.descent=0;
  aaglyph.pFontCacheInfo=NULL;
  aaglyph.bpp=T1aa_bpp;


  ucharcode=charcode;
  
  /* Check for smart antialiasing */
  savelevel=T1aa_level;
  if (T1aa_SmartOn){
    if (size>=T1aa_smartlimit2) {
      T1aa_level=T1_AA_NONE;
    }
    else if (size>=T1aa_smartlimit1) {
      T1aa_level=T1_AA_LOW;
    }
    else {
      T1aa_level=T1_AA_HIGH;
    }
  }


  /* The following code is only exectued if caching of antialiased
     chracters is enabled. */
  /* Check if char is in cache */
  if ((pFontBase->t1lib_flags & T1_AA_CACHING)) {
    if (transform==NULL){
      /* if size/aa is not existent we create it */
      if ((font_ptr=T1int_QueryFontSize( FontID, size, T1aa_level))==NULL){
       /* We create the required size struct and leave the rest
          for T1_SetChar() */
       font_ptr=T1int_CreateNewFontSize( FontID, size, T1aa_level);
       if (font_ptr==NULL){
         T1_errno=T1ERR_ALLOC_MEM;
         T1aa_level=savelevel;
         return(NULL);
       }
      }
      else {/* size is already existent in cache */
       if (font_ptr->pFontCache[ucharcode].bits != NULL){
         /* Character is already in Chache -> create a copy of cache
            and return a pointer to the result: */
         memcpy( &aaglyph, &(font_ptr->pFontCache[ucharcode]), sizeof(GLYPH));
         memsize = (aaglyph.metrics.ascent-aaglyph.metrics.descent) *
           PAD((aaglyph.metrics.rightSideBearing-aaglyph.metrics.leftSideBearing) *
              T1aa_bpp,pFontBase->bitmap_pad)/8;
         aaglyph.bits = (char *)malloc(memsize*sizeof( char));
         if (aaglyph.bits == NULL){
           T1_errno=T1ERR_ALLOC_MEM;
           T1aa_level=savelevel;
           return(NULL);
         }
         memcpy( aaglyph.bits, font_ptr->pFontCache[ucharcode].bits, memsize);
         return(&(aaglyph));
       }
      }
    } /* (transform==NULL) */ 
  } /* T1_AA_CACHING */
  

  /* First, call routine to rasterize character, all error checking is
     done in this function: */ 
  if ((glyph=T1_SetChar( FontID, charcode, T1aa_level*size, transform))==NULL){
    /* restore level */
    T1aa_level=savelevel;
    return(NULL); /* An error occured */
  }
  
  /* In case there are no black pixels, we simply set the dimensions and
     then return */
  if ( glyph->bits == NULL) {
    aaglyph.bits=NULL;
    aaglyph.metrics.leftSideBearing=0;
    aaglyph.metrics.rightSideBearing=0;
    aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
    aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
    aaglyph.metrics.ascent=0;
    aaglyph.metrics.descent=0;
    aaglyph.pFontCacheInfo=NULL;
    /* restore level and return */
    T1aa_level=savelevel;
    return(&aaglyph);
  }

  /* Get dimensions of bitmap: */
  asc=glyph->metrics.ascent;
  dsc=glyph->metrics.descent;
  lsb=glyph->metrics.leftSideBearing;
  ht=asc-dsc;
  wd=glyph->metrics.rightSideBearing-lsb;

  
  
  if (T1aa_level==T1_AA_NONE){
    /* we only convert bitmap to bytemap */
    aaglyph=*glyph;
    aaglyph.bpp=T1aa_bpp;
    /* Compute scanline length and such */
    n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3;
    /* Allocate memory for glyph */
    memsize = n_horz_pad*ht*8;
    /*    aaglyph.bits = (char *)malloc(memsize*sizeof( char)); */
    aaglyph.bits = (char *)malloc(memsize*sizeof( char));
    if (aaglyph.bits == NULL) {
      T1_errno=T1ERR_ALLOC_MEM;
      /* restore level */
      T1aa_level=savelevel;
      return(NULL);
    }
    paddedW=PAD(wd,pFontBase->bitmap_pad)>>3;
    ptr=glyph->bits;
    target_ptr=aaglyph.bits;
    for (i = 0; i < ht; i++) {
      T1_DoLine ( wd, paddedW, ptr, target_ptr );
      ptr += paddedW;
      target_ptr += n_horz_pad;
    }
    /* restore level */
    T1aa_level=savelevel;
    return(&aaglyph);
  }
  

  /* Set some looping parameters for subsampling */
  if (lsb<0){
    aalsb=lsb/T1aa_level-1;
    aahstart=T1aa_level+(lsb%T1aa_level);
  }
  else{
    aalsb=lsb/T1aa_level;
    aahstart=lsb%T1aa_level;
  }
  
  /* The horizontal number of steps: */
  n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level;
  /* And the padded value */
  n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3;

  /* vertical number of steps: */
  if (asc % T1aa_level){ /* not aligned */
    if ( asc > 0){
      n_asc=asc/T1aa_level+1;
      v_start=asc % T1aa_level;
    }
    else{
      n_asc=asc/T1aa_level;
      v_start=T1aa_level + (asc % T1aa_level); 
    }
  }
  else{
    n_asc=asc/T1aa_level;
    v_start=T1aa_level;
  }
  if (dsc % T1aa_level){ /* not aligned */
    if ( dsc < 0){
      n_dsc=dsc/T1aa_level-1;
      v_end=-(dsc % T1aa_level);
    }
    else{
      n_dsc=dsc/T1aa_level;
      v_end=T1aa_level - (dsc % T1aa_level);
    }
  }
  else{
    n_dsc=dsc/T1aa_level;
    v_end=T1aa_level;
  }
  /* the total number of lines: */
  n_vert=n_asc-n_dsc;
  
  /* Allocate memory for glyph */
  memsize = n_horz_pad*n_vert;

  /* Note: we allocate 12 bytes more than necessary */
  aaglyph.bits = (char *)malloc(memsize*sizeof( char) +12);
  if (aaglyph.bits == NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    /* restore level */
    T1aa_level=savelevel;
    return(NULL);
  }
  

  paddedW=PAD(wd,pFontBase->bitmap_pad)/8;
  offset=0;
  target_ptr=aaglyph.bits;
  
  /* We must check for n_vert==1 because the computation above is not
     valid in this case */
  if (n_vert==1)
    v_start=v_start < v_end ? v_start : v_end;

  ptr = glyph->bits;
  for (i = 0; i < n_vert; i++) {
    if (i==0)
      y=v_start;
    else if (i==n_vert-1)
      y=v_end;
    else
      y=T1aa_level;
    T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart );
    ptr += y * paddedW;
    target_ptr += n_horz_pad;
  }
  
  /* .. and set them in aaglyph */
  aaglyph.metrics.leftSideBearing=aalsb;
  aaglyph.metrics.rightSideBearing=aalsb + n_horz;
  aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
  aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
  aaglyph.metrics.ascent=n_asc;
  aaglyph.metrics.descent=n_dsc;
  aaglyph.pFontCacheInfo=NULL;

  
  if ((pFontBase->t1lib_flags & T1_AA_CACHING) && (transform==NULL)) {
    /* Put char into cache area */
    memcpy( &(font_ptr->pFontCache[ucharcode]), &aaglyph, sizeof(GLYPH));
    font_ptr->pFontCache[ucharcode].bits = (char *)malloc(memsize*sizeof( char));
    if (font_ptr->pFontCache[ucharcode].bits == NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      T1aa_level=savelevel;
      return(NULL);
    }
    memcpy( font_ptr->pFontCache[ucharcode].bits, aaglyph.bits, memsize);
  }
  
  /* restore level */
  T1aa_level=savelevel;

  return(&aaglyph);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_AASetGrayValues ( unsigned long  white,
unsigned long  gray75,
unsigned long  gray50,
unsigned long  gray25,
unsigned long  black 
)

Definition at line 1438 of file t1aaset.c.

{
  
  if (T1_CheckForInit()){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }
  
  gv[4]=(unsigned T1_AA_TYPE32)black;    /* black value */
  gv[3]=(unsigned T1_AA_TYPE32)gray25;   /* gray 25% value */
  gv[2]=(unsigned T1_AA_TYPE32)gray50;   /* gray 50% value */   
  gv[1]=(unsigned T1_AA_TYPE32)gray75;   /* gray 75% value */
  gv[0]=(unsigned T1_AA_TYPE32)white;    /* white value */
  
  T1aa_bg=white;
  
  if ((T1_AAInit( T1_AA_LOW)))
    return(-1);
  return(0);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_AASetLevel ( int  level)

Definition at line 1637 of file t1aaset.c.

{
  
   if (T1_CheckForInit()){
     T1_errno=T1ERR_OP_NOT_PERMITTED;
     return(-1);
   }

   if (level==T1_AA_LOW){
     T1aa_level=T1_AA_LOW;
     return(0);
   }
   else if (level==T1_AA_HIGH){
     T1aa_level=T1_AA_HIGH;
     return(0);
   }
   else if (level==T1_AA_NONE){
     T1aa_level=T1_AA_NONE;
     return(0);
   }
   
   T1_errno=T1ERR_INVALID_PARAMETER;
   return(-1);
   
}

Here is the call graph for this function:

GLYPH* T1_AASetRect ( int  FontID,
float  size,
float  width,
float  height,
T1_TMATRIX transform 
)

Definition at line 1224 of file t1aaset.c.

{
  GLYPH *glyph;   /* pointer to bitmap glyph */
  static GLYPH aaglyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */
  long asc, dsc, ht, wd;
  long i;
  long n_horz, n_horz_pad, n_vert, n_asc, n_dsc;
  long v_start, v_end;
  char *target_ptr;
  long offset;
  char *ptr;
  int y;
  long lsb, aalsb, aahstart;
  int memsize;
  LONG paddedW;
  int savelevel;
  

  /* Reset character glyph, if necessary */
  if (aaglyph.bits!=NULL){
    free(aaglyph.bits);
    aaglyph.bits=NULL;
  }
  aaglyph.metrics.leftSideBearing=0;
  aaglyph.metrics.rightSideBearing=0;
  aaglyph.metrics.advanceX=0;
  aaglyph.metrics.advanceY=0;
  aaglyph.metrics.ascent=0;
  aaglyph.metrics.descent=0;
  aaglyph.pFontCacheInfo=NULL;
  aaglyph.bpp=T1aa_bpp;


  /* Check for smart antialiasing */
  savelevel=T1aa_level;
  if (T1aa_SmartOn){
    if (size>=T1aa_smartlimit2) {
      T1aa_level=T1_AA_NONE;
    }
    else if (size>=T1aa_smartlimit1) {
      T1aa_level=T1_AA_LOW;
    }
    else {
      T1aa_level=T1_AA_HIGH;
    }
  }


  /* First, call routine to rasterize character, all error checking is
     done in this function: */ 
  if ((glyph=T1_SetRect( FontID, T1aa_level*size, width, height, transform))==NULL){
    /* restore level */
    T1aa_level=savelevel;
    return(NULL); /* An error occured */
  }
  
  /* In case there are no black pixels, we simply set the dimensions and
     then return */
  if ( glyph->bits == NULL) {
    aaglyph.bits=NULL;
    aaglyph.metrics.leftSideBearing=0;
    aaglyph.metrics.rightSideBearing=0;
    aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
    aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
    aaglyph.metrics.ascent=0;
    aaglyph.metrics.descent=0;
    aaglyph.pFontCacheInfo=NULL;
    /* restore level and return */
    T1aa_level=savelevel;
    return(&aaglyph);
  }

  /* Get dimensions of bitmap: */
  asc=glyph->metrics.ascent;
  dsc=glyph->metrics.descent;
  lsb=glyph->metrics.leftSideBearing;
  ht=asc-dsc;
  wd=glyph->metrics.rightSideBearing-lsb;
  
  if (T1aa_level==T1_AA_NONE){
    /* we only convert bitmap to bytemap */
    aaglyph=*glyph;
    aaglyph.bpp=T1aa_bpp;
    /* Compute scanline length and such */
    n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3;
    /* Allocate memory for glyph */
    memsize = n_horz_pad*ht*8;
    /*    aaglyph.bits = (char *)malloc(memsize*sizeof( char)); */
    aaglyph.bits = (char *)malloc(memsize*sizeof( char));
    if (aaglyph.bits == NULL) {
      T1_errno=T1ERR_ALLOC_MEM;
      /* restore level */
      T1aa_level=savelevel;
      return(NULL);
    }
    paddedW=PAD(wd,pFontBase->bitmap_pad)>>3;
    ptr=glyph->bits;
    target_ptr=aaglyph.bits;
    for (i = 0; i < ht; i++) {
      T1_DoLine ( wd, paddedW, ptr, target_ptr );
      ptr += paddedW;
      target_ptr += n_horz_pad;
    }
    /* restore level */
    T1aa_level=savelevel;
    return(&aaglyph);
  }
  

  /* Set some looping parameters for subsampling */
  if (lsb<0){
    aalsb=lsb/T1aa_level-1;
    aahstart=T1aa_level+(lsb%T1aa_level);
  }
  else{
    aalsb=lsb/T1aa_level;
    aahstart=lsb%T1aa_level;
  }
  
  /* The horizontal number of steps: */
  n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level;
  /* And the padded value */
  n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3;

  /* vertical number of steps: */
  if (asc % T1aa_level){ /* not aligned */
    if ( asc > 0){
      n_asc=asc/T1aa_level+1;
      v_start=asc % T1aa_level;
    }
    else{
      n_asc=asc/T1aa_level;
      v_start=T1aa_level + (asc % T1aa_level); 
    }
  }
  else{
    n_asc=asc/T1aa_level;
    v_start=T1aa_level;
  }
  if (dsc % T1aa_level){ /* not aligned */
    if ( dsc < 0){
      n_dsc=dsc/T1aa_level-1;
      v_end=-(dsc % T1aa_level);
    }
    else{
      n_dsc=dsc/T1aa_level;
      v_end=T1aa_level - (dsc % T1aa_level);
    }
  }
  else{
    n_dsc=dsc/T1aa_level;
    v_end=T1aa_level;
  }
  /* the total number of lines: */
  n_vert=n_asc-n_dsc;
  
  /* Allocate memory for glyph */
  memsize = n_horz_pad*n_vert;

  /* Note: we allocate 12 bytes more than necessary */
  aaglyph.bits = (char *)malloc(memsize*sizeof( char) +12);
  if (aaglyph.bits == NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    /* restore level */
    T1aa_level=savelevel;
    return(NULL);
  }
  

  paddedW=PAD(wd,pFontBase->bitmap_pad)/8;
  offset=0;
  target_ptr=aaglyph.bits;
  
  /* We must check for n_vert==1 because the computation above is not
     valid in this case */
  if (n_vert==1)
    v_start=v_start < v_end ? v_start : v_end;

  ptr = glyph->bits;
  for (i = 0; i < n_vert; i++) {
    if (i==0)
      y=v_start;
    else if (i==n_vert-1)
      y=v_end;
    else
      y=T1aa_level;
    T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart );
    ptr += y * paddedW;
    target_ptr += n_horz_pad;
  }
  
  /* .. and set them in aaglyph */
  aaglyph.metrics.leftSideBearing=aalsb;
  aaglyph.metrics.rightSideBearing=aalsb + n_horz;
  aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
  aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
  aaglyph.metrics.ascent=n_asc;
  aaglyph.metrics.descent=n_dsc;
  aaglyph.pFontCacheInfo=NULL;

  /* restore level */
  T1aa_level=savelevel;

  return(&aaglyph);

}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_AASetSmartLimits ( float  limit1,
float  limit2 
)

Definition at line 1855 of file t1aaset.c.

{

  if (limit1 > 0.0 && limit2 > 0.0 && limit2 >= limit2) {
    T1aa_smartlimit1=limit1;
    T1aa_smartlimit2=limit2;
    return( 0);
  }
  else{
    T1_errno=T1ERR_INVALID_PARAMETER;
    return( -1);
  }
}

Definition at line 1872 of file t1aaset.c.

{

  if (smart==T1_YES) {
    T1aa_SmartOn=1;
  }
  else if (smart==T1_NO) {
    T1aa_SmartOn=0;
  }
  else {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return( -1);
  }
  return( 0);
}
GLYPH* T1_AASetString ( int  FontID,
char *  string,
int  len,
long  spaceoff,
int  modflag,
float  size,
T1_TMATRIX transform 
)

Definition at line 1015 of file t1aaset.c.

{
  GLYPH *glyph;   /* pointer to bitmap glyph */
  static GLYPH aastring_glyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */
  long asc, dsc, ht, wd;
  long i;
  long n_horz, n_horz_pad, n_vert, n_asc, n_dsc;
  long v_start, v_end;
  char *target_ptr;
  long offset;
  char *ptr;
  int y;
  long lsb, aalsb, aahstart;
  int memsize;
  LONG paddedW;
  int savelevel;
  
  
  /* Reset character glyph, if necessary */
  if (aastring_glyph.bits!=NULL){
    free(aastring_glyph.bits);
    aastring_glyph.bits=NULL;
  }
  aastring_glyph.metrics.leftSideBearing=0;
  aastring_glyph.metrics.rightSideBearing=0;
  aastring_glyph.metrics.advanceX=0;
  aastring_glyph.metrics.advanceY=0;
  aastring_glyph.metrics.ascent=0;
  aastring_glyph.metrics.descent=0;
  aastring_glyph.pFontCacheInfo=NULL;
  aastring_glyph.bpp=T1aa_bpp;
  

  /* Check for smart antialiasing */
  savelevel=T1aa_level;
  if (T1aa_SmartOn){
    if (size>=T1aa_smartlimit2) {
      T1aa_level=T1_AA_NONE;
    }
    else if (size>=T1aa_smartlimit1) {
      T1aa_level=T1_AA_LOW;
    }
    else {
      T1aa_level=T1_AA_HIGH;
    }
  }
    
  /* First, call routine to rasterize character, all error checking is
     done in this function: */ 
  if ((glyph=T1_SetString( FontID, string, len, spaceoff,
                        modflag, T1aa_level*size, transform))==NULL){
    /* restore level */
    T1aa_level=savelevel;
    return(NULL); /* An error occured */
  }
  
  /* In case there are no black pixels, we simply set the dimensions and
     then return */
  if ( glyph->bits == NULL) {
    aastring_glyph.bits=NULL;
    aastring_glyph.metrics.leftSideBearing=0;
    aastring_glyph.metrics.rightSideBearing=0;
    aastring_glyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
    aastring_glyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
    aastring_glyph.metrics.ascent=0;
    aastring_glyph.metrics.descent=0;
    aastring_glyph.pFontCacheInfo=NULL;
    /* restore level and return */
    T1aa_level=savelevel;
    return(&aastring_glyph);
  }


  /* Get dimensions of bitmap: */
  asc=glyph->metrics.ascent;
  dsc=glyph->metrics.descent;
  lsb=glyph->metrics.leftSideBearing;
  ht=asc-dsc;
  wd=glyph->metrics.rightSideBearing-lsb;
  
  if (T1aa_level==T1_AA_NONE){
    /* we only convert bitmap to bytemap */
    aastring_glyph=*glyph;
    aastring_glyph.bpp=T1aa_bpp;
    /* Compute scanline length and such */
    n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3;
    /* Allocate memory for glyph */
    memsize = n_horz_pad*ht*8;
    aastring_glyph.bits = (char *)malloc(memsize*sizeof( char));
    if (aastring_glyph.bits == NULL) {
      T1_errno=T1ERR_ALLOC_MEM;
      /* restore level */
      T1aa_level=savelevel;
      return(NULL);
    }
    paddedW=PAD(wd,pFontBase->bitmap_pad)>>3;
    ptr=glyph->bits;
    target_ptr=aastring_glyph.bits;
    for (i = 0; i < ht; i++) {
      T1_DoLine ( wd, paddedW, ptr, target_ptr );
      ptr += paddedW;
      target_ptr += n_horz_pad;
    }
    /* restore level */
    T1aa_level=savelevel;
    return(&aastring_glyph);
  }
  

  /* Set some looping parameters for subsampling */
  if (lsb<0){
    aalsb=lsb/T1aa_level-1;
    aahstart=T1aa_level+(lsb%T1aa_level);
  }
  else{
    aalsb=lsb/T1aa_level;
    aahstart=lsb%T1aa_level;
  }
  
  /* The horizontal number of steps: */
  n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level;
  /* And the padded value */
  n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3;

  /* vertical number of steps: */
  if (asc % T1aa_level){ /* not aligned */
    if ( asc > 0){
      n_asc=asc/T1aa_level+1;
      v_start=asc % T1aa_level;
    }
    else{
      n_asc=asc/T1aa_level;
      v_start=T1aa_level + (asc % T1aa_level); 
    }
  }
  else{
    n_asc=asc/T1aa_level;
    v_start=T1aa_level;
  }
  if (dsc % T1aa_level){ /* not aligned */
    if ( dsc < 0){
      n_dsc=dsc/T1aa_level-1;
      v_end=-(dsc % T1aa_level);
    }
    else{
      n_dsc=dsc/T1aa_level;
      v_end=T1aa_level - (dsc % T1aa_level);
    }
  }
  else{
    n_dsc=dsc/T1aa_level;
    v_end=T1aa_level;
  }
  /* the total number of lines: */
  n_vert=n_asc-n_dsc;
  
  /* Allocate memory for glyph */
  memsize = n_horz_pad*n_vert;

  /* Note: we allocate 12 bytes more than necessary */ 
  aastring_glyph.bits = (char *)malloc(memsize*sizeof( char) +12);
  if (aastring_glyph.bits == NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    return(NULL);
  }
  
  paddedW=PAD(wd,pFontBase->bitmap_pad)/8;
  offset=0;
  target_ptr=aastring_glyph.bits;
  
  /* We must check for n_vert==1 because the computation above is not
     valid in this case */
  if (n_vert==1)
    v_start=v_start < v_end ? v_start : v_end;
  
  ptr = glyph->bits;
  for (i = 0; i < n_vert; i++) {
    if (i==0)
      y=v_start;
    else if (i==n_vert-1)
      y=v_end;
    else
      y=T1aa_level;
    T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart );
    ptr += y * paddedW;
    target_ptr += n_horz_pad;
  }
  
  /* .. and set them in aastring_glyph */
  aastring_glyph.metrics.leftSideBearing=aalsb;
  aastring_glyph.metrics.rightSideBearing=aalsb + n_horz;
  aastring_glyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5);
  aastring_glyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5);
  aastring_glyph.metrics.ascent=n_asc;
  aastring_glyph.metrics.descent=n_dsc;
  aastring_glyph.pFontCacheInfo=NULL;

  /* restore level */
  T1aa_level=savelevel;

  return(&aastring_glyph);
}

Here is the call graph for this function:

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);
  
}
int T1_AddFont ( char *  fontfilename)

Definition at line 541 of file t1base.c.

{
  
  char *FullName;
  FONTPRIVATE *save_ptr;
  int i;
  int new_ID;
  
  
  if (fontfilename==NULL){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(-1);
  }
  
  /* Check for existence of fontfile */
  if ((FullName=intT1_Env_GetCompletePath(fontfilename,T1_PFAB_ptr))==NULL) {
    T1_errno=T1ERR_FILE_OPEN_ERR;
    return(-1);
  }
  free(FullName);

  /* Check if free space for a new FONTPRIVATE is available; if not,
     realloc memory some amount larger */
  save_ptr=pFontBase->pFontArray;
  if (pFontBase->no_fonts==pFontBase->no_fonts_limit){
    if (pFontBase->pFontArray == NULL) {
      /* In case this is the first font */
      pFontBase->pFontArray=(FONTPRIVATE *)calloc(pFontBase->no_fonts_limit 
                                            + ADVANCE_FONTPRIVATE,
                                            sizeof(FONTPRIVATE));
    }
    else {
      /* We already have some fonts */
      pFontBase->pFontArray=(FONTPRIVATE *)realloc(pFontBase->pFontArray,
                                             (pFontBase->no_fonts_limit
                                              + ADVANCE_FONTPRIVATE)
                                             * sizeof(FONTPRIVATE));
      if (pFontBase->pFontArray==NULL){
       /* Restore pointer */
       pFontBase->pFontArray=save_ptr;
       T1_errno=T1ERR_ALLOC_MEM;
       return(-2); /* No memory available */
      }
    }
    pFontBase->no_fonts_limit += ADVANCE_FONTPRIVATE;
    /* First, initialize newly allocated to be not used */
    for ( i=pFontBase->no_fonts;
         i<pFontBase->no_fonts+ADVANCE_FONTPRIVATE; i++){
      pFontBase->pFontArray[i].pFontFileName=NULL;
      pFontBase->pFontArray[i].pAfmFileName=NULL;
      pFontBase->pFontArray[i].pAFMData=NULL;
      pFontBase->pFontArray[i].pType1Data=NULL;
      pFontBase->pFontArray[i].pEncMap=NULL;
      pFontBase->pFontArray[i].pKernMap=NULL;
      pFontBase->pFontArray[i].pFontEnc=NULL;
      pFontBase->pFontArray[i].pFontSizeDeps=NULL;
      pFontBase->pFontArray[i].vm_base=NULL;
      pFontBase->pFontArray[i].FontMatrix[0]=0.0;
      pFontBase->pFontArray[i].FontMatrix[1]=0.0;
      pFontBase->pFontArray[i].FontMatrix[2]=0.0;
      pFontBase->pFontArray[i].FontMatrix[3]=0.0;
      pFontBase->pFontArray[i].FontTransform[0]=0.0;
      pFontBase->pFontArray[i].FontTransform[1]=0.0;
      pFontBase->pFontArray[i].FontTransform[2]=0.0;
      pFontBase->pFontArray[i].FontTransform[3]=0.0;
      pFontBase->pFontArray[i].slant=0.0;
      pFontBase->pFontArray[i].extend=0.0;
      pFontBase->pFontArray[i].physical=0;
      pFontBase->pFontArray[i].refcount=0; 
      pFontBase->pFontArray[i].space_position=0; 
      pFontBase->pFontArray[i].info_flags=0; 
    }
  }
  /* no_fonts-1 was the largest allowed font ID */
  new_ID=pFontBase->no_fonts;
  pFontBase->no_fonts++;

  if ((FontBase.pFontArray[new_ID].pFontFileName=(char *)
       calloc( strlen( fontfilename)+1, sizeof(char))) == NULL){
    T1_PrintLog( "T1_AddFont()",
               "Failed to allocate memory for Filename %s (FontID=%d)",
               T1LOG_ERROR, fontfilename, new_ID);
    T1_errno=T1ERR_ALLOC_MEM;
    return(-3);
  }
  strcpy( FontBase.pFontArray[new_ID].pFontFileName, fontfilename);

  /* Generate logfile entry */
  sprintf( err_warn_msg_buf, "Assigned FontID %d to fontfile %s",
          new_ID, FontBase.pFontArray[new_ID].pFontFileName);
  T1_PrintLog( "T1_AddFont()", err_warn_msg_buf,
              T1LOG_STATISTIC);
  /* Return FontID of newly declared font */
  return( new_ID);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_AddFontDataBase ( int  mode,
char *  filename 
)

Definition at line 982 of file t1env.c.

{
  int i;
  int pathlen;
  int result=0;
  char* newpath;
  
  
  if (filename==NULL) {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(-1);
  }
  
  pathlen=strlen(filename);
  
  /* Allocate memory for string */
  if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL)  {
    T1_errno=T1ERR_ALLOC_MEM;
    return(-1);
  }
  strcpy( newpath, filename);
  /* Check for and handle the existing path configuration */
  if (fdb_no==0) {   /* defauls setup, free the path */
    free( T1_FDB_ptr[0]);
  }
  if (fdb_no==-1) {  /* not initialized! */
    fdb_no=0;
    T1_FDB_ptr=NULL; /* realloc() will do the malloc()! */
  }
  
  if ((T1_FDB_ptr=(char**)realloc( T1_FDB_ptr, (++fdb_no+1)*sizeof(char*)))==NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    return(-1);
  }
  /* Insert the new database. If t1lib is already initialzed, the database can only
     be appended. Otherwise. prepending is also possible.*/
  if ((mode & T1_PREPEND_PATH) && (T1_CheckForInit()!=0) ) { /* prepend */
    i=fdb_no-2;
    while (i>=0) {
      T1_FDB_ptr[i+1]=T1_FDB_ptr[i];
      i--;
    }
    T1_FDB_ptr[0]=newpath;
    result=0;
  }
  else { /* append */
    T1_FDB_ptr[fdb_no-1]=newpath;
    if (T1_CheckForInit()==0) {
      if ((result=intT1_scanFontDBase(T1_FDB_ptr[fdb_no-1]))==-1) {
       T1_PrintLog( "T1_AddFontDataBase()", "Fatal error scanning Font Database File %s (T1_errno=%d)",
                   T1LOG_WARNING, T1_FDB_ptr[fdb_no-1], T1_errno);
      }
      if (result>-1)
       pFontBase->no_fonts+=result;
      result=pFontBase->no_fonts;
    }
  }
  T1_FDB_ptr[fdb_no]=NULL;
  return result;
  
}

Here is the call graph for this function:

int T1_AddToFileSearchPath ( int  pathtype,
int  mode,
char *  pathname 
)

Definition at line 768 of file t1env.c.

{
  int i;
  int pathlen;
  char* newpath = NULL;
  int nofonts;
  
  
  if (pathname==NULL)
    return(-1);

  nofonts=T1_GetNoFonts();
  
  pathlen=strlen(pathname);
  
  if (pathtype & T1_PFAB_PATH){
    /* Allocate meory for string */
    if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL)  {
      T1_errno=T1ERR_ALLOC_MEM;
      return(-1);
    }
    /* Check for and handle the existing path configuration */
    if (pfab_no==0) {   /* do not free the default path but establish it
                        as a regularly setup path, if database not empty! */
      if (nofonts>0) {
       pfab_no++;
      }
      else {
       free( T1_AFM_ptr[0]);
      }
    }
    if (pfab_no==-1) {  /* not initialized! */
      pfab_no=0;
      T1_PFAB_ptr=NULL; /* realloc() will do the malloc()! */
    }
    if ((T1_PFAB_ptr=(char**)realloc( T1_PFAB_ptr, (++pfab_no+1)*sizeof(char*)))==NULL) {
      T1_errno=T1ERR_ALLOC_MEM;
      return(-1);
    }
    /* Insert the new path element: */
    if (mode & T1_PREPEND_PATH){ /* prepend */
      i=pfab_no-2;
      while (i>=0) {
       T1_PFAB_ptr[i+1]=T1_PFAB_ptr[i];
       i--;
      }
      T1_PFAB_ptr[0]=newpath;
    }
    else{ /* append */
      T1_PFAB_ptr[pfab_no-1]=newpath;
    }
    T1_PFAB_ptr[pfab_no]=NULL;
  }
  if (pathtype & T1_AFM_PATH){
    /* Allocate meory for string */
    if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL)  {
      T1_errno=T1ERR_ALLOC_MEM;
      return(-1);
    }
    /* Check for and handle the existing path configuration */
    if (afm_no==0) {   /* do not free the default path but establish it
                       as a regularly setup path, if database not empty! */
      if (nofonts>0) {
       afm_no++;
      }
      else {
       free( T1_AFM_ptr[0]);
      }
    }
    if (afm_no==-1) {  /* not initialized! */
      afm_no=0;
      T1_AFM_ptr=NULL; /* realloc() will do the malloc()! */
    }
    if ((T1_AFM_ptr=(char**)realloc( T1_AFM_ptr, (++afm_no+1)*sizeof(char*)))==NULL) {
      T1_errno=T1ERR_ALLOC_MEM;
      return(-1);
    }
    /* Insert the new path element */
    if (mode & T1_PREPEND_PATH){ /* prepend */
      i=afm_no-2;
      while (i>=0) {
       T1_AFM_ptr[i+1]=T1_AFM_ptr[i];
       i--;
      }
      T1_AFM_ptr[0]=newpath;
    }
    else{ /* append */
      T1_AFM_ptr[afm_no-1]=newpath;
    }
    T1_AFM_ptr[afm_no]=NULL;
  }
  if (pathtype & T1_ENC_PATH){
    /* Allocate meory for string */
    if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL)  {
      T1_errno=T1ERR_ALLOC_MEM;
      return(-1);
    }
    /* Check for and handle the existing path configuration */
    if (enc_no==0) {    /* do not free the default path but establish it
                        as a regularly setup path, if database not empty! */
      if (nofonts>0) {
       enc_no++;
      }
      else {
       free( T1_ENC_ptr[0]);
      }
    }
    if (enc_no==-1) {  /* not initialized! */
      enc_no=0;
      T1_ENC_ptr=NULL; /* realloc() will do the malloc()! */
    }
    if ((T1_ENC_ptr=(char**)realloc( T1_ENC_ptr, (++enc_no+1)*sizeof(char*)))==NULL) {
      T1_errno=T1ERR_ALLOC_MEM;
      return(-1);
    }
    /* Insert the new path element: */
    if (mode & T1_PREPEND_PATH){ /* prepend */
      i=enc_no-2;
      while (i>=0) {
       T1_ENC_ptr[i+1]=T1_ENC_ptr[i];
       i--;
      }
      T1_ENC_ptr[0]=newpath;
    }
    else{ /* append */
      T1_ENC_ptr[enc_no-1]=newpath;
    }
    T1_ENC_ptr[enc_no]=NULL;
  }
  
  /* Copy new path to where it belongs ... */
  if (newpath)
    strcpy(newpath, pathname);
  
  return(0);
  
}

Here is the call graph for this function:

Definition at line 1094 of file t1base.c.

{
  unsigned char *charptr;

  /* Generate test value */
  unsigned short test=0x0001;

  /* Read out memory as unsigned char */
  charptr=(unsigned char *)(&test)+1;

  /* Return value will be 1 if Big- and 0 if Little Endian */
  return((int) *charptr);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_CheckForFontID ( int  FontID)

Definition at line 708 of file t1base.c.

{

  /* FontID is invalid */
  if ((FontID<0)||(FontID>(pFontBase->no_fonts - 1))||(T1_Up==0))
    return(-1);
  
  if (pFontBase->pFontArray[FontID].pType1Data==NULL)
    return(0);     /* has not yet been loaded */
  else
    return(1);     /* has already been loaded */
}

Definition at line 690 of file t1base.c.

{
  if(T1_Up)
    return(0);
  else
    return(-1);
  
}

Here is the caller graph for this function:

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;
  
}

Definition at line 474 of file t1base.c.

{

  int i, j, error=0;

  if (T1_Up){
    for (i=pFontBase->no_fonts; i; i--){
      /* Free filename only if not NULL and if the font is physical!
        Do it before removing the font since the physical information
        is no more available afterwards. If necessary, an explicitly
        specified AFM filename is also freed.
        */
      if ((pFontBase->pFontArray[i-1].pFontFileName!=NULL)
         && (pFontBase->pFontArray[i-1].physical==1)){
       free( pFontBase->pFontArray[i-1].pFontFileName);
       pFontBase->pFontArray[i-1].pFontFileName=NULL;
       if (pFontBase->pFontArray[i-1].pAfmFileName!=NULL){
         free( pFontBase->pFontArray[i-1].pAfmFileName);
         pFontBase->pFontArray[i-1].pAfmFileName=NULL;
       }
      }
      
      /* Now, remove font: */
      if ((j=T1_DeleteFont( i-1))){
       error=1;
       sprintf( err_warn_msg_buf, "T1_DeleteFont() returned %d for Font %d",
               j, i-1);
       T1_PrintLog( "T1_CloseLib()", err_warn_msg_buf, T1LOG_ERROR);
      }
    }
    /* Free the FONTPRIVATE area */
    if (pFontBase->pFontArray)
      free( pFontBase->pFontArray);
    else
      error=1;

    /* Get rid of internal StandardEncoding vector */
    if ( StdEncArrayP != NULL ) {
      free( StdEncArrayP);
      StdEncArrayP = NULL;
    }

    /* Free search paths */
    intT1_FreeSearchPaths();

    /* Reset the flags */
    pFontBase->t1lib_flags=0;
    
    /* Indicate Library is no longer initialized */
    pFontBase=NULL;
    T1_Up=0;
    T1_PrintLog( "T1_CloseLib()", "Library closed", T1LOG_STATISTIC);
    if ((t1lib_log_file!=NULL) && (t1lib_log_file!=stderr))
      fclose(t1lib_log_file);
    t1lib_log_file=NULL;
  }
  
  return( error);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GLYPH* T1_ConcatGlyphs ( GLYPH glyph1,
GLYPH glyph2,
int  x_off,
int  y_off,
int  modflag 
)

Definition at line 1587 of file t1set.c.

{

  int lsb1, lsb2, rsb1, rsb2;
  int advanceX1, advanceX2, advanceY1, advanceY2;
  int ascent1, ascent2, descent1, descent2;
  int rsb, lsb, ascent, descent, advanceX, advanceY;
  int vanchor, w, h, wscanline, wscanline1, wscanline2, bpp;
  int memsize, BitShift;
  GLYPH *glyph1, *glyph2;
  unsigned T1_AA_TYPE16 BitBuf_c;
  unsigned T1_AA_TYPE32 BitBuf_s;
  unsigned long BitBuf_l;   /* This is only actually used if sizeof long = 8 */
  int i, j, k;
  int ByteOffset;
  
  unsigned char *Target_c, *p_c;
  unsigned T1_AA_TYPE16 *Target_s, *p_s;
  unsigned T1_AA_TYPE32 *Target_l, *p_l;
  
  static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1};
  

  /* We handle the Right-To-Left concatenation the simple way:
     1) Change the order of the two glyphs
     2) Invert the sign of the y-part of the offset
     3) Recalculate the dimensions of the resulating glyph.
  */
  /* Check for writing direction and reorganize appropriately: */
  if (modflag & T1_RIGHT_TO_LEFT){
    glyph1=glyph_2;
    glyph2=glyph_1;
    y_off=-y_off;
  }
  else {
    glyph1=glyph_1;
    glyph2=glyph_2;
  }
  
  if (glyph1==NULL){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return( NULL);
  }
  if (glyph2==NULL){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return( NULL);
  }
  if (glyph1->bpp != glyph2->bpp){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return( NULL);
  }
  
  /* We have two glyph different from NULL */
  /* Reset glyph, if necessary */
  if (glyph.bits!=NULL){
    free(glyph.bits);
    glyph.bits=NULL;
  }
  glyph.metrics.leftSideBearing=0;
  glyph.metrics.rightSideBearing=0;
  glyph.metrics.advanceX=0;
  glyph.metrics.advanceY=0;
  glyph.metrics.ascent=0;
  glyph.metrics.descent=0;
  glyph.pFontCacheInfo=NULL;
  glyph.bpp=1;

  /* Assign dimens */
  lsb1=glyph1->metrics.leftSideBearing;
  rsb1=glyph1->metrics.rightSideBearing;
  ascent1=glyph1->metrics.ascent;
  descent1=glyph1->metrics.descent;
  advanceX1=glyph1->metrics.advanceX + x_off;
  advanceY1=glyph1->metrics.advanceY + y_off;
  
  lsb2=glyph2->metrics.leftSideBearing;
  rsb2=glyph2->metrics.rightSideBearing;
  ascent2=glyph2->metrics.ascent;
  descent2=glyph2->metrics.descent;
  advanceX2=glyph2->metrics.advanceX;
  advanceY2=glyph2->metrics.advanceY;
  
  lsb=lsb1 < lsb2+advanceX1 ? lsb1 : lsb2+advanceX1;
  rsb=rsb1 > rsb2+advanceX1 ? rsb1 : rsb2+advanceX1;
  ascent=ascent1 > ascent2+advanceY1 ? ascent1 : ascent2+advanceY1;
  descent=descent1 < descent2+advanceY1 ? descent1 : descent2+advanceY1;
  advanceX=advanceX1+advanceX2;
  advanceY=advanceY1+advanceY2;

  bpp=glyph1->bpp;
  w=rsb-lsb;
  h=ascent-descent;
  wscanline=PAD( w*bpp, T1_pad) / 8;
  wscanline1=PAD( (rsb1-lsb1)*bpp, T1_pad) / 8;
  wscanline2=PAD( (rsb2-lsb2)*bpp, T1_pad) / 8;
  memsize=wscanline*h;
  if ((glyph.bits=(char *)calloc( memsize + 1, sizeof(unsigned char)))==NULL){
    T1_errno=T1ERR_ALLOC_MEM;
    return(NULL);
  }
  
  if (bpp==1){
    if (T1_pad==32 && T1_byte==0 && sizeof(long)==8){
      /* The following loop steps through the lines of the first glyph: */
      vanchor=ascent-ascent1;
      BitShift=(lsb1-lsb) % 32;
      ByteOffset=(lsb1-lsb)/32*4;
      for ( i=0; i<ascent1-descent1; i++){
       Target_l= (unsigned T1_AA_TYPE32 *)(glyph.bits +((vanchor+i)*wscanline)
                                       +ByteOffset);
       p_l = (unsigned T1_AA_TYPE32 *)(glyph1->bits+(wscanline1*i));
       if (BitShift == 0){
         for (k=wscanline1/4; k; k--)
           *Target_l++ |= *p_l++;
       }
       else{
         for (k=wscanline1/4; k; k--){
           BitBuf_l = ((long)*p_l++) << BitShift;
           *Target_l++ |= BitBuf_l;
           *Target_l |= BitBuf_l>>l_shift;
         }
       }
      }
      /* The following loop steps through the lines of the second glyph: */
      vanchor=ascent-(ascent2+advanceY1);
      BitShift=(lsb2+advanceX1-lsb) % 32;
      ByteOffset=(lsb2+advanceX1-lsb)/32*4;
      for ( i=0; i<ascent2-descent2; i++){
       Target_l= (unsigned T1_AA_TYPE32 *)(glyph.bits +((vanchor+i)*wscanline)
                                       +ByteOffset);
       p_l = (unsigned T1_AA_TYPE32 *)(glyph2->bits+(wscanline2*i));
       if (BitShift == 0){
         for (k=wscanline2/4; k; k--)
           *Target_l++ |= *p_l++;
       }
       else{
         for (k=wscanline2/4; k; k--){
           BitBuf_l = ((long)*p_l++) << BitShift;
           *Target_l++ |= BitBuf_l;
           *Target_l |= BitBuf_l>>l_shift;
         } 
       } 
      }
    }
    else if(T1_pad==16 && T1_byte==0){
      /* The following loop steps through the lines of the first glyph: */
      vanchor=ascent-ascent1;
      BitShift=(lsb1-lsb) % 16;
      ByteOffset=(lsb1-lsb)/16*2;
      for ( i=0; i<ascent1-descent1; i++){
       Target_s= (unsigned T1_AA_TYPE16 *)(glyph.bits +((vanchor+i)*wscanline)
                                       +ByteOffset);
       p_s = (unsigned T1_AA_TYPE16 *)(glyph1->bits+(wscanline1*i));
       if (BitShift == 0){
         for (k=wscanline1/2; k; k--)
           *Target_s++ |= *p_s++;
       }
       else{
         for (k=wscanline1/2; k; k--){
           BitBuf_s = ((T1_AA_TYPE32)*p_s++) << BitShift;
           *Target_s++ |= BitBuf_s;
           *Target_s |= BitBuf_s>>s_shift;
         }
       }
      }
      /* The following loop steps through the lines of the second glyph: */
      vanchor=ascent-(ascent2+advanceY1);
      BitShift=(lsb2+advanceX1-lsb) % 16;
      ByteOffset=(lsb2+advanceX1-lsb)/16*2;
      for ( i=0; i<ascent2-descent2; i++){
       Target_s= (unsigned T1_AA_TYPE16 *)(glyph.bits +((vanchor+i)*wscanline)
                                       +ByteOffset);
       p_s = (unsigned T1_AA_TYPE16 *)(glyph2->bits+(wscanline2*i));
       if (BitShift == 0){
         for (k=wscanline2/2; k; k--)
           *Target_s++ |= *p_s++;
       }
       else{
         for (k=wscanline2/2; k; k--){
           BitBuf_s = ((T1_AA_TYPE32)*p_s++) << BitShift;
           *Target_s++ |= BitBuf_s;
           *Target_s |= BitBuf_s>>s_shift;
         } 
       } 
      }
    }
    else{ /* T1_pad==8 or Big Endian machine */
      /* The following loop steps through the lines of the first glyph: */
      vanchor=ascent-ascent1;
      BitShift=(lsb1-lsb) % 8;
      ByteOffset=(lsb1-lsb) / 8;
      for ( i=0; i<ascent1-descent1; i++){
       Target_c= (unsigned char *)(glyph.bits +((vanchor+i)*wscanline)
                                +ByteOffset);
       p_c = (unsigned char *)(glyph1->bits+(wscanline1*i));
       if (BitShift == 0){
         for (k=wscanline1; k; k--)
           *Target_c++ |= *p_c++;
       }
       else{
         for (k=wscanline1; k; k--){
           BitBuf_c = ((T1_AA_TYPE16)*p_c++) << BitShift;
           *Target_c++ |= BitBuf_c;
           *Target_c |= BitBuf_c>>c_shift;
         }
       }
      }
      /* The following loop steps through the lines of the second glyph: */
      vanchor=ascent-(ascent2+advanceY1);
      BitShift=(lsb2+advanceX1-lsb) % 8;
      ByteOffset=(lsb2+advanceX1-lsb) / 8;
      for ( i=0; i<ascent2-descent2; i++){
       Target_c= (unsigned char *)(glyph.bits +((vanchor+i)*wscanline)
                                +ByteOffset);
       p_c = (unsigned char *)(glyph2->bits+(wscanline2*i));
       if (BitShift == 0){
         for (k=wscanline2; k; k--)
           *Target_c++ |= *p_c++;
       }
       else{
         for (k=wscanline2; k; k--){
           BitBuf_c = ((T1_AA_TYPE16)*p_c++) << BitShift;
           *Target_c++ |= BitBuf_c;
           *Target_c |= BitBuf_c>>c_shift;
         } 
       } 
      }
    }
  } /* end of if (bpp==1) ... */
  else if (bpp==8){
    /* Set background */
    for ( i=0; i<memsize; i++)
      ((char *)glyph.bits)[i]=(char) T1aa_bg;
    /* The following loop steps through the lines of the first glyph: */
    vanchor=ascent-ascent1;
    for ( i=0; i<ascent1-descent1; i++){
      Target_c= (unsigned char *)(glyph.bits +((vanchor+i)*wscanline)
                              +(lsb1-lsb));
      p_c = (unsigned char *)(glyph1->bits+(wscanline1*i));
      memcpy( Target_c, p_c, (rsb1-lsb1));
    }
    /* The following loop steps through the lines of the second glyph.
       Note that we only set the pixel if it is not background! */
    vanchor=ascent-(ascent2+advanceY1);
    for ( i=0; i<ascent2-descent2; i++){
      Target_c= (unsigned char *)(glyph.bits +((vanchor+i)*wscanline)
                              +(lsb2+advanceX1-lsb));
      p_c = (unsigned char *)(glyph2->bits+(wscanline2*i));
      for (j=0; j<(rsb2-lsb2); j++)
       if (p_c[j] != (unsigned char) T1aa_bg)
         Target_c[j]=p_c[j];
    }
  } /* end of if (bpp==8) ... */
  else if (bpp==16){
    /* Set background */
    for ( i=0; i<memsize/2; i++)
      ((T1_AA_TYPE16 *)glyph.bits)[i]=(T1_AA_TYPE16) T1aa_bg;
    /* The following loop steps through the lines of the first glyph: */
    vanchor=ascent-ascent1;
    for ( i=0; i<ascent1-descent1; i++){
      Target_s= (unsigned T1_AA_TYPE16 *)(glyph.bits +((vanchor+i)*wscanline)
                              +(lsb1-lsb)*2);
      p_s = (unsigned T1_AA_TYPE16 *)(glyph1->bits+(wscanline1*i));
      memcpy( Target_s, p_s, (rsb1-lsb1)*2);
    }
    /* The following loop steps through the lines of the second glyph.
       Note that we only set the pixel if it is not background! */
    vanchor=ascent-(ascent2+advanceY1);
    for ( i=0; i<ascent2-descent2; i++){
      Target_s= (unsigned T1_AA_TYPE16 *)(glyph.bits +((vanchor+i)*wscanline)
                              +(lsb2+advanceX1-lsb)*2);
      p_s = (unsigned T1_AA_TYPE16 *)(glyph2->bits+(wscanline2*i));
      for (j=0; j<(rsb2-lsb2); j++)
       if (p_s[j] != (unsigned T1_AA_TYPE16) T1aa_bg)
         Target_s[j]=p_s[j];
    }
  } /* end of if (bpp==16) ... */
  else if (bpp==32){
    /* Set background */
    for ( i=0; i<memsize/4; i++)
      ((T1_AA_TYPE32 *)glyph.bits)[i]=(T1_AA_TYPE32) T1aa_bg;
    /* The following loop steps through the lines of the first glyph: */
    vanchor=ascent-ascent1;
    for ( i=0; i<ascent1-descent1; i++){
      Target_l= (unsigned T1_AA_TYPE32 *)(glyph.bits +((vanchor+i)*wscanline)
                              +(lsb1-lsb)*4);
      p_l = (unsigned T1_AA_TYPE32 *)(glyph1->bits+(wscanline1*i));
      memcpy( Target_l, p_l, (rsb1-lsb1)*4);
    }
    /* The following loop steps through the lines of the second glyph.
       Note that we only set the pixel if it is not background! */
    vanchor=ascent-(ascent2+advanceY1);
    for ( i=0; i<ascent2-descent2; i++){
      Target_l= (unsigned T1_AA_TYPE32 *)(glyph.bits +((vanchor+i)*wscanline)
                              +(lsb2+advanceX1-lsb)*4);
      p_l = (unsigned T1_AA_TYPE32 *)(glyph2->bits+(wscanline2*i));
      for (j=0; j<(rsb2-lsb2); j++)
       if (p_l[j] != (unsigned T1_AA_TYPE32) T1aa_bg)
         Target_l[j]=p_l[j];
    }
  } /* end of if (bpp==32) ... */
  
  
  /* Check for writing direction and re-compute dimens appropriately: */
  if (modflag & T1_RIGHT_TO_LEFT){
    advanceX=-advanceX1-advanceX2;
    advanceY=-advanceY1-advanceY2;
    lsb=lsb1 < lsb2+advanceX1 ? advanceX+lsb1 : advanceX+lsb2+advanceX1;
    rsb=rsb1 > rsb2+advanceX1 ? advanceX+rsb1 : advanceX+rsb2+advanceX1;
    ascent=ascent1 > ascent2+advanceY1 ? ascent1 : ascent2+advanceY1;
    descent=descent1 < descent2+advanceY1 ? descent1 : descent2+advanceY1;
    ascent += advanceY;
    descent += advanceY;
  } 
  
  glyph.metrics.leftSideBearing=lsb;
  glyph.metrics.rightSideBearing=rsb;
  glyph.metrics.advanceX=advanceX;
  glyph.metrics.advanceY=advanceY;
  glyph.metrics.ascent=ascent;
  glyph.metrics.descent=descent;
  glyph.bpp=bpp;
  
  /*
  printf("lsb=%d, rsb=%d, adX=%d, adY=%d asc=%d, desc=%d\n",
        glyph.metrics.leftSideBearing,
        glyph.metrics.rightSideBearing,
        glyph.metrics.advanceX,
        glyph.metrics.advanceY,
        glyph.metrics.ascent,
        glyph.metrics.descent );
        */
  
  return( &glyph);
  
}
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));
  
}
int T1_CopyFont ( int  FontID)

Definition at line 926 of file t1base.c.

{
  FONTPRIVATE *save_ptr;
  int k;
  int new_ID;
  
  
  /* Check for a valid source font */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }


  /* Check if the font in question is a "physical" font, otherwise it may
     not be copied */
  if (pFontBase->pFontArray[FontID].physical==0){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-2);
  }
  
  
  /* Check if free space for a new FONTPRIVATE is available; if not,
     realloc memory some amount larger */
  save_ptr=pFontBase->pFontArray;
  if (pFontBase->no_fonts==pFontBase->no_fonts_limit){
    pFontBase->pFontArray=(FONTPRIVATE *)realloc(pFontBase->pFontArray,
                                           (pFontBase->no_fonts_limit
                                            + ADVANCE_FONTPRIVATE)
                                           * sizeof(FONTPRIVATE));
    if (pFontBase->pFontArray==NULL){
      /* Restore pointer */
      pFontBase->pFontArray=save_ptr;
      T1_errno=T1ERR_ALLOC_MEM;
      return(-3);
    }
    /* We zero the newly allocated memory */
    if (pFontBase->pFontArray != NULL) {
      memset( pFontBase->pFontArray + pFontBase->no_fonts_limit, 0,
             ADVANCE_FONTPRIVATE * sizeof(FONTPRIVATE));
    }
    pFontBase->no_fonts_limit += ADVANCE_FONTPRIVATE;
  }
  /* no_fonts-1 was the largest allowed font ID */
  new_ID=pFontBase->no_fonts;
  /* Copy FONTPRIVATE-structure: */
  pFontBase->pFontArray[new_ID]=pFontBase->pFontArray[FontID];
  /* (Re)Set some values explicitly, others remain untouched: */  
  pFontBase->pFontArray[new_ID].pFontSizeDeps=NULL;
  pFontBase->pFontArray[new_ID].physical=0;
  /* AFM-mapping tables are to be setup for logical fonts separately
   (if AFM data is there) */
  /* first, kerning map */
  if (pFontBase->pFontArray[new_ID].pAFMData) {
    k=pFontBase->pFontArray[new_ID].pAFMData->numOfPairs;
    if (k>0){ /* kern map exists only if kerning pairs exist! */
      if ((pFontBase->pFontArray[new_ID].pKernMap=
          (METRICS_ENTRY *)malloc( k*sizeof( METRICS_ENTRY)))==NULL){
       sprintf( err_warn_msg_buf, "Error allocating memory for kerning map (new_ID=%d)",
               new_ID);
       T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf,
                   T1LOG_WARNING);
       T1_errno=T1ERR_ALLOC_MEM;
       return(-4);
      }
      memcpy( pFontBase->pFontArray[new_ID].pKernMap,
             pFontBase->pFontArray[FontID].pKernMap,
             k*sizeof( METRICS_ENTRY));
    } 
    else { /* no kerning pairs, bu AFM data present */
      pFontBase->pFontArray[new_ID].pKernMap=NULL;
    }
  } 
  else { /* AFM data not present at all */
    pFontBase->pFontArray[new_ID].pKernMap=NULL;
  }

  /* second, encoding map */
  if (pFontBase->pFontArray[FontID].pEncMap!=NULL) {
    if ((pFontBase->pFontArray[new_ID].pEncMap=
        (int *)calloc(256,sizeof(int)))==NULL){
      sprintf( err_warn_msg_buf,
              "Error allocating memory for encoding map (new_ID=%d)",
              new_ID);
      T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf,
                 T1LOG_WARNING);
      T1_errno=T1ERR_ALLOC_MEM;
      return(-4);
    }
    memcpy( pFontBase->pFontArray[new_ID].pEncMap,
           pFontBase->pFontArray[FontID].pEncMap,
           256*sizeof( int));
  }
  
  /* New font is logical --> indicate to which physical font it
     refers by setting refcount: */
  pFontBase->pFontArray[new_ID].refcount=FontID;
  
  /* Now the struct is setup; increment no_fonts by 1 because
     new_ID is a valid font specification from now on. */
  pFontBase->no_fonts++;
  /* Increment refcount in source font */
  pFontBase->pFontArray[FontID].refcount++;

  /* Generate logfile entry */
  sprintf( err_warn_msg_buf, "Assigned FontID %d to fontfile %s",
          new_ID, FontBase.pFontArray[new_ID].pFontFileName);
  T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf,
              T1LOG_STATISTIC);
  return(new_ID);
}

Here is the call graph for this function:

GLYPH* T1_CopyGlyph ( GLYPH glyph)

Definition at line 1455 of file t1set.c.

{
  GLYPH *dest;
  long size;
  

  if (glyph==NULL){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NULL);
  }
  
  /* Assign padding value */
  T1_pad=pFontBase->bitmap_pad;
  /* Allocate memory for struct: */
  if ((dest=(GLYPH *)malloc(sizeof(GLYPH)))==NULL){
    T1_errno=T1ERR_ALLOC_MEM;
    return(NULL);
  }
  
  /* Copy the structure members: */
  *dest=*glyph;
  /* Allocate memory for bitmap, initialize pointer to it and copy bitmap: */
  size=PAD((dest->metrics.rightSideBearing-dest->metrics.leftSideBearing)*
          glyph->bpp, T1_pad) / 8;
  size=size*(dest->metrics.ascent-dest->metrics.descent);
   /* We must check whether there's actually a bits-pointer different from
      NULL. If not omit the following step: */
  if (glyph->bits!=NULL){
    if ((dest->bits=(char *)malloc(size*sizeof(char)))==NULL){
      free(dest);
      T1_errno=T1ERR_ALLOC_MEM;
      return(NULL);
    }
    memcpy(dest->bits,glyph->bits,size);
  }
  return(dest);
}

Definition at line 749 of file t1outline.c.

{

  return( (T1_OUTLINE *) CopyPath( (struct segment *)path));
         
}
int T1_DeleteAllSizes ( int  FontID)

Definition at line 136 of file t1delete.c.

{
  int sizecount;
  float currsize;
  
  FONTSIZEDEPS *ptr;
  
  if (T1_CheckForFontID(FontID)!=1)
    return(-1);
  
  /* Start deleting at the end of the linked list: */ 
  sizecount=0;
  if ((ptr=T1int_GetLastFontSize( FontID))==NULL){
    /* There has not been any size dependent data: */
    return(0);
  }

  while (((ptr=T1int_GetLastFontSize(FontID)) != NULL)){
    currsize=ptr->size;
    T1_DeleteSize( FontID, currsize);
    sizecount++;
    
  }

  return(sizecount);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_DeleteEncoding ( char **  encoding)

Definition at line 602 of file t1enc.c.

{
  if (encoding){
    /* First free character names memory */
    free( encoding[0]);
    /* then, free pointer array */
    free( encoding);
  }
  return(0);
  
}

Here is the call graph for this function:

int T1_DeleteFont ( int  FontID)

Definition at line 195 of file t1delete.c.

{

  int result;

  
  if (T1_CheckForFontID(FontID)==-1){  /* Invalid ID */
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);   
  }
  
  if (T1_CheckForFontID(FontID)==0)   /* Font is not loaded */
    return(0);   

  /* Memory freeing must be done hierachical, start with size dependent
     data: */
  result=T1_DeleteAllSizes(FontID);

  /* Next we delete the AFM-mapping tables */
  if (pFontBase->pFontArray[FontID].pEncMap!=NULL)
    free( pFontBase->pFontArray[FontID].pEncMap);
  if (pFontBase->pFontArray[FontID].pKernMap!=NULL)
    free( pFontBase->pFontArray[FontID].pKernMap);

  /* We do not touch the file name because this is only to be done by
     T1_CloseLib(): */
  
  /* The Type-1 area and tyhe AFM-area may only be free'ed, if the
     font is a "physical" font and if its reference counter is 1, or
     if it is a logical font. Otherwise, other logical font use this
     physical one and it may not be free'ed.  In this case, return the
     number of logical fonts which refer to this physical font. */
  if ((pFontBase->pFontArray[FontID].physical==1)&&
      (pFontBase->pFontArray[FontID].refcount==1)){
    /* Now handle the type 1 data: */
    if (pFontBase->pFontArray[FontID].pType1Data!=NULL){
      /* First: VM, which includes CharStrings, Private, .... */
      free(pFontBase->pFontArray[FontID].vm_base); 
      /* .. then the struct itself: */
      free(pFontBase->pFontArray[FontID].pType1Data);
      pFontBase->pFontArray[FontID].pType1Data=NULL;
    }
    
    /* afm-data is yet there -> */
    if (pFontBase->pFontArray[FontID].pAFMData!=NULL){
      result=FreeAFMData(pFontBase->pFontArray[FontID].pAFMData);
      pFontBase->pFontArray[FontID].pAFMData=NULL;
    }
  }
  else{
    if (pFontBase->pFontArray[FontID].physical==1){
      /* font is physical and is referred to by other fonts ->
        Do nothing further and return number of references: */

      return(pFontBase->pFontArray[FontID].refcount - 1);
    }
  }
  
  /* If we get here and the font is logical, we have to
     decrement the refcount of the referred physical font */
  if (pFontBase->pFontArray[FontID].physical==0){
    pFontBase->pFontArray[pFontBase->pFontArray[FontID].refcount].refcount--;
  }
  
  
  /* Set remaining area explicitly to 0 (all but pFontFileName and
     pAfmFileName!) */
  pFontBase->pFontArray[FontID].pAFMData=NULL;
  pFontBase->pFontArray[FontID].pType1Data=NULL;
  pFontBase->pFontArray[FontID].pEncMap=NULL;
  pFontBase->pFontArray[FontID].pKernMap=NULL;
  pFontBase->pFontArray[FontID].pFontEnc=NULL;
  pFontBase->pFontArray[FontID].pFontSizeDeps=NULL;
  pFontBase->pFontArray[FontID].vm_base=NULL;
  pFontBase->pFontArray[FontID].FontMatrix[0]=0.0;
  pFontBase->pFontArray[FontID].FontMatrix[1]=0.0;
  pFontBase->pFontArray[FontID].FontMatrix[2]=0.0;
  pFontBase->pFontArray[FontID].FontMatrix[3]=0.0;
  pFontBase->pFontArray[FontID].FontTransform[0]=0.0;
  pFontBase->pFontArray[FontID].FontTransform[1]=0.0;
  pFontBase->pFontArray[FontID].FontTransform[2]=0.0;
  pFontBase->pFontArray[FontID].FontTransform[3]=0.0;
  pFontBase->pFontArray[FontID].slant=0.0;
  pFontBase->pFontArray[FontID].extend=0.0;
  pFontBase->pFontArray[FontID].UndrLnPos=0.0;
  pFontBase->pFontArray[FontID].UndrLnThick=0.0;
  pFontBase->pFontArray[FontID].OvrLnPos=0.0;
  pFontBase->pFontArray[FontID].OvrLnThick=0.0;
  pFontBase->pFontArray[FontID].OvrStrkPos=0.0;
  pFontBase->pFontArray[FontID].OvrStrkThick=0.0;
  pFontBase->pFontArray[FontID].physical=0;
  pFontBase->pFontArray[FontID].refcount=0; 
  pFontBase->pFontArray[FontID].space_position=0; 
  pFontBase->pFontArray[FontID].info_flags=0; 

  return(0);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_DeleteSize ( int  FontID,
float  size 
)

Definition at line 67 of file t1delete.c.

{
  int i, j;
  FONTSIZEDEPS *ptr, *next_ptr, *prev_ptr;
  int jobs=0;
  int antialias;
  int level[4]={0,T1_AA_NONE,T1_AA_LOW,T1_AA_HIGH};
  

  for ( j=0; j<4; j++){
    antialias=level[j];
    /* Check if size exists; if not, return 1 */
    if ((ptr=T1int_QueryFontSize( FontID, size, antialias))!=NULL){
      /* We have to remove a size-> */
      jobs++;
      /* Get pointers to structure which is before/after  the structure
        to be deleted        in the linked list and properly relink
        structures */
      next_ptr=((FONTSIZEDEPS *)ptr)->pNextFontSizeDeps;
      prev_ptr=((FONTSIZEDEPS *)ptr)->pPrevFontSizeDeps;

      if ((prev_ptr==NULL)&&(next_ptr==NULL)){
       /* There's only one single size, no relink is necessary
          => reset the initial pointer to indicate that no size
          dependent data is available */
       pFontBase->pFontArray[FontID].pFontSizeDeps=NULL;
      }
      else{
       if (prev_ptr!=NULL)
         /* We are at the first size of the linked list and
            there are still some sizes left after removing the
            current */
         prev_ptr->pNextFontSizeDeps=next_ptr;
       else
         pFontBase->pFontArray[FontID].pFontSizeDeps=next_ptr;
       if (next_ptr!=NULL)
         /* We are at the end of an list of at least two sizes: */
         next_ptr->pPrevFontSizeDeps=prev_ptr;
      }
      
      /* Now, that the list is properly linked, free the memory used by size: */
      /* Free the bitmaps memory: */
      for (i=0; i<256; i++)
       if (ptr->pFontCache[i].bits)
         free(ptr->pFontCache[i].bits);

      /* Free memory for glyphs: */
      free(ptr->pFontCache);
      /* Free the structure itself: */
      free(ptr);
      /* Print log: */
      sprintf( err_warn_msg_buf, "Size %f deleted for FontID %d (antialias=%d)",
              size, FontID, antialias);
      T1_PrintLog( "T1_DeleteSize()", err_warn_msg_buf, T1LOG_STATISTIC);
    }
  }

  /* Return the appropriate value */
  if (jobs==0)
    return(-1);
  else  
    return(0);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void T1_DumpGlyph ( GLYPH glyph)

Definition at line 1494 of file t1set.c.

{
  int i,j,h,w;   /* i=line-index, j=column-index */ 
  long paddedW;
  
  
  printf("Dataformat: T1_bit=%d, T1_byte=%d, T1_wordsize=%d, T1_pad=%d\n",
        T1_bit, T1_byte, T1_pad, T1_pad);

  if (glyph==NULL){
    return;
  }
  
  h=glyph->metrics.ascent-glyph->metrics.descent;
  w=glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing;
  
  paddedW=PAD(w,T1_pad);
  
  printf("GlyphInfo: h=%d, w=%d, paddedW=%ld\n", h, w, paddedW);
  
  for ( i=0; i<h; i++){
    if (T1_pad==8)
      for (j=0; j<paddedW/T1_pad; j++)
       bin_dump_c(glyph->bits[i*paddedW/T1_pad+j], 1);
    else if (T1_pad==16)
      for (j=0; j<paddedW/T1_pad; j++){
       bin_dump_s(((unsigned short *)glyph->bits)[i*paddedW/T1_pad+j], 1);
      }
    else
      for (j=0; j<paddedW/T1_pad; j++){
       bin_dump_l(((unsigned long *)glyph->bits)[i*paddedW/T1_pad+j], 1);
      }
    printf("\n");
  } 
} 

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);
  
}
void T1_DumpPixmap ( GLYPH glyph)
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);
}
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);
  
}
GLYPH* T1_FillOutline ( T1_OUTLINE path,
int  modflag 
)

Definition at line 1928 of file t1set.c.

{
  struct region *area=NULL;

  static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1};
  volatile int memsize=0;
  int i;
  LONG h,w;
  LONG paddedW;

  
  /* 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_FillOutline()", err_warn_msg_buf,
              T1LOG_ERROR);
    return( NULL);
  }

  /* Reset character glyph, if necessary */
  if (glyph.bits!=NULL){
    free(glyph.bits);
    glyph.bits=NULL;
  }
  glyph.metrics.leftSideBearing=0;
  glyph.metrics.rightSideBearing=0;
  glyph.metrics.advanceX=0;
  glyph.metrics.advanceY=0;
  glyph.metrics.ascent=0;
  glyph.metrics.descent=0;
  glyph.pFontCacheInfo=NULL;
  glyph.bpp=1;  
  
  
  /* Assign padding value */
  T1_pad=pFontBase->bitmap_pad;
  if (pFontBase->endian)
    T1_byte=1;
  else
    T1_byte=0;
  T1_wordsize=T1_pad;

  /* Create a region from outline */
  area=(struct region *)Interior( (struct segment *)path,
                              WINDINGRULE+CONTINUITY);

  /* fill the glyph-structure */
  if (area == NULL){
    T1_PrintLog( "T1_FillOutline()", "area=NULL returned by Interior()", T1LOG_WARNING);
    T1_errno=1000;
    return(NULL);
  }
  h = area->ymax - area->ymin;
  w = area->xmax - area->xmin;

  
  paddedW = PAD(w, T1_pad);
  if ( (area->xmin > area->xmax) || (area->ymin > area->ymax) ){
    /* There was a character like .notdef or space, that didn't
       produce any black pixels on the bitmap! -> we return a glyph with
       correct metrics and bitmap pointer set to NULL */
    sprintf( err_warn_msg_buf,
            "No black pixels in outline %p", path);
    T1_PrintLog( "T1_FillOutline()", err_warn_msg_buf, T1LOG_WARNING);
    
    glyph.metrics.leftSideBearing  = 0;
    glyph.metrics.advanceX   = NEARESTPEL(area->ending.x - area->origin.x);
    glyph.metrics.advanceY   = - NEARESTPEL(area->ending.y - area->origin.y);
    glyph.metrics.rightSideBearing = 0;
    glyph.metrics.descent          = 0;
    glyph.metrics.ascent           = 0;
    /* make sure to get rid of 'area' before leaving! */
    KillRegion (area);
    return( &glyph);
  }
  if (h > 0 && w > 0) {
    memsize = h * paddedW / 8 + 1;
    /* This is for the users copy of the character, for security-reasons
       the original pointer to the cache area is not used. The entry glyph.bits
       is free'ed every time this function is called: */
    glyph.bits = (char *)malloc(memsize*sizeof( char));
    if (glyph.bits == NULL){
      T1_errno=T1ERR_ALLOC_MEM;
      /* make sure to get rid of area if it's there */
      if (area){
       KillRegion (area);
      }
      return(NULL);
    }
    
  }
  else {
    h = w = 0;
    area->xmin = area->xmax = 0;
    area->ymin = area->ymax = 0;
  }
  
  glyph.metrics.leftSideBearing  = area->xmin;
  glyph.metrics.advanceX   = NEARESTPEL(area->ending.x - area->origin.x);
  glyph.metrics.advanceY   = - NEARESTPEL(area->ending.y - area->origin.y);
  glyph.metrics.rightSideBearing = area->xmax;
  glyph.metrics.descent          = - area->ymax;
  glyph.metrics.ascent           = - area->ymin;
  
  
  if (h > 0 && w > 0) {
    (void) memset(glyph.bits, 0, memsize);
    fill(glyph.bits, h, paddedW, area, T1_byte, T1_bit, T1_wordsize );
  }

  /* Check for writing direction and re-compute dimensions appropriately: */
  if (modflag & T1_RIGHT_TO_LEFT){
    glyph.metrics.advanceX *= -1;
    glyph.metrics.advanceY *= -1;
    glyph.metrics.leftSideBearing += glyph.metrics.advanceX;
    glyph.metrics.rightSideBearing += glyph.metrics.advanceX;
    glyph.metrics.descent += glyph.metrics.advanceY;
    glyph.metrics.ascent += glyph.metrics.advanceY;
  } 
  
  /* make sure to get rid of area if it's there */
  if (area){
    KillRegion (area);
  }
  return( &glyph);
  
  
}

Here is the caller graph for this function:

Definition at line 179 of file t1delete.c.

{

  if (cci!=NULL) {
    if (cci->pieces!=NULL) {
      free( cci->pieces);
    }
    free( cci);
  }
  return( 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_FreeGlyph ( GLYPH glyph)

Definition at line 165 of file t1delete.c.

{
  if (glyph!=NULL) {
    if (glyph->bits!=NULL) {
      free(glyph->bits);
    }
    free(glyph);
  }
  return(0);
}

Here is the call graph for this function:

Definition at line 759 of file t1outline.c.

{
  
  KillPath( (struct segment *)path);
  return;
  
}
char* T1_GetAfmFileName ( int  FontID)

Definition at line 835 of file t1base.c.

{

  static char filename[MAXPATHLEN+1];
  
  if (T1_CheckForInit())return(NULL);

  /* Check first for valid FontID */
  if ((FontID<0) || (FontID>FontBase.no_fonts)){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }

  if (pFontBase->pFontArray[FontID].pAfmFileName==NULL) {
    return( NULL);
  }
  
  strcpy( filename, pFontBase->pFontArray[FontID].pAfmFileName);
  return( filename);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetAfmFilePath ( int  FontID)

Definition at line 1178 of file t1base.c.

{
  
  static char filepath[MAXPATHLEN+1];
  char *FontFileName;
  char *AFMFilePath;
  int i, j;
  
  /* is initialized? */
  if ((T1_CheckForInit())) {
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  /* Check first for valid FontID */
  if ((FontID<0) || (FontID>FontBase.no_fonts)){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }

  /* Check wether AFM-file loading was suppressed on user's request */
  if ((pFontBase->t1lib_flags & T1_NO_AFM)!=0) {
    /* this is no error condition, we simply return (NULL) */
    return( NULL);
  }
  
  /* Check for explicitly associated metrics filename (via
     "T1_SetAfmFileName()"). If it exists, we return it! */
  if (pFontBase->pFontArray[FontID].pAfmFileName!=NULL) {
    strcpy( filepath, pFontBase->pFontArray[FontID].pAfmFileName);
    sprintf( err_warn_msg_buf, "Returning explicitly specified path %s for Font %d",
            filepath, FontID);
    T1_PrintLog( "T1_GetAfmFilePath()", err_warn_msg_buf, T1LOG_DEBUG);
    return( filepath);
  }
  
  /* we have the usual case that the name of the metrics file has to be
     deduced from the font file name */
  FontFileName=T1_GetFontFileName( FontID);
  i=strlen(FontFileName);
  j=i;
  strcpy( filepath, FontFileName);
  while ( filepath[i] != '.'){
    if (i==0) break;
    else i--;
  }
  if (i==0){
    /* We have a filename without extension -> append extension */
    filepath[j]='.';
    filepath[j+1]='a'; 
    filepath[j+2]='f'; 
    filepath[j+3]='m'; 
    filepath[j+4]='\0'; 
  }
  else{
    /* we found a '.' -> replace extension */
    filepath[i+1]='a';
    filepath[i+2]='f';
    filepath[i+3]='m';
    filepath[i+4]='\0';
  }
  /* Get full path of the afm file (The case of a full path name
     name specification is valid) */
  if ((AFMFilePath=intT1_Env_GetCompletePath( filepath, T1_AFM_ptr)) == NULL) {
    return NULL;
  }
  
  strcpy( filepath, AFMFilePath);
  free( AFMFilePath);
  
  return( filepath);
  
}

Here is the call graph for this function:

char** T1_GetAllCharNames ( int  FontID)

Definition at line 1035 of file t1finfo.c.

{
  static char **bufmem=NULL;
  register char *namedest;
  psdict *pCharStrings;
  int len, i, j;
  long nameoffset;
  
  int bufmemsize=0;
  
  /* return NULL if font not loaded */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return( NULL);
  }
  
  pCharStrings=pFontBase->pFontArray[FontID].pType1Data->CharStringsP;

  /* First, get number of charstrings: */
  len=pCharStrings[0].key.len;

  /* We must be careful here: size of the charstrings dict might be larger
     than the actual number of charstrings. We correct for this by reducing
     the value of len appropriately */
  for ( i=1; i<=len; i++){
    /* calculate room for each characters name plus the prepending \0 */ 
    if ((j=pCharStrings[i].key.len)){
      bufmemsize += j + 1;
    }
    else{ /* we skip this (the remaining) entries */
      len--;
      i--;
    }
  }
  /* Now we reserve memory for the pointers (including final NULL) */
  nameoffset=(len+1)*sizeof( char *);
  bufmemsize += nameoffset;

  /* Now allocate memory, copy strings and initialize pointers */
  if (bufmem!=NULL)
    free(bufmem);
  if ((bufmem=(char **)malloc( bufmemsize))==NULL){
    T1_errno=T1ERR_ALLOC_MEM;
    return(NULL);
  }
  
  namedest=(char *)((long)bufmem + nameoffset);
  j=0;
  for ( i=0; i<len; i++){
    bufmem[i]=&(namedest[j]);
    strncpy( &(namedest[j]), pCharStrings[i+1].key.data.nameP,
            pCharStrings[i+1].key.len);
    j += pCharStrings[i+1].key.len;
    namedest[j++]='\0';
  }
  bufmem[i++]=NULL;
  
  return( bufmem);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1075 of file t1base.c.

{
  if (pFontBase) /* T1lib initialized --> return value from struct */
    return( pFontBase->bitmap_pad);
  else{
    if (T1_pad) 
      return(T1_pad);  /* pad is explicitly set --> return that value */
    else
      return( T1GLYPH_PAD); /* not expl. set --> return compilation default */
  }
}
BBox T1_GetCharBBox ( int  FontID,
char  char1 
)

Definition at line 170 of file t1finfo.c.

{

  struct region *area;
  struct XYspace *S;    
  int mode=0;
  int i;
  
  BBox NullBBox= { 0, 0, 0, 0}; /* A bounding box containing all 0's. */
  BBox ResultBox= { 0, 0, 0, 0}; /* The Box returned if char is found */
  
  unsigned char uchar1;


  /* 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_GetCharBBox()", err_warn_msg_buf,
              T1LOG_ERROR);
    return( NullBBox);
  }

  
  uchar1=(unsigned char) char1;
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NullBBox);
  }

  /* If no AFM info is present, we return an error */
  if (pFontBase->pFontArray[FontID].pAFMData==NULL) {
    T1_errno=T1ERR_NO_AFM_DATA;
    return( NullBBox);
  }
  
  
  /* Check for a font slant */
  if ((pFontBase->pFontArray[FontID].slant!=0.0)
      &&(ForceAFMBBox==0)
      &&(ForceAFMBBoxInternal==0)){
    /* We have a font slant -> character outline must be examined in order
       to determine bounding box */
    /* Set up an identity charspace matrix 
       and take a slant and an extension into account */
    /* And make it permanent, to plug a memory leak */
    S=(struct XYspace *)IDENTITY;
    S=(struct XYspace *)Permanent
      (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0],
               pFontBase->pFontArray[FontID].FontTransform[1],
               pFontBase->pFontArray[FontID].FontTransform[2],
               pFontBase->pFontArray[FontID].FontTransform[3]));
    /* Genrate an edgelist for the current character at size 1000bp
       using current transformation and encoding: */
    area=fontfcnB( FontID, 0, S,
                 pFontBase->pFontArray[FontID].pFontEnc,
                 (int) uchar1, &mode,
                 pFontBase->pFontArray[FontID].pType1Data,
                 DO_RASTER,0.0f);
    /* Read out bounding box */
    ResultBox.llx =area->xmin;
    ResultBox.urx =area->xmax;
    ResultBox.lly =area->ymin;
    ResultBox.ury =area->ymax;
    
    /* Reset AFM-switch and return BBox */
    ForceAFMBBoxInternal=0;
    /* make sure to destroy 'area' before leaving! */
    KillRegion (area);
    /* make sure to free S */
    if (S) {
      KillSpace (S);
    }
    return(ResultBox);
  }
  else{
    /* Assign bounding box for the different cases: */
    /* Check if character is  */
    if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]>0) { /* ordinary char */
      ResultBox=(pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]-1].charBBox);
    }
    else if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]<0) { /* composite char */
      ResultBox=(pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)].charBBox);
    }
    else { /* undefined char */
      return(NullBBox);
    }
    
    /* .. and apply transformations: */
    ResultBox.llx *=pFontBase->pFontArray[FontID].extend;
    ResultBox.urx *=pFontBase->pFontArray[FontID].extend;
    
    return(ResultBox);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetCharName ( int  FontID,
char  char1 
)

Definition at line 466 of file t1finfo.c.

{
  static char cc_name1[256];
  char *c1;
  

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

  if (pFontBase->pFontArray[FontID].pFontEnc==NULL){
    /* We have to get the names from the fonts internal encoding */
    c1= (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP;
    strncpy(cc_name1,
           (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP,
           pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len);
    cc_name1[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len]=0;
  }
  else{
    /* Take names from explicitly loaded and assigned encoding */
    c1=pFontBase->pFontArray[FontID].pFontEnc[(unsigned char)char1];
    strcpy(cc_name1,c1);
  }

  /* Return address of charname */
  return(cc_name1);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

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);
}
char* T1_GetCharString ( int  FontID,
char *  charname,
int len 
)

Definition at line 881 of file t1subset.c.

{

  static char *charstring=NULL;
  
  if (T1_CheckForFontID(FontID)!=1) {
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  } 
  
  if ( (charname==NULL) || (len==0) ) {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NULL);
  } 

  if ((locateCharString( FontID, charname))==0) {
    *len=0;
    T1_errno=T1ERR_UNSPECIFIED;
    return( NULL);
  }
  
  if (charstring!=NULL) {
    free( charstring);
    charstring=NULL;
  }
  if ((charstring=(char *)malloc( charstringL))==NULL) {
    *len=0;
    T1_errno=T1ERR_ALLOC_MEM;
    return( NULL);
  }

  memcpy( charstring, charstringP, charstringL);
  *len=charstringL;
  return( charstring);
  
}
int T1_GetCharWidth ( int  FontID,
char  char1 
)

Definition at line 127 of file t1finfo.c.

{
  unsigned char uchar1;

  uchar1=(unsigned char) char1;
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0);
  }
  
  /* If no AFM info is present, we return an error */
  if (pFontBase->pFontArray[FontID].pAFMData==NULL) {
    T1_errno=T1ERR_NO_AFM_DATA;
    return( 0);
  }
  
  /* return appriate value */
  if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]>0) { /* ordinary character */
    return((int) ((pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]-1].wx) * pFontBase->pFontArray[FontID].extend));
  }
  else if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]<0) { /* composite character */
    return((int) ((pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)].wx) * pFontBase->pFontArray[FontID].extend));
  }
  else { /* undefined or .notdef */
    return(0);
  }
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

T1_COMP_CHAR_INFO* T1_GetCompCharData ( int  FontID,
char  char1 
)

Definition at line 1202 of file t1finfo.c.

{
  T1_COMP_CHAR_INFO *cci=NULL;
  CompCharData *ccd=NULL;
  int afmind=-1;
  int i;
  unsigned char uchar1;
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return( cci);
  }

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

  if ((cci=(T1_COMP_CHAR_INFO*)malloc( sizeof(T1_COMP_CHAR_INFO)))==NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    return( cci);
  }
  
  uchar1=(unsigned char)char1;
  
  /* set default values */
  cci->compchar=uchar1;
  cci->numPieces=1;
  cci->pieces=NULL;

  /* check char1 */
  if ((afmind=pFontBase->pFontArray[FontID].pEncMap[uchar1]) >= 0) {
    /* char is no composite char */
    return(cci);
  }
  
  /* character is a composite char-> retrieve index and pointer into
     AFM data */
  afmind=-(afmind+1);
  ccd=&(pFontBase->pFontArray[FontID].pAFMData->ccd[afmind]);

  /* cci->compchar is already setup correctly because char1 is a
     composite character */
  cci->numPieces=ccd->numOfPieces;
  /* we expect numPieces to be >1 */
  if ((cci->pieces=(T1_COMP_PIECE *)malloc( sizeof(T1_COMP_PIECE)*
                                       cci->numPieces))==NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    free( cci);
    return( NULL);
  }
  /* Copy information */
  for (i=0; i<cci->numPieces; i++) {
    cci->pieces[i].piece=T1_GetEncodingIndex( FontID, ccd->pieces[i].pccName);
    cci->pieces[i].deltax=ccd->pieces[i].deltax;
    cci->pieces[i].deltay=ccd->pieces[i].deltay;
  }
  return( cci);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1273 of file t1finfo.c.

{
  T1_COMP_CHAR_INFO *cci=NULL;
  CompCharData *ccd=NULL;
  int i;
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return( cci);
  }

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

  /* range check for index */
  if ((index < 0) ||
      (index >= pFontBase->pFontArray[FontID].pAFMData->numOfComps)) {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return( cci);
  }

  /* Alloc mem */
  if ((cci=(T1_COMP_CHAR_INFO*)malloc( sizeof(T1_COMP_CHAR_INFO)))==NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    return( cci);
  }
  
  /* set source pointer */
  ccd=&(pFontBase->pFontArray[FontID].pAFMData->ccd[index]);
  /* and copy information */
  cci->compchar=T1_GetEncodingIndex( FontID, ccd->ccName);
  cci->numPieces=ccd->numOfPieces;
  /* we expect numPieces to be >1 */
  if ((cci->pieces=(T1_COMP_PIECE *)malloc( sizeof(T1_COMP_PIECE)*
                                       cci->numPieces))==NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    free( cci);
    return( NULL);
  }
  /* Copy information */
  for (i=0; i<cci->numPieces; i++) {
    cci->pieces[i].piece=T1_GetEncodingIndex( FontID, ccd->pieces[i].pccName);
    cci->pieces[i].deltax=ccd->pieces[i].deltax;
    cci->pieces[i].deltay=ccd->pieces[i].deltay;
  }
  return( cci);
  
}

Here is the call graph for this function:

int T1_GetEncodingIndex ( int  FontID,
char *  char1 
)

Definition at line 594 of file t1finfo.c.

{
  int i;
  int len1;
  int result_index;
  char **extern_enc;
  psobj *objptr;
  
  
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }

  extern_enc=pFontBase->pFontArray[FontID].pFontEnc;

  len1=strlen( char1);
  
  /* The default return-value if character is not found: */
  result_index=-1;

  if (extern_enc==NULL) {
    objptr=&(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[0]);
    /* We have to search the fonts internal encoding */
    for (i=0;i<256;i++){
      if (len1==objptr[i].len){
       if (strncmp((char *)objptr[i].data.arrayP,
                  char1, objptr[i].len)==0){ 
         result_index=i; 
         break; 
       }
      }
    }
    
  }
  else {
    /* Take name from explicitly loaded and assigned encoding */
    for (i=0;i<256;i++){
      if (strcmp(extern_enc[i], char1)==0){
       result_index=i;
       break;
      }
    }
  }

  return(result_index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int* T1_GetEncodingIndices ( int  FontID,
char *  char1 
)

Definition at line 645 of file t1finfo.c.

{
  int i;
  int endmark=0;
  int len1;
  char **extern_enc;
  psobj *objptr;
  /* the following array suffices for the extreme unlikely case of a font
     where one single fillsthe whole encoding vector */
  static int indices[257];

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

  extern_enc=pFontBase->pFontArray[FontID].pFontEnc;

  len1=strlen( char1);
  
  if (extern_enc==NULL) {
    objptr=&(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[0]);
    /* We have to search the fonts internal encoding */
    for (i=0;i<256;i++){
      if (len1==objptr[i].len){
       if (strncmp((char *)objptr[i].data.arrayP,
                  char1, objptr[i].len)==0){ 
         indices[endmark++]=i; 
       }
      }
    }
  }
  else {
    /* Take name from explicitly loaded and assigned encoding */
    for (i=0;i<256;i++){
      if (strcmp(extern_enc[i], char1)==0){
       indices[endmark++]=i; 
      }
    }
  }

  indices[endmark]=-1;
  return((int *)indices);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetEncodingScheme ( int  FontID)

Definition at line 769 of file t1enc.c.

{
  
  static char enc_scheme[256];
  
  /* First, check for valid font ID residing in memory: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }

  if (pFontBase->pFontArray[FontID].pFontEnc==NULL){
    if (pFontBase->pFontArray[FontID].info_flags & USES_STANDARD_ENCODING){
      strcpy( enc_scheme, "StandardEncoding");
    }
    else {
      strcpy( enc_scheme, "FontSpecific");
    }
  }
  else
    strcpy( enc_scheme, pFontBase->pFontArray[FontID].pFontEnc[256]);
  
  return(enc_scheme);
  
}

Here is the call graph for this function:

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);
}
char* T1_GetFamilyName ( int  FontID)

Definition at line 377 of file t1finfo.c.

{
  static char familyname[MAXPSNAMELEN];
  
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  strncpy(familyname,
         (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.data.nameP),
         pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.len);
  familyname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.len]=0;
    
  return(familyname);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetFileSearchPath ( int  type)

Definition at line 714 of file t1env.c.

{
  static char *out_ptr;
  int i;
  int pathlen;
  char **src_ptr=NULL;
  

  if (out_ptr!=NULL)
    free( out_ptr);
  out_ptr=NULL;
  
  if (type & T1_PFAB_PATH) {
    src_ptr=T1_PFAB_ptr;
  }
  else  if (type & T1_AFM_PATH) {
    src_ptr=T1_AFM_ptr;
  }
  else if (type & T1_ENC_PATH) {
    src_ptr=T1_ENC_ptr;
  }
  else if (type & T1_FDB_PATH) {
    src_ptr=T1_FDB_ptr;
  }
  
  
  i=0;
  pathlen=0;
  while (src_ptr[i]!=NULL) {
    pathlen +=strlen( src_ptr[i++]);
    pathlen+=1; /* path separator */
  }
  if ((out_ptr=(char *)malloc(pathlen+1))==NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    return( NULL);
  }
  strcpy( out_ptr, src_ptr[0]);
  i=1;
  while (src_ptr[i]!=NULL) {
    strcat( out_ptr, path_sep_string);
    strcat( out_ptr, src_ptr[i++]);
  }
  
  return( out_ptr);

}

Here is the call graph for this function:

Here is the caller graph for this function:

BBox T1_GetFontBBox ( int  FontID)

Definition at line 997 of file t1finfo.c.

{
  
  BBox outbox= { 0, 0, 0, 0}; 
  struct ps_obj *obj;

  /* return Null-box if font not loaded */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(outbox);
  }

  /* As suggested by Derek B. Noonburg (xpdf-Author), we allow the
     FontBBox also to be specified by real numbers. */
  obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[0]);
  outbox.llx =
    objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ?
    (int) ceil(obj->data.real) : (int) floor(obj->data.real);
  obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[1]);
  outbox.lly =
    objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ?
    (int) ceil(obj->data.real) : (int) floor(obj->data.real);
  obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[2]);
  outbox.urx =
    objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ?
    (int) ceil(obj->data.real) : (int) floor(obj->data.real);
  obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[3]);
  outbox.ury =
    objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ?
    (int) ceil(obj->data.real) : (int) floor(obj->data.real);
  
  return( outbox);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetFontFileName ( int  FontID)

Definition at line 772 of file t1base.c.

{

  static char filename[MAXPATHLEN+1];
  
  if (T1_CheckForInit())return(NULL);

  /* Check first for valid FontID */
  if ((FontID<0) || (FontID>FontBase.no_fonts)){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  strcpy( filename, pFontBase->pFontArray[FontID].pFontFileName);
  
  return( filename);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetFontFilePath ( int  FontID)

Definition at line 1139 of file t1base.c.

{

  static char filepath[MAXPATHLEN+1];
  char *FileNamePath=NULL;
  
  /* is initialzed? */
  if (T1_CheckForInit()) {
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  /* Check first for valid FontID */
  if ((FontID<0) || (FontID>FontBase.no_fonts)){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }

  /* lib is initialized and FontID is valid ->
     we can really expect a name */
  if ((FileNamePath=intT1_Env_GetCompletePath( pFontBase->pFontArray[FontID].pFontFileName, 
                                          T1_PFAB_ptr))==NULL) { 
    T1_PrintLog( "T1_GetFontFilePath()", "Couldn't locate font file for font %d in %s", 
               T1LOG_WARNING, FontID, T1_GetFileSearchPath(T1_PFAB_PATH)); 
    T1_errno=T1ERR_FILE_OPEN_ERR; 
    return(NULL); 
  } 
  
  strcpy( filepath, FileNamePath);
  free( FileNamePath);
  
  return( filepath);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetFontName ( int  FontID)

Definition at line 333 of file t1finfo.c.

{
  static char fontname[MAXPSNAMELEN];
  
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  strncpy(fontname,
         (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.data.nameP),
         pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.len);
  fontname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.len]=0;
    
  return(fontname);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetFullName ( int  FontID)

Definition at line 355 of file t1finfo.c.

{
  static char fullname[MAXPSNAMELEN];
  
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  strncpy(fullname,
         (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.data.nameP),
         pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.len);
  fullname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.len]=0;
    
  return(fullname);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_GetIsFixedPitch ( int  FontID)

Definition at line 318 of file t1finfo.c.

{
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }
  
  return((int)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ISFIXEDPITCH].value.data.boolean));
}

Here is the call graph for this function:

Here is the caller graph for this function:

float T1_GetItalicAngle ( int  FontID)

Definition at line 303 of file t1finfo.c.

{
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }
  
  return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ITALICANGLE].value.data.real));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_GetKerning ( int  FontID,
char  char1,
char  char2 
)

Definition at line 85 of file t1finfo.c.

{
  METRICS_ENTRY entry;
  METRICS_ENTRY *target_pair=NULL;
  

  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0);
  }

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

  /* if there's no kerning info, return immediately */
  if (pFontBase->pFontArray[FontID].KernMapSize==0)
    return( 0);
  
  entry.chars=(char1<<8) | char2;
  if ((target_pair=(METRICS_ENTRY *)
       bsearch( &entry, pFontBase->pFontArray[FontID].pKernMap,
              (size_t) pFontBase->pFontArray[FontID].KernMapSize,
              sizeof(METRICS_ENTRY),
              &cmp_METRICS_ENTRY))==NULL)
    return(0);
  else
    return( target_pair->hkern * pFontBase->pFontArray[FontID].extend);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_GetlenIV ( int  FontID)

Definition at line 924 of file t1subset.c.

{
  
  if (T1_CheckForFontID(FontID)!=1) {
    T1_errno=T1ERR_INVALID_FONTID;
    return( -2);
  } 
  return( pFontBase->pFontArray[FontID].pType1Data->Private[LENIV].value.data.integer);

}
char* T1_GetLibIdent ( void  )

Definition at line 1113 of file t1base.c.

{
  static char buf[15];

  sprintf( buf, "%s", T1LIB_IDENT);
  
  return( (char *)buf);
}

Here is the call graph for this function:

Here is the caller 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);
  
}
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);

}
METRICSINFO T1_GetMetricsInfo ( int  FontID,
char *  string,
int  len,
long  spaceoff,
int  kerning 
)

Definition at line 892 of file t1finfo.c.

{

  BBox NullBBox= { 0, 0, 0, 0}; /* A bounding box containing all 0's. */
  BBox tmp_BBox= { 0, 0, 0, 0}; 


  int i;
  int no_chars;
  
  int curr_width=0;
  int spacewidth=0;
  
  int rsb_max=-30000;
  int lsb_min= 30000;
  int overallascent=-30000;
  int overalldescent=30000;

  static METRICSINFO metrics={ 0, {0, 0, 0, 0}, 0, NULL};

  unsigned char *ustring;

  
  ustring=(unsigned char *) string;
  
  /* Reset struct: */
  metrics.width=0;
  metrics.bbox=NullBBox;
  metrics.numchars=0;
  if (metrics.charpos != NULL){
    free( metrics.charpos);
    metrics.charpos=NULL;
  }


  /* First, check for a correct ID */
  i=T1_CheckForFontID(FontID);
  if (i!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(metrics);
  }
  
  /* If no AFM info is present, we return an error */
  if (pFontBase->pFontArray[FontID].pAFMData==NULL) {
    T1_errno=T1ERR_NO_AFM_DATA;
    return( metrics);
  }

  /* Get length of string: */
  if (len<0 || ustring==NULL ) {  /* invalid length or NULL_pointer */
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(metrics);
  }
  
  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;

  /* Compute the correct spacewidth value (in charspace units): */
  spacewidth=T1_GetCharWidth(FontID,pFontBase->pFontArray[FontID].space_position)+spaceoff;

  /* Allocate memory for character positions array: */
  metrics.charpos=(int *)calloc(no_chars, sizeof(int));

  metrics.numchars=no_chars;
  
  /* Accumulate metrics: */
  for (i=0; i<no_chars; i++){
    /* Save current offst to array */
    metrics.charpos[i]=curr_width;
    if (string[i]==pFontBase->pFontArray[FontID].space_position)
      curr_width +=spacewidth;
    else{
      tmp_BBox=T1_GetCharBBox( FontID, string[i]);
      if (curr_width+tmp_BBox.llx < lsb_min)
       lsb_min=curr_width+tmp_BBox.llx;
      if (curr_width+tmp_BBox.urx > rsb_max)
       rsb_max=curr_width+tmp_BBox.urx;
      if (tmp_BBox.lly < overalldescent)
       overalldescent=tmp_BBox.lly;
      if (tmp_BBox.ury > overallascent)
       overallascent=tmp_BBox.ury;
      curr_width +=T1_GetCharWidth( FontID, string[i]);
      if ((i<no_chars-1) && (kerning != 0))
       curr_width += T1_GetKerning( FontID, string[i], string[i+1]);
    }
  }

  metrics.width   =curr_width;
  metrics.bbox.llx=lsb_min;
  metrics.bbox.lly=overalldescent;
  metrics.bbox.urx=rsb_max;
  metrics.bbox.ury=overallascent;

  return( metrics);
  
}

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);
  
}

Definition at line 1139 of file t1finfo.c.

{
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return( -1);
  }

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

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

Here is the call graph for this function:

Definition at line 860 of file t1base.c.

{
  if (T1_CheckForInit())
    return(-1);
  return(FontBase.no_fonts);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_GetNoKernPairs ( int  FontID)

Definition at line 1100 of file t1finfo.c.

{
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return( -1);
  }

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

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

Here is the call graph for this function:

char* T1_GetNotice ( int  FontID)

Definition at line 443 of file t1finfo.c.

{
  static char notice[2048];
  
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  strncpy(notice,
         (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.data.nameP),
         pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.len);
  notice[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.len]=0;
    
  return(notice);
  
}

Here is the call graph for this function:

Here is the caller 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);
}
BBox T1_GetStringBBox ( int  FontID,
char *  string,
int  len,
long  spaceoff,
int  kerning 
)

Definition at line 816 of file t1finfo.c.

{

  BBox NullBBox= { 0, 0, 0, 0}; /* A bounding box containing all 0's. */
  BBox tmp_BBox= { 0, 0, 0, 0}; 
  BBox ResultBBox= { 0, 0, 0, 0}; /* The resulting BBox */
  int i;
  int no_chars;
  int curr_width=0;
  int spacewidth=0;
  
  int rsb_max=-30000;
  int lsb_min= 30000;
  int overallascent=-30000;
  int overalldescent=30000;

  
  /* First, check for a correct ID */
  i=T1_CheckForFontID(FontID);
  if (i!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NullBBox);
  }
  
  /* If no AFM info is present, we return an error */
  if (pFontBase->pFontArray[FontID].pAFMData==NULL) {
    T1_errno=T1ERR_NO_AFM_DATA;
    return( NullBBox);
  }

  /* Get length of string: */
  if (len<0 || string==NULL) {  /* invalid length or NULL-pointer */
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NullBBox);
  }
  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;
  
  spacewidth=
    T1_GetCharWidth(FontID,pFontBase->pFontArray[FontID].space_position)+spaceoff;
  
  /* Accumulate metrics: */
  for (i=0; i<no_chars; i++){
    if (string[i]==pFontBase->pFontArray[FontID].space_position)
      curr_width +=spacewidth;
    else{
      tmp_BBox=T1_GetCharBBox( FontID, string[i]);
      if (curr_width+tmp_BBox.llx < lsb_min)
       lsb_min=curr_width+tmp_BBox.llx;
      if (curr_width+tmp_BBox.urx > rsb_max)
       rsb_max=curr_width+tmp_BBox.urx;
      if (tmp_BBox.lly < overalldescent)
       overalldescent=tmp_BBox.lly;
      if (tmp_BBox.ury > overallascent)
       overallascent=tmp_BBox.ury;
      curr_width +=T1_GetCharWidth( FontID, string[i]);
      if ((i<no_chars-1) && (kerning != 0))
       curr_width += T1_GetKerning( FontID, string[i], string[i+1]);
    }
  }

  ResultBBox.llx=lsb_min;
  ResultBBox.lly=overalldescent;
  ResultBBox.urx=rsb_max;
  ResultBBox.ury=overallascent;
  
  return( ResultBBox);
  
}

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);
}
int T1_GetStringWidth ( int  FontID,
char *  string,
int  len,
long  spaceoff,
int  kerning 
)

Definition at line 698 of file t1finfo.c.

{

  int no_chars;      /* Number of chars in string */
  int i;
  int *kern_pairs;
  int *charwidths;
  int spacewidth; 
  int stringwidth;

  unsigned char *ustring;

  ustring=(unsigned char *) string;
  
  /* First, check for a correct ID */
  i=T1_CheckForFontID(FontID);
  if (i!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0);
  }
  
  /* If no AFM info is present, we return an error */
  if (pFontBase->pFontArray[FontID].pAFMData==NULL) {
    T1_errno=T1ERR_NO_AFM_DATA;
    return( 0);
  }

  /* Get length of string: */
  if (len<0 || ustring == NULL){  /* invalid length or NULL-pointer */
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(0);
  }
  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;

  switch (no_chars) {
    case 0:
      /* Empty string has width 0 */
      stringwidth=0;
      break;

    case 1:
      /* Width of string with 1 character is the width of that character.
         If the character is a space, adjust by the value of spaceoff.
         */
      stringwidth=T1_GetCharWidth(FontID,ustring[0]);
      if (ustring[0]==pFontBase->pFontArray[FontID].space_position)
        stringwidth+=spaceoff;
      break;

    default:
      /* Two or more characters.  Add widths of characters and adjust by
         the adjustment widths for any kerning pairs.  For spaces, use the
         width of the space character in the font adjusted by the value of
         spaceoff.
         */
    
      /* Allocate room for temporary arrays of kerning and width arrays: */
      kern_pairs=(int *)calloc(no_chars -1, sizeof(int));
      if (kern_pairs==NULL){
        T1_errno=T1ERR_ALLOC_MEM;
        return(0);
      }
      charwidths=(int *)calloc(no_chars, sizeof(int));
      if (charwidths==NULL){
        T1_errno=T1ERR_ALLOC_MEM;
        return(0);
      }
  
      /* If kerning is requested, get kerning amounts and fill the array: */
      if (kerning){
        for (i=0; i<no_chars -1; i++){
          kern_pairs[i]=T1_GetKerning( FontID, ustring[i], ustring[i+1]);
        }
      }
  
      /* Compute the correct spacewidth value (in charspace units): */
      spacewidth=T1_GetCharWidth(FontID,pFontBase->pFontArray[FontID].space_position)+spaceoff;
  
      /* Fill the width-array:  */
      for (i=0; i<no_chars; i++){
        if (ustring[i]==pFontBase->pFontArray[FontID].space_position)
          charwidths[i]=(int)spacewidth;
        else
          charwidths[i]=T1_GetCharWidth(FontID,ustring[i]);
      }
  
      /* Accumulate width: */
      stringwidth=0;
      for (i=0; i<no_chars-1; i++){
        stringwidth += kern_pairs[i];
      }
      for (i=0; i<no_chars; i++){
        stringwidth += charwidths[i];
      }
  
      /* free memory: */
      free( charwidths);
      free( kern_pairs);

      break;
  }

  /* .. and return result: */
  return( stringwidth);
}

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;
    
}
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;  
}

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);
}
float T1_GetUnderlinePosition ( int  FontID)

Definition at line 274 of file t1finfo.c.

{
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }
  
  return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINEPOSITION].value.data.real));
}

Here is the call graph for this function:

Here is the caller graph for this function:

float T1_GetUnderlineThickness ( int  FontID)

Definition at line 289 of file t1finfo.c.

{
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(0.0);
  }
  
  return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINETHICKNESS].value.data.real));
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetVersion ( int  FontID)

Definition at line 421 of file t1finfo.c.

{
  static char version[2048];
  
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  strncpy(version,
         (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.data.nameP),
         pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.len);
  version[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.len]=0;
    
  return(version);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* T1_GetWeight ( int  FontID)

Definition at line 399 of file t1finfo.c.

{
  static char weight[128];
  
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(NULL);
  }
  
  strncpy(weight,
         (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.data.nameP),
         pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.len);
  weight[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.len]=0;
    
  return(weight);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* T1_InitLib ( int  log)

Definition at line 132 of file t1base.c.

{
  int result;
  int i;
  
  char *usershome=NULL;
  char *logfilepath=NULL;
  char *envlogreq=NULL;
  int  usrforcelog=0;
  
  
  
  /* Reset T1_errno */
  T1_errno=0;
  
  /* Assign pointer to global struct and set entry padding: */
  pFontBase=&FontBase;
  if (T1_pad)
    pFontBase->bitmap_pad=T1_pad;
  else
    pFontBase->bitmap_pad=T1GLYPH_PAD;

  pFontBase->pFontArray = NULL;
  pFontBase->t1lib_flags=0;
  /* Check for AA-caching */
  if ((log & T1_AA_CACHING)){
    pFontBase->t1lib_flags |= T1_AA_CACHING;
  }
  /* Check for AFM disable */
  if ((log & T1_NO_AFM)) {
    pFontBase->t1lib_flags |= T1_NO_AFM;
  }

  /* Check environment variable ENV_LOG_STRING. By this means, a user may
     generate a log file even if at compile time log file creation has
     been suppressed. Of course, if the loglevel is reduced after
     initialization by the programmer, this environment variable takes
     no effect! */
  if ((envlogreq=getenv(ENV_LOG_STRING))!=NULL) {
    if (strcmp( envlogreq, "logDebug")==0)
      T1_SetLogLevel( T1LOG_DEBUG);
    else if (strcmp( envlogreq, "logStatistic")==0)
      T1_SetLogLevel( T1LOG_STATISTIC);
    else if (strcmp( envlogreq, "logWarning")==0)
      T1_SetLogLevel( T1LOG_WARNING);
    else if (strcmp( envlogreq, "logError")==0)
      T1_SetLogLevel( T1LOG_ERROR);
    usrforcelog=1;
  }
  
  /* Open log-file: */
  t1lib_log_file=NULL;
  if ((log & LOGFILE) || (usrforcelog!=0)) {
    pFontBase->t1lib_flags |= LOGFILE;
    /* Try first opening in current directory: */
    if ((t1lib_log_file=fopen( T1_LOG_FILE, "wb"))==NULL) {
      if ((usershome=getenv("HOME"))!=NULL) {
       logfilepath=(char *)malloc((strlen(usershome) +
                                strlen(T1_LOG_FILE) + 2
                                ) * sizeof(char));
       strcpy( logfilepath, usershome);
       strcat( logfilepath, DIRECTORY_SEP);
       strcat( logfilepath, T1_LOG_FILE);
       if ((t1lib_log_file=fopen( logfilepath, "wb"))==NULL){
         t1lib_log_file=stderr;
       }
       free( logfilepath);
      }
      else {
       t1lib_log_file=stderr;
      }
    }
    if (t1lib_log_file==stderr) {
      T1_PrintLog( "T1_InitLib()", "Unable to open a logfile, using stderr",
                 T1LOG_ERROR);
    }
  }
  
  T1_PrintLog( "T1_InitLib()", "Initialization started",
              T1LOG_STATISTIC);
  /* Check for representation of data in memory: */
  if ((pFontBase->endian=T1_CheckEndian())){
    T1_PrintLog( "T1_InitLib()", "Using Big Endian data presentation (MSBFirst)",
               T1LOG_DEBUG);
    pFontBase->endian=1;
  }
  else{
    T1_PrintLog( "T1_InitLib()", "Using Little Endian data presentation (LSBFirst)",
               T1LOG_DEBUG);
    pFontBase->endian=0;
  }

  /* Save version identifier */
  sprintf( err_warn_msg_buf, "Version Identifier: %s", T1LIB_IDENT);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf,
              T1LOG_DEBUG);
  /* Save how t1lib is initialized */
  sprintf( err_warn_msg_buf, "Initialization flags: 0x%X", log);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf,
              T1LOG_DEBUG);
  /* Save padding value in log file */
  sprintf( err_warn_msg_buf, "Glyphs are padded to %d bits",
          pFontBase->bitmap_pad);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf,
              T1LOG_DEBUG);
#ifdef __CHAR_UNSIGNED__
  T1_PrintLog( "T1_InitLib()", "System-Info: char is unsigned",
              T1LOG_DEBUG);
#else
  T1_PrintLog( "T1_InitLib()", "System-Info: char is signed",
              T1LOG_DEBUG);
#endif
  sprintf( err_warn_msg_buf, "System-Info: sizeof(char):         %d",
          SIZEOF_CHAR);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(short):        %d",
          SIZEOF_SHORT);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(int):          %d",
          SIZEOF_INT);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(long):         %d",
          SIZEOF_LONG);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(long long):    %d",
          SIZEOF_LONG_LONG);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(float):        %d",
          SIZEOF_FLOAT);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(double):       %d",
          SIZEOF_DOUBLE);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(long double):  %d",
          SIZEOF_LONG_DOUBLE);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "System-Info: sizeof(void *):       %d",
          SIZEOF_VOID_P);
  T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG);
  
  intT1_SetupDefaultSearchPaths();
  if (log & IGNORE_CONFIGFILE) {
    pFontBase->t1lib_flags |= IGNORE_CONFIGFILE;
    T1_PrintLog( "T1_InitLib()", "Skipping configuration file search!",
               T1LOG_STATISTIC);
  }
  else {
    if ((result=intT1_ScanConfigFile())==0)
      T1_PrintLog( "T1_InitLib()", "Warning t1lib configuration file not found!",
                 T1LOG_WARNING);
  }
  
  /* Initialize builtin Standard Encoding */
  if ( !(Init_BuiltInEncoding()) ) {
      T1_PrintLog( "T1_InitLib()", "Unable initialize internal StandardEncoding!",
                 T1LOG_ERROR);
  }
  
  /* Set the default encoding to the fonts' internal encoding */
  pFontBase->default_enc=NULL;
  
  /* Initialize the no_fonts... values */
  pFontBase->no_fonts=0;
  pFontBase->no_fonts_ini=pFontBase->no_fonts;
  pFontBase->no_fonts_limit=pFontBase->no_fonts;

  
  /* Check whether to read font database */
  if ((log & IGNORE_FONTDATABASE)){
    pFontBase->t1lib_flags |= IGNORE_FONTDATABASE;

    T1_Up=1;         /* System has been initialized ! */
    T1_PrintLog( "T1_InitLib()", "Initialization successfully finished (Database empty)",
               T1LOG_STATISTIC);
    
    return((void *) pFontBase);
  }

  result=0;
  /* Read fontdatabase(s) */
  i=0;
  while (T1_FDB_ptr[i]!=NULL) {
    if ((result=intT1_scanFontDBase(T1_FDB_ptr[i]))==-1){
      T1_PrintLog( "T1_InitLib()", "Fatal error scanning Font Database File %s",
                 T1LOG_WARNING, T1_FDB_ptr[i]);
    }
    if (result>-1)
      pFontBase->no_fonts+=result;
    i++;
    
  }
  if (result == 0){
    T1_PrintLog( "T1_InitLib()", "No fonts from Font Database File(s) found (T1_errno=%d)",
               T1LOG_ERROR, T1_errno);
    return(NULL);
  }

  /* Initialize the no_fonts... values */
  pFontBase->no_fonts_ini=pFontBase->no_fonts;
  pFontBase->no_fonts_limit=pFontBase->no_fonts;

  T1_Up=1;         /* System has been initialized ! */
  T1_PrintLog( "T1_InitLib()", "Initialization successfully finished",
            T1LOG_STATISTIC);

  return((void *) pFontBase);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int T1_IsInternalChar ( int  FontID,
char  char1 
)

Definition at line 1331 of file t1finfo.c.

{
  unsigned char uchar1;
  char *charname;
  psdict *pCharStrings;
  int len, i, j;
  
  /* return NULL if font not loaded */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return( -1);
  }
  
  pCharStrings=pFontBase->pFontArray[FontID].pType1Data->CharStringsP;
  uchar1=(unsigned char)char1;

  charname=T1_GetCharName( FontID, uchar1);
  
  /* First, get the maximum number of charstrings: */
  len=pCharStrings[0].key.len;

  /* Check all CharString definitions */
  for ( i=1; i<=len; i++) {
    /* if len=0, then the CharStrings dict is larger that required which
       is valid and allowed by the spec.*/ 
    if ((j=pCharStrings[i].key.len)!=0) {
      if ( (j==strlen(charname)) &&
          (strncmp( charname, pCharStrings[i].key.data.nameP, j)==0) ) {
       /* we have found an internal definition */
       return( 1);
      }
    }
  }
  return( 0);
}

Here is the call graph for this function:

char** T1_LoadEncoding ( char *  FileName)

Definition at line 579 of file t1enc.c.

{
  char **Encoding;
  char *EncFileName;
  
  if( FileName==NULL){
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(NULL);
  }
  
  if ((EncFileName=intT1_Env_GetCompletePath( FileName, T1_ENC_ptr))==NULL){
    T1_errno=T1ERR_FILE_OPEN_ERR;
    return(NULL);
  }
  Encoding=ScanEncodingFile(EncFileName);
  free(EncFileName);
  
  return(Encoding);
}

Here is the call graph for this function:

int T1_LoadFont ( int  FontID)

Definition at line 83 of file t1load.c.

{
  int i, j, k, l, m;
  char *FileName, *FileNamePath;
  int mode;  /* This is used by the type1-library for error reporting */   
  char *charname;
  
  /* The following vars are used for reallocation of VM */
  long tmp_size;
  float ascender;
#ifdef ANSI_REALLOC_VM
  unsigned long shift;
  unsigned long ldummy;
  char *tmp_ptr;
#endif

  struct region *area;
  struct XYspace *S;    

  /* These are for constructing the kerning lookup table: */
  PairKernData *pkd;
  METRICS_ENTRY *kern_tbl;
  int char1, char2;
  
  
  if (T1_CheckForInit()){
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }
  

  i=T1_CheckForFontID(FontID);
  if (i==1)
    return(0);      /* Font already loaded */
  if (i==-1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);     /* illegal FontID */
  }
  
  /* Allocate memory for ps_font structure: */
  if ((pFontBase->pFontArray[FontID].pType1Data=(psfont *)malloc(sizeof(psfont)))==NULL){
    T1_PrintLog( "T1_LoadFont()", "Failed to allocate memory for psfont-struct (FontID=%d)",
               T1LOG_ERROR, FontID);
    T1_errno=T1ERR_ALLOC_MEM;
    return(-1);
  }

  /* Check for valid filename */
  if ((FileName=T1_GetFontFileName(FontID))==NULL){
    T1_PrintLog( "T1_LoadFont()", "No font file name for font %d", T1LOG_ERROR, FontID);
    return(-1);
  }
  
  /* Fetch the full path of type1 font file */
  if ((FileNamePath=intT1_Env_GetCompletePath( FileName,
                                    T1_PFAB_ptr))==NULL){
    T1_PrintLog( "T1_LoadFont()", "Couldn't locate font file for font %d in %s",
               T1LOG_ERROR, FontID, T1_GetFileSearchPath(T1_PFAB_PATH));
    T1_errno=T1ERR_FILE_OPEN_ERR;
    return(-1);
  }
  
  /* And load all PostScript information into memory */
  if (fontfcnA( FileNamePath, &mode,
              pFontBase->pFontArray[FontID].pType1Data) == FALSE){
    T1_PrintLog( "T1_LoadFont()", "Loading font with ID = %d failed! (mode = %d)",
               T1LOG_ERROR, FontID, mode);
    free(FileNamePath);
    pFontBase->pFontArray[FontID].pType1Data=NULL;
    T1_errno=mode;
    return(-1);
  }
  free(FileNamePath);

  
  /* Store the base address of virtual memory and realloc in order not
     to waste too much memory: */
  pFontBase->pFontArray[FontID].vm_base=vm_base; 
#ifdef ANSI_REALLOC_VM
  /* We first get the size of pointers on the current system */
  /* Get size of VM, ... */
  tmp_size=((unsigned long)vm_used - (unsigned long)vm_base); 
  /* ... realloc to that size ... */
  tmp_ptr=(char *)realloc(vm_base,  tmp_size); 
  /* ... and shift all pointers refering to that area */
  if (tmp_ptr > vm_base){
    shift= (unsigned long)tmp_ptr - (unsigned long)vm_base;
    sprintf( err_warn_msg_buf,
            "Old VM at 0x%lX, new VM at 0x%lX, shifting up by %lu",
            (unsigned long)vm_base, (unsigned long)tmp_ptr, tmp_size);
    T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
    
    /* We start by shifting the topmost pointers: */
    pFontBase->pFontArray[FontID].vm_base=tmp_ptr;
    
    ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->vm_start);
    ldummy +=shift;
    pFontBase->pFontArray[FontID].pType1Data->vm_start=(char *)ldummy;
    
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP;
    ldummy +=shift;
    pFontBase->pFontArray[FontID].pType1Data->CharStringsP=(psdict *)ldummy;
    
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private;
    ldummy +=shift;
    pFontBase->pFontArray[FontID].pType1Data->Private=(psdict *)ldummy;
    
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP;
    ldummy +=shift;
    pFontBase->pFontArray[FontID].pType1Data->fontInfoP=(psdict *)ldummy;
    
    ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->BluesP);
    ldummy +=shift;
    pFontBase->pFontArray[FontID].pType1Data->BluesP=(struct blues_struct *)ldummy;
    
    /* We now have to care for correcting all pointers which are in the VM
       and refer to some place in the VM! Note: Instead of selecting the
       appropriate pointer-elements of the union we simply shift the
       unspecified pointer "valueP".
       Note: The filename entry does not need to be modified since it does not
       need to be shifted since it points to memory managed by t1lib.
       */
    /* FontInfo-dictionary: All name-pointers and the pointers to all array
       types have to be shifted: */
    i=pFontBase->pFontArray[FontID].pType1Data->fontInfoP[0].key.len;
    for (j=1; j<=i; j++){
      if ((pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ARRAY) ||
         (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_STRING) ||
         (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_NAME) ||
         (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_FILE)){
       ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP;
       ldummy +=shift;
       pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy;
      }
      /* The encoding needs special treatment: */
      if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ENCODING){
       /* If a builtin encoding is used, it is sufficient to shift the pointer
          to the Encoding since the character-namestrings of builtin encodings
          are static and thus located on the heap.
          For font-specific encoding, character-namestrings reside in VM and
          thus each entry has to be shifted. 
          Caution: We still have to shift the builtin encoding-pointer, since
          they also point to are located in VM: */
       ldummy=(long)StdEncArrayP;
       ldummy +=shift;
       StdEncArrayP=(psobj *)ldummy;
       ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP;
       ldummy +=shift;
       pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy;
       if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP
           == StdEncArrayP){ /* Font uses builtin standard encoding */
         ;
       } 
       else{ /* Font-specific encoding */ 
         for (k=0; k<256; k++){
           ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP;
           /* The ".notdef" is also static and may not be shifted (Thanks, Derek ;) */
           if (ldummy != (unsigned long)not_def) {
             ldummy +=shift;
             pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP=(struct ps_obj *)ldummy;
           }
         }
       }
      } /* end of encoding-handling */
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP;
      ldummy +=shift;
      pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP=(char *)ldummy;
    } /* fontinfo-dict done */
    
    /* Private-dictionary: All name-pointers and the pointers to all array
       types have to be shifted: */
    i=pFontBase->pFontArray[FontID].pType1Data->Private[0].key.len;
    for (j=1; j<=i; j++){
      if ((pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_ARRAY) ||
         (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_STRING) ||
         (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_NAME) ||
         (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_FILE)){
       ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP;
       ldummy +=shift;
       pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP=(char *)ldummy;
      }
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP;
      ldummy +=shift;
      pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP=(char *)ldummy;
    }
    
    /* BluesP: The entry "next" is the only pointer in blues_struct. Although it is
       not used anywhere we should shift it for correctness reasons (in case its not
       NULL)! */
    if (pFontBase->pFontArray[FontID].pType1Data->BluesP->next != NULL){
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->BluesP->next;
      ldummy +=shift;
      pFontBase->pFontArray[FontID].pType1Data->BluesP->next=(struct blues_struct *)ldummy;
    }
    
    /* The CharStrings-dictionary: Every namepointer and its corresponding
       charstring has to be shifted: */
    i=pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len;
    for (j=1; j<=i; j++){
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP;
      ldummy +=shift;
      pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP=(char *)ldummy;
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP;
      ldummy +=shift;
      pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP=(char *)ldummy;
    }
    
    /* The Subroutines have also to be reorganized: */
    i=pFontBase->pFontArray[FontID].pType1Data->Subrs.len;
    /* First, shift pointer to array-start and after that the pointers to
       each command string: */
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP;
    ldummy +=shift;
    pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP=(struct ps_obj *)ldummy;
    for (j=0; j<i; j++) {
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP;
      ldummy +=shift;
      pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP=(char *)ldummy;
    }
  } /* end of if( tmp_ptr > vm_base ) */
  else if ( vm_base > tmp_ptr){
    shift= (unsigned long)vm_base - (unsigned long)tmp_ptr;
    sprintf( err_warn_msg_buf,
            "Old VM at 0x%lX, new VM at 0x%lX, shifting down by %lu",
            (unsigned long)vm_base, (unsigned long)tmp_ptr, tmp_size);
    T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
    
    /* We start by shifting the topmost pointers: */
    pFontBase->pFontArray[FontID].vm_base=tmp_ptr;
    
    ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->vm_start);
    ldummy -=shift;
    pFontBase->pFontArray[FontID].pType1Data->vm_start=(char *)ldummy;
    
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP;
    ldummy -=shift;
    pFontBase->pFontArray[FontID].pType1Data->CharStringsP=(psdict *)ldummy;
    
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private;
    ldummy -=shift;
    pFontBase->pFontArray[FontID].pType1Data->Private=(psdict *)ldummy;
    
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP;
    ldummy -=shift;
    pFontBase->pFontArray[FontID].pType1Data->fontInfoP=(psdict *)ldummy;
    
    ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->BluesP);
    ldummy -=shift;
    pFontBase->pFontArray[FontID].pType1Data->BluesP=(struct blues_struct *)ldummy;
    
    /* We now have to care for correcting all pointers which are in the VM
       and refer to some place in the VM! Note: Instead of selecting the
       appropriate pointer-elements of the union we simply shift the
       unspecified pointer "valueP".
       Note: The filename entry does not need to be modified since it does not
       need to be shifted since it points to memory managed by t1lib.
       */
    /* FontInfo-dictionary: All name-pointers and the pointers to all array
       types have to be shifted: */
    i=pFontBase->pFontArray[FontID].pType1Data->fontInfoP[0].key.len;
    for (j=1; j<=i; j++){
      if ((pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ARRAY) ||
         (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_STRING) ||
         (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_NAME) ||
         (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_FILE)){
       ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP;
       ldummy -=shift;
       pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy;
      }
      /* The encoding needs special treatment: */
      if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ENCODING){
       /* If a builtin encoding is used, it is sufficient to shift the pointer
          to the Encoding since the character-namestrings of builtin encodings
          are static and thus located on the heap.
          For font-specific encoding, character-namestrings reside in VM and
          thus each entry has to be shifted. 
          Caution: We still have to shift the builtin encoding-pointer, since
          they also point to are located in VM: */
       ldummy=(long)StdEncArrayP;
       ldummy -=shift;
       StdEncArrayP=(psobj *)ldummy;
       ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP;
       ldummy -=shift;
       pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy;
       if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP
            == StdEncArrayP){ /* Font uses builtin encoding */
         ;
       } 
       else{ /* Font-specific encoding */ 
         for (k=0; k<256; k++){
           ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP;
           /* The ".notdef" is also static and may not be shifted (Thanks, Derek ;) */
           if (ldummy != (unsigned long)not_def) {
             ldummy -=shift;
             pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP=(struct ps_obj *)ldummy;
           }
         }
       }
      } /* end of encoding-handling */
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP;
      ldummy -=shift;
      pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP=(char *)ldummy;
    } /* fontinfo-dict done */
    
    /* Private-dictionary: All name-pointers and the pointers to all array
       types have to be shifted: */
    i=pFontBase->pFontArray[FontID].pType1Data->Private[0].key.len;
    for (j=1; j<=i; j++){
      if ((pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_ARRAY) ||
         (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_STRING) ||
         (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_NAME) ||
         (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_FILE)){
       ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP;
       ldummy -=shift;
       pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP=(char *)ldummy;
      }
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP;
      ldummy -=shift;
      pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP=(char *)ldummy;
    }
    
    /* BluesP: The entry "next" is the only pointer in blues_struct. Although it is
       not used anywhere we should shift it for correctness reasons (in case its not
       NULL)! */
    if (pFontBase->pFontArray[FontID].pType1Data->BluesP->next != NULL){
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->BluesP->next;
      ldummy -=shift;
      pFontBase->pFontArray[FontID].pType1Data->BluesP->next=(struct blues_struct *)ldummy;
    }
    
    /* The CharStrings-dictionary: Every namepointer and its corresponding
       charstring has to be shifted: */
    i=pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len;
    for (j=1; j<=i; j++){
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP;
      ldummy -=shift;
      pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP=(char *)ldummy;
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP;
      ldummy -=shift;
      pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP=(char *)ldummy;
    }
    
    /* The Subroutines have also to be reorganized: */
    i=pFontBase->pFontArray[FontID].pType1Data->Subrs.len;
    /* First, shift pointer to array-start and after that the pointers to
       each command string: */
    ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP;
    ldummy -=shift;
    pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP=(struct ps_obj *)ldummy;
    for (j=0; j<i; j++) {
      ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP;
      ldummy -=shift;
      pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP=(char *)ldummy;
    }
  } /* end of if( vm_base > tmp_ptr ) */
  else{ /* VM addess has not changed during reallocation */
    sprintf( err_warn_msg_buf,
            "Old VM and new VM at 0x%lX, no pointer-shifting",
            (unsigned long)vm_base);
    T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
  }
#endif
    
  /* Generate a message how much VM the current font consumes */
  sprintf( err_warn_msg_buf,
          "VM for Font %d: %d bytes", FontID, (int) tmp_size);
  T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC);

  
  /* Set the matrix for common transformations to "no transformations" */
  pFontBase->pFontArray[FontID].FontTransform[0]=1.0;
  pFontBase->pFontArray[FontID].FontTransform[1]=0.0;
  pFontBase->pFontArray[FontID].FontTransform[2]=0.0;
  pFontBase->pFontArray[FontID].FontTransform[3]=1.0;

  /* Now, that the font has been loaded into memory, try to find the
     FontMatrix in the font info dictionary. If it exists, load it into
     our local fontmatrix, otherwise use a default matrix which scales to
     1/1000 (since font outlines  are defined in a 1000 point space)
     and does no further transformations. */
  if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP == NULL){
    pFontBase->pFontArray[FontID].FontMatrix[0]=0.001;
    pFontBase->pFontArray[FontID].FontMatrix[1]=0.0;
    pFontBase->pFontArray[FontID].FontMatrix[2]=0.0;
    pFontBase->pFontArray[FontID].FontMatrix[3]=0.001;
  }
  else{
    pFontBase->pFontArray[FontID].FontMatrix[0]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[0].data.real;
    pFontBase->pFontArray[FontID].FontMatrix[1]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[1].data.real;
    pFontBase->pFontArray[FontID].FontMatrix[2]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[2].data.real;
    pFontBase->pFontArray[FontID].FontMatrix[3]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[3].data.real;
  }

  /* Set the default values for transformation: */
  pFontBase->pFontArray[FontID].slant=0.0;
  pFontBase->pFontArray[FontID].extend=1.0;

  
  /* Now try to load afm-structures from corresponding .afm-file (if
     not suppressed by the user). */
  if ((pFontBase->t1lib_flags & T1_NO_AFM)!=0) {
    pFontBase->pFontArray[FontID].pAFMData = NULL;
    T1_PrintLog( "T1_LoadFont()",
               "Suppressing AFM data handling on user request",
               T1LOG_STATISTIC);
  }
  else {
    if ((i=openFontMetricsFile( FontID, 0))){
      /* Try a fallback, opening sloppy: */
      if ((i=openFontMetricsFile( FontID, 1))) {
       sprintf( err_warn_msg_buf,
               "Alert: Error (%d) sloppy-processing afm-file for Font %d!",
               i ,FontID);
       T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC);
       if ((pFontBase->pFontArray[FontID].pAFMData=
            T1_GenerateAFMFallbackInfo(FontID))==NULL){
         sprintf( err_warn_msg_buf,
                 "Ultimately failed to generate metrics information Font %d!",
                 FontID);
         T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_WARNING);
       }
       else {
         pFontBase->pFontArray[FontID].info_flags |=AFM_SELFGEN_SUCCESS;
         T1_PrintLog( "T1_LoadFont()",
                     "Generating AFM-information from fontfile successful!",
                     T1LOG_STATISTIC);
       }
      }
      else {
       pFontBase->pFontArray[FontID].info_flags |=AFM_SLOPPY_SUCCESS;
       sprintf( err_warn_msg_buf,
               "Alert: Limited afm-information for Font %d",FontID);
       T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC);
      } 
    }
    else {
      pFontBase->pFontArray[FontID].info_flags |=AFM_SUCCESS;
    }
  }
  
  
  /* Now, set Encodingvector entry to default if the font's
     internal encoding is "StandardEncoding".
     */
  if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP
      == StdEncArrayP) {
    pFontBase->pFontArray[FontID].info_flags |=USES_STANDARD_ENCODING;
    pFontBase->pFontArray[FontID].pFontEnc=pFontBase->default_enc;
    sprintf( err_warn_msg_buf,
            "Font %d reencoded to default",FontID);
    T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
  }
  else {
    sprintf( err_warn_msg_buf,
            "Font %d not reencoded to default",FontID);
    T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
    pFontBase->pFontArray[FontID].pFontEnc = NULL;
  }

  
  /* If AFM-Info available we try to speed up some things: */
  if (pFontBase->pFontArray[FontID].pAFMData != NULL) {
    /* We have to fill the array that maps the current encodings' indices to the
       indices used in afm file. The interpretation has been changed in
       in t1lib-1.2. We now use positive values for indexing into the charmetrics
       array and negative values for indexing into the composite character array.
       an index of zero indicates that no metrics are defined for this character.
       This may happen because (a) not all AFM-files define metrics for the .notdef
       character, and (b) because font and AFM-file do not match. */
    if ((pFontBase->pFontArray[FontID].pEncMap=
        (int *)calloc(256,sizeof(int)))==NULL) {
      sprintf( err_warn_msg_buf, "Error allocating memory for encoding map (FontID=%d)",
              FontID);
      T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf,
               T1LOG_WARNING);
      T1_errno=T1ERR_ALLOC_MEM;
      return(-1);
    }
    for (i=0; i<256; i++) {
      charname=T1_GetCharName( FontID, i);
      /* in a first loop check for ordinary characters */
      for ( j=0; j<pFontBase->pFontArray[FontID].pAFMData->numOfChars; j++) {
       if (strcmp( charname,
                  pFontBase->pFontArray[FontID].pAFMData->cmi[j].name)==0) {
         pFontBase->pFontArray[FontID].pEncMap[i]=j+1; /* index 0 is reserved! */
         continue;
       }
      }
      /* if nothing has been found, check for composite characters */ 
      for ( j=0; j<pFontBase->pFontArray[FontID].pAFMData->numOfComps; j++) {
       if (strcmp( charname,
                  pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName)==0) {
         pFontBase->pFontArray[FontID].pEncMap[i]=-(j+1); /* index 0 is reserved! */
         continue;
       }
      }
    }
    
    /* For composite characters, we still have to compute the width and bbox */
    for ( j=0; j<pFontBase->pFontArray[FontID].pAFMData->numOfComps; j++) {
      /*and bounding box by ourselves. First, set up an identity charspace
       matrix and then generate an edgelist for the composite character at
       size 1000bp using no transformation and current encoding. Note: This
       action is only required when loading a font at first time, but not
       when reencoding a font. */
      S=(struct XYspace *)IDENTITY;
      S=(struct XYspace *)Permanent
       (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0],
                 pFontBase->pFontArray[FontID].FontTransform[1],
                 pFontBase->pFontArray[FontID].FontTransform[2],
                 pFontBase->pFontArray[FontID].FontTransform[3]));
      
      area=fontfcnB_ByName( FontID, 0, S,
                         pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName,
                         &mode, pFontBase->pFontArray[FontID].pType1Data,
                         DO_RASTER);
      /* Store bounding box ... */
      pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.llx=area->xmin;
      pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.urx=area->xmax;
      pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.lly=area->ymin;
      pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.ury=area->ymax;
      /* ... and character width. This should be the width of the base character
        of the composite! */
      pFontBase->pFontArray[FontID].pAFMData->ccd[j].wx=NEARESTPEL(area->ending.x);
      /* clean up. */
      KillRegion (area);
      if (S!=NULL) {
       KillSpace (S);
       S=NULL;
      }
    }
    /* We now create an encoding-specific kerning table which will speed up
       looking for kerning pairs! */
    pFontBase->pFontArray[FontID].KernMapSize=0;
    /* First, get number of defined kerning pairs: */
    k=pFontBase->pFontArray[FontID].pAFMData->numOfPairs;
    if (k>0){ /* i.e., there are any pairs */
      /* OK, it does not suffice to alloc numOfPairs METRICS_ENTRYs, because
        a given character might be encoded at several locations and kerning
        should still work. As a worst case estimation, we allocate 256^2
        and realloc later. */ 
      if ((pFontBase->pFontArray[FontID].pKernMap=
          (METRICS_ENTRY *)malloc( (256*256) *sizeof( METRICS_ENTRY)))==NULL){
       sprintf( err_warn_msg_buf, "Error allocating memory for metrics map (FontID=%d)",
               FontID);
       T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf,
                   T1LOG_WARNING);
       T1_errno=T1ERR_ALLOC_MEM;
       return(-1);
      }
      kern_tbl=pFontBase->pFontArray[FontID].pKernMap;
      pkd=pFontBase->pFontArray[FontID].pAFMData->pkd;
      j=0;
      for ( i=0; i<k; i++) {
       /* We do not check T1_GetEncodingIndices() against the return value
          NULL because we just loading the font in question: */
       l=0;
       while ((char1=(T1_GetEncodingIndices( FontID, pkd[i].name1))[l++])!=-1) {
         /* pair could be relevant in current encoding */
         m=0;
         while ((char2=(T1_GetEncodingIndices( FontID, pkd[i].name2))[m++])!=-1) {
           /* Since we get here we have a relevant pair -->
              Put char1 in higher byte and char2 in LSB: */
           kern_tbl[j].chars=(char1 << 8) | char2;
           /* We only make use of horizontal kerning */
           kern_tbl[j].hkern=pkd[i].xamt;
           j++;
         } /* while (char2) */
       } /* while (char1) */
      } /* for */
      /* We are done, realloc memory: */
      kern_tbl=(METRICS_ENTRY*) realloc( kern_tbl, j*sizeof(METRICS_ENTRY));
      /* We now sort the kerning array with respect to char indices */
      qsort( kern_tbl, (size_t) j, sizeof(METRICS_ENTRY),
            &cmp_METRICS_ENTRY );
      /* Finally write back pointer for the case that realloc changed the
        pointer */
      pFontBase->pFontArray[FontID].pKernMap=kern_tbl;
      pFontBase->pFontArray[FontID].KernMapSize=j;
    }
    else
      pFontBase->pFontArray[FontID].pKernMap=NULL;
  }
  else { /* no AFM data */
    pFontBase->pFontArray[FontID].pKernMap=NULL;
    pFontBase->pFontArray[FontID].pEncMap=NULL;
  }
  /* End of "if (AFM-info ..)" */
  
  
  /* We have just loaded a physical font into memory, thus .... */
  pFontBase->pFontArray[FontID].physical=1;

  /* Set reference-counter to 1: */
  pFontBase->pFontArray[FontID].refcount=1;

  /* Get the index into encoding vector where the space character is
     found. If not encoded, set space_position to -1. */
  pFontBase->pFontArray[FontID].space_position=-1;
  i=0;
  if (pFontBase->pFontArray[FontID].pFontEnc) { /* external default encoding */
    while (i<256) {
      if (strcmp( (char *)pFontBase->pFontArray[FontID].pFontEnc[i],
                "space")==0){
       /* space found at position i: */
       pFontBase->pFontArray[FontID].space_position=i;
       break;
      }
      i++;
    }
  }
  else { /* internal encoding */
    while (i<256) {
      if (strcmp( (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[i].data.arrayP,
                "space")==0){
       /* space found at position i: */
       pFontBase->pFontArray[FontID].space_position=i;
       break;
      }
      i++;
    }
  }
  

  /* Set the lining rule parameters to default values */
  pFontBase->pFontArray[FontID].UndrLnPos=
    pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINEPOSITION].value.data.real;
  pFontBase->pFontArray[FontID].UndrLnThick=
    pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINETHICKNESS].value.data.real;

  /* We have to set the value for the typographic ascender. If possible,
     we get it from the afm-File. But be aware this value might be undefined!
     This value should in any acse explicitly be set later by the user! */
  if (pFontBase->pFontArray[FontID].pAFMData!=NULL &&
      pFontBase->pFontArray[FontID].pAFMData->gfi!=NULL) {
    ascender=(float) pFontBase->pFontArray[FontID].pAFMData->gfi->ascender;
  }
  else {
    ascender=(float) T1_GetCharBBox( FontID, T1_GetEncodingIndex( FontID, "d")).ury;
  }
  
  pFontBase->pFontArray[FontID].OvrLnPos=ascender
    + (float) abs( (double)pFontBase->pFontArray[FontID].UndrLnPos);
  pFontBase->pFontArray[FontID].OvrStrkPos=ascender / 2.0;
  pFontBase->pFontArray[FontID].OvrLnThick=pFontBase->pFontArray[FontID].UndrLnThick;
  pFontBase->pFontArray[FontID].OvrStrkThick=pFontBase->pFontArray[FontID].UndrLnThick;

  
  /* Finally, set the font size dependencies pointer to NULL since we can
     assume, that at load time of a font, no size specific data of this
     font is available.
     */
  
  pFontBase->pFontArray[FontID].pFontSizeDeps=NULL;

  /* If wanted, some debugging information is put into logfile */
  sprintf( err_warn_msg_buf, "Pointer vm_base: 0x%lX",
          (long)pFontBase->pFontArray[FontID].vm_base);
  T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "Pointer vm_start: 0x%lX",
          (long)pFontBase->pFontArray[FontID].pType1Data->vm_start);
  T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "Pointer CharStringsP: 0x%lX",
          (long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP);
  T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "Pointer Private: 0x%lX",
          (long)pFontBase->pFontArray[FontID].pType1Data->Private);
  T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);
  sprintf( err_warn_msg_buf, "Pointer fontInfoP: 0x%lX",
          (long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP);
  T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG);

  return(0);
}

Here is the caller graph for this function:

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

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);
  
}
void T1_PrintLog ( char *  func_ident,
char *  msg_txt,
int  level,
  ... 
)

Definition at line 641 of file t1base.c.

{
  va_list vararg;
  static char levelid[4]={ 'E', 'W', 'S', 'D'};
  time_t s_clock, *tp;
  
  if (t1lib_log_file==NULL)
    return;
  if ((level>t1lib_log_level) || (level<1)){
    return;
  }
  else{
    /* initialize argument list */
    va_start( vararg, level);
    
    tp=&s_clock;
    s_clock=time( tp);
    /*
    fprintf( t1lib_log_file, "(%c) (%.24s) %s: ",
            levelid[level-1], ctime(&s_clock), func_ident);
            */
    /* Don't print the time stamp */
    fprintf( t1lib_log_file, "(%c) %s: ", levelid[level-1], func_ident );
    vfprintf( t1lib_log_file, msg_txt, vararg );
    fprintf( t1lib_log_file, "\n");
    fflush( t1lib_log_file);

    /* cleanup variable list */
    va_end( vararg);
    
    return;
  }
}

Here is the call graph for this function:

int T1_QueryCompositeChar ( int  FontID,
char  char1 
)

Definition at line 1171 of file t1finfo.c.

{
  unsigned char uchar1;

  uchar1=char1;
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return( -2);
  }

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

  if (pFontBase->pFontArray[FontID].pEncMap[ uchar1]<0) { /* composite char */
    return( -(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1));
  }

  return(-1);
  
}

Here is the call graph for this function:

void* T1_QueryFontSize ( int  FontID,
float  size,
int  aa 
)
int T1_QueryLigs ( int  FontID,
char  char1,
char **  successors,
char **  ligatures 
)

Definition at line 504 of file t1finfo.c.

{

  FontInfo *afm_ptr;
  CharMetricInfo *m_ptr;
  char *c_name;
  char cc_name[128];
  static char succ[MAX_LIGS];
  int succ_index;
  static char lig[MAX_LIGS];
  int lig_index;
  
  Ligature *ligs;
  int i,j;
  
  /* Check whether font is loaded: */
  if (T1_CheckForFontID(FontID)!=1){
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }
  
  /* If no AFM info is present, we return an error */
  if (pFontBase->pFontArray[FontID].pAFMData==NULL) {
    T1_errno=T1ERR_NO_AFM_DATA;
    return( -1);
  }

  /* All OK, ... */
  afm_ptr=pFontBase->pFontArray[FontID].pAFMData;
  m_ptr=afm_ptr->cmi;

  /* Get the name of the character: */
  if (pFontBase->pFontArray[FontID].pFontEnc==NULL){
    /* We have to get the name from the fonts internal encoding */
    c_name=(char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP;
    strncpy(cc_name,
           (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP,
           pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len);
    cc_name[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len]=0;
  }
  else{
    /* Take name from explicitly loaded and assigned encoding */
    c_name=pFontBase->pFontArray[FontID].pFontEnc[(unsigned char)char1];
    strcpy(cc_name,c_name);
  }

  for (i=0; i<afm_ptr->numOfChars; i++){
    if (strcmp(m_ptr[i].name,cc_name)==0)
      break;
  }
  

  if (i==afm_ptr->numOfChars) /* we didn't find the characters name */
    return(-1);
  
  ligs=m_ptr[i].ligs;

  j=0;
  if (ligs==NULL)
    return(0);
  
  while (ligs!=NULL) {
    /* Get indices of the two characters: */
    if ((succ_index=T1_GetEncodingIndex( FontID, (char*) ligs->succ))==-1) {
      /* successor is not current encoding */
      ligs=ligs->next;
      continue;
    }
    if ((lig_index=T1_GetEncodingIndex( FontID, (char*) ligs->lig))==-1) {
      /* Specified ligature is not in current encoding */
      ligs=ligs->next;
      continue;
    }
    succ[j]=(char)succ_index;
    lig[j]=(char)lig_index;
    j++;
    ligs=ligs->next;
  }
    
  *successors=succ;
  *ligatures=lig;
  
  return(j);
}

Here is the call graph for this function:

Definition at line 900 of file t1base.c.

{
#ifndef T1LIB_NO_X11_SUPPORT
  return(1);
#else
  return(0);
#endif
}
int T1_ReencodeFont ( int  FontID,
char **  Encoding 
)

Definition at line 621 of file t1enc.c.

{
  int i, j, k, l, m;
  char *charname;
  PairKernData *pkd;
  METRICS_ENTRY *kern_tbl;
  int char1, char2;
  
  
  /* First, check for valid font ID 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].pFontEnc=Encoding;


  /* We have to update the space_position-entry in the FONTPRIVATE. 
     If space is not found (not encoded), set it to -1: */
  pFontBase->pFontArray[FontID].space_position=-1;
  i=0;
  if (Encoding){ /* external encoding */
    while (i<256){
      if (strcmp( (char *)pFontBase->pFontArray[FontID].pFontEnc[i],
                "space")==0){
       /* space found at position i: */
       pFontBase->pFontArray[FontID].space_position=i;
       break;
      }
      i++;
    }
  }
  else{ /* reencoding to internal encoding */
    while (i<256){
      if (strcmp( (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[i].data.arrayP,
                "space")==0){
       /* space found at position i: */
       pFontBase->pFontArray[FontID].space_position=i;
       break;
      }
      i++;
    }
  }

  /* Now update afm index mapping: */
  if (pFontBase->pFontArray[FontID].pAFMData != NULL){
    for (i=0; i<256; i++) {
      charname=T1_GetCharName( FontID, i);
      /* in a first loop check for ordinary characters */
      for ( j=0; j<pFontBase->pFontArray[FontID].pAFMData->numOfChars; j++) {
       if (strcmp( charname,
                  pFontBase->pFontArray[FontID].pAFMData->cmi[j].name)==0) {
         pFontBase->pFontArray[FontID].pEncMap[i]=j+1; /* index 0 is reserved! */
         continue;
       }
      }
      /* if nothing has been found, check for composite characters */ 
      for ( j=0; j<pFontBase->pFontArray[FontID].pAFMData->numOfComps; j++) {
       if (strcmp( charname,
                  pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName)==0) {
         pFontBase->pFontArray[FontID].pEncMap[i]=-(j+1); /* index 0 is reserved! */
         /* Note: Metrics of composite characters already exist so that there is
            no need to recalculate them! */
         continue;
       }
      }
    }
    /* Update kerning table */
    pFontBase->pFontArray[FontID].KernMapSize=0;
    k=pFontBase->pFontArray[FontID].pAFMData->numOfPairs;
    if (k>0){ /* i.e., there are any pairs */
      /* OK, it does not suffice to alloc numOfPairs METRICS_ENTRYs, because
        a given character might be encoded at several locations and kerning
        should still work. As a worst case estimation, we allocate 256^2
        and realloc later. */ 
      if ((pFontBase->pFontArray[FontID].pKernMap=
          (METRICS_ENTRY *)malloc( (256*256) *sizeof( METRICS_ENTRY)))==NULL){
       sprintf( err_warn_msg_buf, "Error allocating memory for metrics map (FontID=%d)",
               FontID);
       T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf,
                   T1LOG_WARNING);
       T1_errno=T1ERR_ALLOC_MEM;
       return(-1);
      }
      kern_tbl=pFontBase->pFontArray[FontID].pKernMap;
      pkd=pFontBase->pFontArray[FontID].pAFMData->pkd;
      j=0;
      for ( i=0; i<k; i++) {
       /* We do not check T1_GetEncodingIndices() against the return value
          NULL because we just loading the font in question: */
       l=0;
       while ((char1=(T1_GetEncodingIndices( FontID, pkd[i].name1))[l++])!=-1) {
         /* pair could be relevant in current encoding */
         m=0;
         while ((char2=(T1_GetEncodingIndices( FontID, pkd[i].name2))[m++])!=-1) {
           /* Since we get here we have a relevant pair -->
              Put char1 in higher byte and char2 in LSB: */
           kern_tbl[j].chars=(char1 << 8) | char2;
           /* We only make use of horizontal kerning */
           kern_tbl[j].hkern=pkd[i].xamt;
           j++;
         } /* while (char2) */
       } /* while (char1) */
      } /* for */
      /* We are done, realloc memory: */
      kern_tbl=(METRICS_ENTRY*) realloc( kern_tbl, j*sizeof(METRICS_ENTRY));
      /* We now sort the kerning array with respect to char indices */
      qsort( kern_tbl, (size_t) j, sizeof(METRICS_ENTRY),
            &cmp_METRICS_ENTRY );
      /* Finally write back pointer for the case that realloc changed the
        pointer */
      pFontBase->pFontArray[FontID].pKernMap=kern_tbl;
      pFontBase->pFontArray[FontID].KernMapSize=j;
    }
    else {
      pFontBase->pFontArray[FontID].pKernMap=NULL;
    }
  }
  return(0);
}

Here is the call graph for this function:

Here is the caller 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);
  
}
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);
}
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);
  
}

Here is the caller graph for this function:

int T1_SetAfmFileName ( int  FontId,
char *  afm_name 
)

Definition at line 801 of file t1base.c.

{

  if (T1_CheckForFontID(FontID)!=0){
    /* Operation may not be applied because FontID is invalid
       or font is loaded */
    T1_errno=T1ERR_INVALID_FONTID;
    return(-1);
  }
  if (afm_name==NULL) {
    T1_errno=T1ERR_INVALID_PARAMETER;
    return(-1);
  }
  if (pFontBase->pFontArray[FontID].pAfmFileName!=NULL){
    /* we first free the current name */
    free( pFontBase->pFontArray[FontID].pAfmFileName);
    pFontBase->pFontArray[FontID].pAfmFileName=NULL;
  }
  
  if ((pFontBase->pFontArray[FontID].pAfmFileName=
       (char *)malloc( (strlen(afm_name)+1)*sizeof( char)))==NULL) {
    T1_errno=T1ERR_ALLOC_MEM;
    return( -1);
  }
  strcpy( pFontBase->pFontArray[FontID].pAfmFileName, afm_name);
         
  return(0);
  
}

Here is the call graph for this function:

Definition at line 1044 of file t1base.c.

{
  if (T1_Up){
    /* Library is initialized --> return error */
    T1_errno=T1ERR_OP_NOT_PERMITTED;
    return(-1);
  }
  else{
    switch (pad){
    case 8: 
      T1_pad=8;
      return(0);
    case 16:
      T1_pad=16;
      return(0);
#ifdef T1_AA_TYPE64
    case 32:
      T1_pad=32;
      return(0);
#endif
    default:
      T1_errno=T1ERR_INVALID_PARAMETER;
      return(-1);
    }
  }
}
GLYPH* T1_SetChar ( int  FontID,
char  charcode,
float  size,
T1_TMATRIX transform 
)

Definition at line 193 of file t1set.c.

{
  int i;
  int mode;
  struct region *area;
  struct XYspace *Current_S;
  int cache_flag    = 1;
  int rot_flag      = 0;
  unsigned char ucharcode;
  float strokewidth = 0.0f;
  volatile int strokeextraflag = 0;
  
  
  FONTSIZEDEPS *font_ptr;
  FONTPRIVATE  *fontarrayP;
  
  volatile int memsize=0;
  LONG h,w;
  LONG paddedW;

  /* We don't implement underlining for characters, but the rasterer
     implements it. Thus, we use a modflag of constant 0 */
  int modflag=0;

  static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1};


  /* 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_SetChar()", err_warn_msg_buf,
              T1LOG_ERROR);
    return( NULL);
  }

  ucharcode=(unsigned char)charcode;

  
  /* Reset character glyph, if necessary */
  if (glyph.bits!=NULL){
    free(glyph.bits);
    glyph.bits=NULL;
  }
  glyph.metrics.leftSideBearing=0;
  glyph.metrics.rightSideBearing=0;
  glyph.metrics.advanceX=0;
  glyph.metrics.advanceY=0;
  glyph.metrics.ascent=0;
  glyph.metrics.descent=0;
  glyph.pFontCacheInfo=NULL;
  glyph.bpp=1;  
  
  /* 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);
  }

  /* Assign padding value */
  T1_pad=pFontBase->bitmap_pad;
  if (pFontBase->endian)
    T1_byte=1;
  else
    T1_byte=0;
  T1_wordsize=T1_pad;

  fontarrayP=&(pFontBase->pFontArray[FontID]);
  
  /* Check if rotation is requested */
  if (transform!=NULL){
    /* there's rotation requested => do not cache the resulting bitmap */
    rot_flag=1;
    cache_flag=0;
  }
  else {
    rot_flag=0;
    cache_flag=1;
  }
  
  /* handle stroking stuff */
  if ( pFontBase->pFontArray[FontID].info_flags & RASTER_STROKED) {
    /* Stroking requested. If caching is not desired, clear cache_flag.
       Otherwise, leave it unaffected. */
    if ( (pFontBase->pFontArray[FontID].info_flags & CACHE_STROKED) == 0 ) {
      /* filled glyphs are cached, indicate that character is to be rendered
        on the fly and not to be cached */
      strokeextraflag = 1;
      cache_flag = 0;
    }
    strokewidth = pFontBase->pFontArray[FontID].StrokeWidth;
  }
  else {
    /* filling requested. */
    if ( (pFontBase->pFontArray[FontID].info_flags & CACHE_STROKED) != 0 ) {
      /* stroked glyphs are cached, indicate that character is to be rendered
        on the fly and not to be cached */
      strokeextraflag = 1;
      cache_flag = 0;
    }
    strokewidth = 0.0f;
  }
  
  /* 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);
    }
  }
  else {/* size is already existent in cache */
    /* If no rotation and no noncached stroking , try to get character from cache */
    if ( (rot_flag==0) && (strokeextraflag==0) ) {
      /* we don't use the .bits entry to check because in newer releases
        also white glyphs (bits=NULL) are allowed. Rather, we check
        whether bpp > 0! */
      if (font_ptr->pFontCache[ucharcode].bpp > 0){
       /* Character is already in Chache -> create a copy of cache
          and return a pointer to the result: */
       memcpy( &glyph, &(font_ptr->pFontCache[ucharcode]), sizeof(GLYPH));
       paddedW = PAD((glyph.metrics.rightSideBearing-glyph.metrics.leftSideBearing),
                    T1_pad);
       if (font_ptr->pFontCache[ucharcode].bits!=NULL) {
         memsize = (glyph.metrics.ascent-glyph.