Back to index

tetex-bin  3.0
Classes | Defines | Typedefs | Functions | Variables
type1.c File Reference
#include "types.h"
#include <stdio.h>
#include "objects.h"
#include "spaces.h"
#include "paths.h"
#include "fonts.h"
#include "pictures.h"
#include "util.h"
#include "blues.h"

Go to the source code of this file.

Classes

struct  stem
struct  callstackentry

Defines

#define MAXSTACK   24 /* Adobe Type1 limit */
#define MAXCALLSTACK   10 /* Adobe Type1 limit */
#define MAXPSFAKESTACK   32 /* Max depth of fake PostScript stack (local) */
#define MAXSTRLEN   512 /* Max length of a Type 1 string (local) */
#define MAXLABEL   256 /* Maximum number of new hints */
#define MAXSTEMS   128 /* Maximum number of VSTEM and HSTEM hints */
#define EPS   0.001 /* Small number for comparisons */
#define HSTEM   1
#define VSTEM   3
#define VMOVETO   4
#define RLINETO   5
#define HLINETO   6
#define VLINETO   7
#define RRCURVETO   8
#define CLOSEPATH   9
#define CALLSUBR   10
#define RETURN   11
#define ESCAPE   12
#define HSBW   13
#define ENDCHAR   14
#define RMOVETO   21
#define HMOVETO   22
#define VHCURVETO   30
#define HVCURVETO   31
#define DOTSECTION   0
#define VSTEM3   1
#define HSTEM3   2
#define SEAC   6
#define SBW   7
#define DIV   12
#define CALLOTHERSUBR   16
#define POP   17
#define SETCURRENTPOINT   33
#define FABS(x)   (((tmpx = (x)) < 0.0) ? -tmpx : tmpx)
#define CEIL(x)   (((tmpi = (LONG) (tmpx = (x))) < tmpx) ? ++tmpi : tmpi)
#define FLOOR(x)   (((tmpi = (LONG) (tmpx = (x))) > tmpx) ? --tmpi : tmpi)
#define ROUND(x)   FLOOR((x) + 0.5)
#define ODD(x)   (((int)(x)) & 01)
#define CC   IfTrace1(TRUE, "'%03o ", currentchar)
#define Error   {errflag = TRUE; return;}
#define Error0(errmsg)   { CC; IfTrace0(TRUE, errmsg); Error;}
#define Error1(errmsg, arg)   { CC; IfTrace1(TRUE, errmsg, arg); Error;}
#define LEFT   1
#define RIGHT   2
#define BOTTOM   3
#define TOP   4
#define KEY   4330 /* Initial key (seed) for CharStrings decryption */
#define C1   52845 /* Multiplier for pseudo-random number generator */
#define C2   22719 /* Constant for pseudo-random number generator */
#define dtransform(dxusr, dyusr, dxdev, dydev)
#define itransform(xdev, ydev, xusr, yusr)
#define transform(xusr, yusr, xdev, ydev)   dtransform(xusr,yusr,xdev,ydev)
#define PaintType   (0)
#define lineto(x, y)
#define curveto(x0, y0, x1, y1, x2, y2)
#define xshrink(x)   ((x - c4x2) * shrink +c4x2)
#define yshrink(y)   ((y - c4y2) * shrink +c4y2)
#define PickCoords(flag)

Typedefs

typedef struct xobject

Functions

static DOUBLE Div ()
static DOUBLE PSFakePop ()
static DoCommand ()
static Escape ()
static HStem ()
static VStem ()
static RLineTo ()
static RRCurveTo ()
static DoClosePath ()
static CallSubr ()
static Return ()
static EndChar ()
static RMoveTo ()
static DotSection ()
static Seac ()
static Sbw ()
static CallOtherSubr ()
static SetCurrentPoint ()
static void ComputeAlignmentZones ()
static void InitStems ()
static void FinitStems ()
static void ComputeStem (int stemno)
static struct segmentApplyhint (struct segment *p, int stemnumber, int half)
static struct segmentApplyrevhint (struct segment *p, int stemnumber, int half)
static struct segmentFindStems (DOUBLE x, DOUBLE y, DOUBLE dx, DOUBLE dy)
static void ClearStack ()
static void Push (DOUBLE Num)
static void ClearCallStack ()
static void PushCall (psobj *CurrStrP, int CurrIndex, unsigned short CurrKey)
static void PopCall (psobj **CurrStrPP, int *CurrIndexP, unsigned short *CurrKeyP)
static void ClearPSFakeStack ()
static void PSFakePush (DOUBLE Num)
static struct segmentCenterStem (DOUBLE edge1, DOUBLE edge2)
static unsigned char Decrypt (unsigned char cipher)
static int DoRead (int *CodeP)
static void StartDecrypt ()
static void Decode (int Code)
static void DoCommand (int Code)
static void Escape (int Code)
static void HStem (DOUBLE y, DOUBLE dy)
static void VStem (DOUBLE x, DOUBLE dx)
static void RLineTo (DOUBLE dx, DOUBLE dy)
static void RRCurveTo (DOUBLE dx1, DOUBLE dy1, DOUBLE dx2, DOUBLE dy2, DOUBLE dx3, DOUBLE dy3)
static void CallSubr (int subrno)
static void RMoveTo (DOUBLE dx, DOUBLE dy)
static void Seac (DOUBLE asb, DOUBLE adx, DOUBLE ady, unsigned char bchar, unsigned char achar)
static void Sbw (DOUBLE sbx, DOUBLE sby, DOUBLE wx, DOUBLE wy)
static DOUBLE Div (DOUBLE num1, DOUBLE num2)
static void FlxProc (DOUBLE c1x2, DOUBLE c1y2, DOUBLE c3x0, DOUBLE c3y0, DOUBLE c3x1, DOUBLE c3y1, DOUBLE c3x2, DOUBLE c3y2, DOUBLE c4x0, DOUBLE c4y0, DOUBLE c4x1, DOUBLE c4y1, DOUBLE c4x2, DOUBLE c4y2, DOUBLE epY, DOUBLE epX, int idmin)
static void FlxProc1 ()
static void FlxProc2 ()
static void HintReplace ()
static void CallOtherSubr (int othersubrno)
static void SetCurrentPoint (DOUBLE x, DOUBLE y)
struct xobjectType1Char (char *env, struct XYspace *S, psobj *charstrP, psobj *subrsP, psobj *osubrsP, struct blues_struct *bluesP, int *modeP)

Variables

static DOUBLE tmpx
static LONG tmpi
int currentchar = -1
struct XYspaceIDENTITY
static DOUBLE escapementX
static DOUBLE escapementY
static DOUBLE sidebearingX
static DOUBLE sidebearingY
static DOUBLE accentoffsetX
static DOUBLE accentoffsetY
static struct segmentpath
static int errflag
static char * Environment
static struct XYspaceCharSpace
static psobjCharStringP
static psobjSubrsP
static psobjOtherSubrsP
static intModeP
static struct segmentFlxOldPath
static struct blues_structblues
static struct alignmentzone [MAXALIGNMENTZONES]
int numalignmentzones
int InDotSection
int numstems
int currstartstem
int oldvert
int oldhor
int oldhorhalf
int oldverthalf
DOUBLE wsoffsetX
DOUBLE wsoffsetY
int wsset
static int strindex
static DOUBLE currx
static DOUBLE curry
static DOUBLE Stack [MAXSTACK]
static int Top
static struct callstackentry [MAXCALLSTACK]
static int CallTop
static DOUBLE PSFakeStack [MAXPSFAKESTACK]
static int PSFakeTop
static unsigned short r

Class Documentation

struct stem

Definition at line 383 of file type1.c.

Collaboration diagram for stem:
Class Members
DOUBLE aldx
DOUBLE aldy
DOUBLE alx
DOUBLE aly
DOUBLE dx
DOUBLE dy
struct segment * lbhint
double lbhintval
struct segment * lbrevhint
struct segment * rthint
double rthintval
struct segment * rtrevhint
int vertical
DOUBLE x
DOUBLE y
struct callstackentry

Definition at line 402 of file type1.c.

Collaboration diagram for callstackentry:
Class Members
int currindex
unsigned short currkey
psobj * currstrP

Define Documentation

#define BOTTOM   3

Definition at line 611 of file type1.c.

#define C1   52845 /* Multiplier for pseudo-random number generator */

Definition at line 876 of file type1.c.

#define C2   22719 /* Constant for pseudo-random number generator */

Definition at line 877 of file type1.c.

#define CALLOTHERSUBR   16

Definition at line 103 of file type1.c.

#define CALLSUBR   10

Definition at line 84 of file type1.c.

#define CC   IfTrace1(TRUE, "'%03o ", currentchar)

Definition at line 125 of file type1.c.

#define CEIL (   x)    (((tmpi = (LONG) (tmpx = (x))) < tmpx) ? ++tmpi : tmpi)

Definition at line 115 of file type1.c.

#define CLOSEPATH   9

Definition at line 83 of file type1.c.

#define curveto (   x0,
  y0,
  x1,
  y1,
  x2,
  y2 
)
Value:
{ \
  struct segment *CurrentPoint; \
  DOUBLE CurrentX, CurrentY; \
  CurrentPoint = Phantom(path); \
  QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \
  Destroy(CurrentPoint); \
  RRCurveTo(x0 - CurrentX, y0 - CurrentY, x1 - x0, y1 - y0, x2 - x1, y2 - y1); \
}

Definition at line 1478 of file type1.c.

#define DIV   12

Definition at line 102 of file type1.c.

#define DOTSECTION   0

Definition at line 97 of file type1.c.

#define dtransform (   dxusr,
  dyusr,
  dxdev,
  dydev 
)
Value:
{ \
  register struct segment *point = Loc(CharSpace, dxusr, dyusr); \
  QueryLoc(point, IDENTITY, dxdev, dydev); \
  Destroy(point); \
}

Definition at line 1453 of file type1.c.

#define ENDCHAR   14

Definition at line 88 of file type1.c.

#define EPS   0.001 /* Small number for comparisons */

Definition at line 71 of file type1.c.

#define Error   {errflag = TRUE; return;}

Definition at line 127 of file type1.c.

#define Error0 (   errmsg)    { CC; IfTrace0(TRUE, errmsg); Error;}

Definition at line 129 of file type1.c.

#define Error1 (   errmsg,
  arg 
)    { CC; IfTrace1(TRUE, errmsg, arg); Error;}

Definition at line 131 of file type1.c.

#define ESCAPE   12

Definition at line 86 of file type1.c.

#define FABS (   x)    (((tmpx = (x)) < 0.0) ? -tmpx : tmpx)

Definition at line 113 of file type1.c.

#define FLOOR (   x)    (((tmpi = (LONG) (tmpx = (x))) > tmpx) ? --tmpi : tmpi)

Definition at line 117 of file type1.c.

#define HLINETO   6

Definition at line 80 of file type1.c.

#define HMOVETO   22

Definition at line 90 of file type1.c.

#define HSBW   13

Definition at line 87 of file type1.c.

#define HSTEM   1

Definition at line 76 of file type1.c.

#define HSTEM3   2

Definition at line 99 of file type1.c.

#define HVCURVETO   31

Definition at line 92 of file type1.c.

#define itransform (   xdev,
  ydev,
  xusr,
  yusr 
)
Value:
{ \
  register struct segment *point = Loc(IDENTITY, xdev, ydev); \
  QueryLoc(point, CharSpace, xusr, yusr); \
  Destroy(point); \
}

Definition at line 1459 of file type1.c.

#define KEY   4330 /* Initial key (seed) for CharStrings decryption */

Definition at line 875 of file type1.c.

#define LEFT   1

Definition at line 609 of file type1.c.

#define lineto (   x,
  y 
)
Value:
{ \
  struct segment *CurrentPoint; \
  DOUBLE CurrentX, CurrentY; \
  CurrentPoint = Phantom(path); \
  QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \
  Destroy(CurrentPoint); \
  RLineTo(x - CurrentX, y - CurrentY); \
}

Definition at line 1469 of file type1.c.

#define MAXCALLSTACK   10 /* Adobe Type1 limit */

Definition at line 66 of file type1.c.

#define MAXLABEL   256 /* Maximum number of new hints */

Definition at line 69 of file type1.c.

#define MAXPSFAKESTACK   32 /* Max depth of fake PostScript stack (local) */

Definition at line 67 of file type1.c.

#define MAXSTACK   24 /* Adobe Type1 limit */

Definition at line 65 of file type1.c.

#define MAXSTEMS   128 /* Maximum number of VSTEM and HSTEM hints */

Definition at line 70 of file type1.c.

#define MAXSTRLEN   512 /* Max length of a Type 1 string (local) */

Definition at line 68 of file type1.c.

#define ODD (   x)    (((int)(x)) & 01)

Definition at line 121 of file type1.c.

#define PaintType   (0)

Definition at line 1467 of file type1.c.

#define PickCoords (   flag)
Value:
if (flag) { /* Pick "shrunk" coordinates */ \
    x0 = c1x0; y0 = c1y0; \
    x1 = c1x1; y1 = c1y1; \
    x2 = c1x2; y2 = c1y2; \
    x3 = c2x0; y3 = c2y0; \
    x4 = c2x1; y4 = c2y1; \
    x5 = c2x2; y5 = c2y2; \
  } else { /* Pick original coordinates */ \
    x0 = c3x0; y0 = c3y0; \
    x1 = c3x1; y1 = c3y1; \
    x2 = c3x2; y2 = c3y2; \
    x3 = c4x0; y3 = c4y0; \
    x4 = c4x1; y4 = c4y1; \
    x5 = c4x2; y5 = c4y2; \
  }

Definition at line 1490 of file type1.c.

#define POP   17

Definition at line 104 of file type1.c.

#define RETURN   11

Definition at line 85 of file type1.c.

#define RIGHT   2

Definition at line 610 of file type1.c.

#define RLINETO   5

Definition at line 79 of file type1.c.

#define RMOVETO   21

Definition at line 89 of file type1.c.

#define ROUND (   x)    FLOOR((x) + 0.5)

Definition at line 119 of file type1.c.

#define RRCURVETO   8

Definition at line 82 of file type1.c.

#define SBW   7

Definition at line 101 of file type1.c.

#define SEAC   6

Definition at line 100 of file type1.c.

#define SETCURRENTPOINT   33

Definition at line 105 of file type1.c.

#define TOP   4

Definition at line 612 of file type1.c.

#define transform (   xusr,
  yusr,
  xdev,
  ydev 
)    dtransform(xusr,yusr,xdev,ydev)

Definition at line 1465 of file type1.c.

#define VHCURVETO   30

Definition at line 91 of file type1.c.

#define VLINETO   7

Definition at line 81 of file type1.c.

#define VMOVETO   4

Definition at line 78 of file type1.c.

#define VSTEM   3

Definition at line 77 of file type1.c.

#define VSTEM3   1

Definition at line 98 of file type1.c.

#define xshrink (   x)    ((x - c4x2) * shrink +c4x2)

Definition at line 1487 of file type1.c.

#define yshrink (   y)    ((y - c4y2) * shrink +c4y2)

Definition at line 1488 of file type1.c.


Typedef Documentation

typedef struct xobject

Definition at line 58 of file type1.c.


Function Documentation

static struct segment* Applyhint ( struct segment p,
int  stemnumber,
int  half 
) [static, read]

Definition at line 619 of file type1.c.

{
  if (half == LEFT || half == BOTTOM)
    return Join(p, stems[stemnumber].lbhint); /* left  or bottom hint */
  else
    return Join(p, stems[stemnumber].rthint); /* right or top    hint */
}

Here is the caller graph for this function:

static struct segment* Applyrevhint ( struct segment p,
int  stemnumber,
int  half 
) [static, read]

Definition at line 634 of file type1.c.

{
  if (half == LEFT || half == BOTTOM)
    return Join(p, stems[stemnumber].lbrevhint); /* left  or bottom hint */
  else
    return Join(p, stems[stemnumber].rtrevhint); /* right or top    hint */
}

Here is the caller graph for this function:

static CallOtherSubr ( ) [static]
static void CallOtherSubr ( int  othersubrno) [static]

Definition at line 1719 of file type1.c.

{
  IfTrace1((FontDebug), "CallOtherSubr %d\n", othersubrno);
 
  switch(othersubrno) {
    case 0: /* OtherSubrs[0]; Main part of Flex */
      if (PSFakeTop < 16) Error0("CallOtherSubr: PSFakeStack low");
      ClearPSFakeStack();
      FlxProc(
        PSFakeStack[0],  PSFakeStack[1],  PSFakeStack[2],  PSFakeStack[3],
        PSFakeStack[4],  PSFakeStack[5],  PSFakeStack[6],  PSFakeStack[7],
        PSFakeStack[8],  PSFakeStack[9],  PSFakeStack[10], PSFakeStack[11],
        PSFakeStack[12], PSFakeStack[13], PSFakeStack[14], PSFakeStack[15],
        (int) PSFakeStack[16]
      );
      break;
    case 1: /* OtherSubrs[1]; Part of Flex */
      FlxProc1();
      break;
    case 2: /* OtherSubrs[2]; Part of Flex */
      FlxProc2();
      break;
    case 3: /* OtherSubrs[3]; Hint Replacement */
      HintReplace();
      break;
    default: { /* call OtherSubrs[4] or higher if PostScript is present */
    }
  }
}

Here is the call graph for this function:

static CallSubr ( ) [static]
static void CallSubr ( int  subrno) [static]

Definition at line 1264 of file type1.c.

{
  IfTrace1((FontDebug), "CallSubr %d\n", subrno);
  if ((subrno < 0) || (subrno >= SubrsP->len))
    Error0("CallSubr: subrno out of range\n");
  PushCall(CharStringP, strindex, r);
  CharStringP = &SubrsP->data.arrayP[subrno];
  StartDecrypt();
}

Here is the call graph for this function:

static struct segment* CenterStem ( DOUBLE  edge1,
DOUBLE  edge2 
) [static, read]

Definition at line 810 of file type1.c.

{
  int idealwidth, verticalondevice;
  DOUBLE leftx, lefty, rightx, righty, center, width;
  DOUBLE widthx, widthy;
  DOUBLE shift, shiftx, shifty;
  DOUBLE Xpixels, Ypixels;
  struct segment *p;
 
  p = Loc(CharSpace, edge1, 0.0);
  QueryLoc(p, IDENTITY, &leftx, &lefty);
 
  p = Join(p, Loc(CharSpace, edge2, 0.0));
  QueryLoc(p, IDENTITY, &rightx, &righty);
  Destroy(p);
 
  widthx = FABS(rightx - leftx);
  widthy = FABS(righty - lefty);
 
  if (widthy <= EPS) { /* verticalondevice hint */
    verticalondevice = TRUE;
    center = (rightx + leftx) / 2.0;
    width = widthx;
  }
  else if (widthx <= EPS) { /* horizontal hint */
    verticalondevice = FALSE;
    center = (righty + lefty) / 2.0;
    width = widthy;
  }
  else { /* neither horizontal nor verticalondevice and not oblique */
    return (NULL);
  }
 
  idealwidth = ROUND(width);
  if (idealwidth == 0) idealwidth = 1;
  if (ODD(idealwidth)) {       /* is ideal width odd? */
    /* center stem over pixel */
    shift = FLOOR(center) + 0.5 - center;
  }
  else {
    /* align stem on pixel boundary */
    shift = ROUND(center) - center;
  }
 
  if (verticalondevice) {
    shiftx = shift;
    shifty = 0.0;
  } else {
    shifty = shift;
    shiftx = 0.0;
  }
 
  p = Loc(IDENTITY, shiftx, shifty);
  QueryLoc(p, CharSpace, &Xpixels, &Ypixels);
  wsoffsetX = Xpixels; wsoffsetY = Ypixels;
  currx += wsoffsetX; curry += wsoffsetY;
 
  return (p);
}

Here is the caller graph for this function:

static void ClearCallStack ( void  ) [static]

Definition at line 758 of file type1.c.

{
  CallTop = -1;
}

Here is the caller graph for this function:

static void ClearPSFakeStack ( void  ) [static]

Definition at line 786 of file type1.c.

{
  PSFakeTop = -1;
}

Here is the caller graph for this function:

static void ClearStack ( void  ) [static]

Definition at line 746 of file type1.c.

{
  Top = -1;
}

Here is the caller graph for this function:

static void ComputeAlignmentZones ( void  ) [static]

Definition at line 250 of file type1.c.

{
  int i;
  DOUBLE dummy, bluezonepixels, familyzonepixels;
  struct segment *p;
 
  numalignmentzones = 0;     /* initialize total # of zones */
 
  /* do the BlueValues zones */
  for (i = 0; i < blues->numBlueValues; i +=2, ++numalignmentzones) {
    /* the 0th & 1st numbers in BlueValues are for a bottom zone */
    /* the rest are topzones */
    if (i == 0)           /* bottom zone */
      alignmentzones[numalignmentzones].topzone = FALSE;
    else                  /* top zone */
      alignmentzones[numalignmentzones].topzone = TRUE;
    if (i < blues->numFamilyBlues) {    /* we must consider FamilyBlues */
      p = ILoc(CharSpace,0,blues->BlueValues[i] - blues->BlueValues[i+1]);
      QueryLoc(p, IDENTITY, &dummy, &bluezonepixels);
      Destroy(p);
      p = ILoc(CharSpace,0,blues->FamilyBlues[i]-blues->FamilyBlues[i+1]);
      QueryLoc(p, IDENTITY, &dummy, &familyzonepixels);
      Destroy(p);
      /* is the difference in size of the zones less than 1 pixel? */
      if (FABS(bluezonepixels - familyzonepixels) < 1.0) {
        /* use the Family zones */
        alignmentzones[numalignmentzones].bottomy =
          blues->FamilyBlues[i];
        alignmentzones[numalignmentzones].topy =
          blues->FamilyBlues[i+1];
        continue;
      }
    }
    /* use this font's Blue zones */
    alignmentzones[numalignmentzones].bottomy = blues->BlueValues[i];
    alignmentzones[numalignmentzones].topy = blues->BlueValues[i+1];
  }
 
  /* do the OtherBlues zones */
  for (i = 0; i < blues->numOtherBlues; i +=2, ++numalignmentzones) {
    /* all of the OtherBlues zones are bottom zones */
    alignmentzones[numalignmentzones].topzone = FALSE;
    if (i < blues->numFamilyOtherBlues) {/* consider FamilyOtherBlues  */
      p = ILoc(CharSpace,0,blues->OtherBlues[i] - blues->OtherBlues[i+1]);
      QueryLoc(p, IDENTITY, &dummy, &bluezonepixels);
      Destroy(p);
      p = ILoc(CharSpace,0,blues->FamilyOtherBlues[i] -
        blues->FamilyOtherBlues[i+1]);
      QueryLoc(p, IDENTITY, &dummy, &familyzonepixels);
      Destroy(p);
      /* is the difference in size of the zones less than 1 pixel? */
      if (FABS(bluezonepixels - familyzonepixels) < 1.0) {
        /* use the Family zones */
        alignmentzones[numalignmentzones].bottomy =
          blues->FamilyOtherBlues[i];
        alignmentzones[numalignmentzones].topy =
          blues->FamilyOtherBlues[i+1];
        continue;
      }
    }
    /* use this font's Blue zones (as opposed to the Family Blues */
    alignmentzones[numalignmentzones].bottomy = blues->OtherBlues[i];
    alignmentzones[numalignmentzones].topy = blues->OtherBlues[i+1];
  }
}

Here is the caller graph for this function:

static void ComputeStem ( int  stemno) [static]

Definition at line 351 of file type1.c.

{
  int verticalondevice, idealwidth;
  DOUBLE stemstart, stemwidth;
  struct segment *p;
  int i;
  DOUBLE stembottom, stemtop, flatposition;
  DOUBLE Xpixels, Ypixels;
  DOUBLE unitpixels, onepixel;
  int suppressovershoot, enforceovershoot;
  DOUBLE stemshift, flatpospixels, overshoot;
  DOUBLE widthdiff; /* Number of character space units to adjust width */
  DOUBLE lbhintvalue, rthintvalue;
  DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */
  int rotated; /* TRUE if character is on the side, FALSE if upright */
 
  /************************************************/
  /* DETERMINE ORIENTATION OF CHARACTER ON DEVICE */
  /************************************************/
 
  QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */
 
  if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001)
    rotated = TRUE; /* Char is on side (90 or 270 degrees), possibly oblique. */
  else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001)
    rotated = FALSE; /* Char is upright (0 or 180 degrees), possibly oblique. */
  else {
    stems[stemno].lbhint = NULL; /* Char is at non-axial angle, ignore hints. */
    stems[stemno].lbrevhint = NULL;
    stems[stemno].rthint = NULL;
    stems[stemno].rtrevhint = NULL;
    return;
  }
 
  /* Determine orientation of stem */
 
  if (stems[stemno].vertical) {
    verticalondevice = !rotated;
    stemstart = stems[stemno].x;
    stemwidth = stems[stemno].dx;
  } else {
    verticalondevice = rotated;
    stemstart = stems[stemno].y;
    stemwidth = stems[stemno].dy;
  }
 
  /* Determine how many pixels (non-negative) correspond to 1 character space
     unit (unitpixels), and how many character space units (non-negative)
     correspond to one pixel (onepixel). */
 
  if (stems[stemno].vertical)
    p = ILoc(CharSpace, 1, 0);
  else
    p = ILoc(CharSpace, 0, 1);
  QueryLoc(p, IDENTITY, &Xpixels, &Ypixels);
  Destroy(p);
  if (verticalondevice)
    unitpixels = FABS(Xpixels);
  else
    unitpixels = FABS(Ypixels);
 
  onepixel = 1.0 / unitpixels;
 
  /**********************/
  /* ADJUST STEM WIDTHS */
  /**********************/
 
  widthdiff = 0.0;
 
  /* Find standard stem with smallest width difference from this stem */
  if (stems[stemno].vertical) { /* vertical stem */
    if (blues->StdVW != 0)      /* there is an entry for StdVW */
      widthdiff = blues->StdVW - stemwidth;
    for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */
      if (blues->StemSnapV[i] - stemwidth < widthdiff)
        /* this standard width is the best match so far for this stem */
        widthdiff = blues->StemSnapV[i] - stemwidth;
    }
  } else {                      /* horizontal stem */
    if (blues->StdHW != 0)      /* there is an entry for StdHW */
      widthdiff = blues->StdHW - stemwidth;
    for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */
      if (blues->StemSnapH[i] - stemwidth < widthdiff)
        /* this standard width is the best match so far for this stem */
        widthdiff = blues->StemSnapH[i] - stemwidth;
    }
  }
 
  /* Only expand or contract stems if they differ by less than 1 pixel from
     the closest standard width, otherwise make the width difference = 0. */
  if (FABS(widthdiff) > onepixel)
    widthdiff = 0.0;
 
  /* Expand or contract stem to the nearest integral number of pixels. */
  idealwidth = ROUND((stemwidth + widthdiff) * unitpixels);
  /* Ensure that all stems are at least one pixel wide. */
  if (idealwidth == 0)
    idealwidth = 1;
  /* Apply ForceBold to vertical stems. */
  if (blues->ForceBold && stems[stemno].vertical)
    /* Force this vertical stem to be at least DEFAULTBOLDSTEMWIDTH wide. */
    if (idealwidth < DEFAULTBOLDSTEMWIDTH)
      idealwidth = DEFAULTBOLDSTEMWIDTH;
  /* Now compute the number of character space units necessary */
  widthdiff = idealwidth * onepixel - stemwidth;
 
  /*********************************************************************/
  /* ALIGNMENT ZONES AND OVERSHOOT SUPPRESSION - HORIZONTAL STEMS ONLY */
  /*********************************************************************/
 
  stemshift = 0.0;
 
  if (!stems[stemno].vertical) {
 
    /* Get bottom and top boundaries of the stem. */
    stembottom = stemstart;
    stemtop = stemstart + stemwidth;
 
    /* Find out if this stem intersects an alignment zone (the BlueFuzz  */
    /* entry in the Private dictionary specifies the number of character */
    /* units to extend (in both directions) the effect of an alignment   */
    /* zone on a horizontal stem.  The default value of BlueFuzz is 1.   */
    for (i = 0; i < numalignmentzones; ++i) {
      if (alignmentzones[i].topzone) {
        if (stemtop >= alignmentzones[i].bottomy &&
            stemtop <= alignmentzones[i].topy + blues->BlueFuzz) {
          break; /* We found a top-zone */
        }
      } else {
        if (stembottom <= alignmentzones[i].topy &&
            stembottom >= alignmentzones[i].bottomy - blues->BlueFuzz) {
          break; /* We found a bottom-zone */
        }
      }
    }
 
    if (i < numalignmentzones) { /* We found an intersecting zone (number i). */
      suppressovershoot = FALSE;
      enforceovershoot = FALSE;
 
      /* When 1 character space unit is rendered smaller than BlueScale
         device units (pixels), we must SUPPRESS overshoots.  Otherwise,
         if the top (or bottom) of this stem is more than BlueShift character
         space units away from the flat position, we must ENFORCE overshoot. */
 
      if (unitpixels < blues->BlueScale)
        suppressovershoot = TRUE;
      else
        if (alignmentzones[i].topzone)
          if (stemtop >= alignmentzones[i].bottomy + blues->BlueShift)
            enforceovershoot = TRUE;
        else
          if (stembottom <= alignmentzones[i].topy - blues->BlueShift)
            enforceovershoot = TRUE;
 
      /*************************************************/
      /* ALIGN THE FLAT POSITION OF THE ALIGNMENT ZONE */
      /*************************************************/
 
      /* Compute the position of the alignment zone's flat position in
         device space and the amount of shift needed to align it on a
         pixel boundary. Move all stems this amount. */
 
      if (alignmentzones[i].topzone)
        flatposition = alignmentzones[i].bottomy;
      else
        flatposition = alignmentzones[i].topy;
 
      /* Find the flat position in pixels */
      flatpospixels = flatposition * unitpixels;
 
      /* Find the stem shift necessary to align the flat
         position on a pixel boundary, and use this shift for all stems */
      stemshift = (ROUND(flatpospixels) - flatpospixels) * onepixel;
 
      /************************************************/
      /* HANDLE OVERSHOOT ENFORCEMENT AND SUPPRESSION */
      /************************************************/
 
      /* Compute overshoot amount (non-negative) */
      if (alignmentzones[i].topzone)
        overshoot = stemtop - flatposition;
      else
        overshoot = flatposition - stembottom;
 
      if (overshoot > 0.0) {
        /* ENFORCE overshoot by shifting the entire stem (if necessary) so that
           it falls at least one pixel beyond the flat position. */
 
        if (enforceovershoot)
          if (overshoot < onepixel)
            if (alignmentzones[i].topzone)
              stemshift += onepixel - overshoot;
            else
              stemshift -= onepixel - overshoot;
 
        /* SUPPRESS overshoot by aligning the stem to the alignment zone's
           flat position. */
 
        if (suppressovershoot)
          if (alignmentzones[i].topzone)
            stemshift -= overshoot;
          else
            stemshift += overshoot;
      }
 
      /************************************************************/
      /* COMPUTE HINT VALUES FOR EACH SIDE OF THE HORIZONTAL STEM */
      /************************************************************/
 
      /* If the stem was aligned by a topzone, we expand or contract the stem
         only at the bottom - since the stem top was aligned by the zone.
         If the stem was aligned by a bottomzone, we expand or contract the stem
         only at the top - since the stem bottom was aligned by the zone. */
      if (alignmentzones[i].topzone) {
        lbhintvalue = stemshift - widthdiff; /* bottom */
        rthintvalue = stemshift;             /* top    */
      } else {
        lbhintvalue = stemshift;             /* bottom */
        rthintvalue = stemshift + widthdiff; /* top    */
      }
 
      stems[stemno].lbhint    = (struct segment *)Permanent(Loc(CharSpace, 0.0,  lbhintvalue));
      stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue));
      stems[stemno].rthint    = (struct segment *)Permanent(Loc(CharSpace, 0.0,  rthintvalue));
      stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue));
 
      return;
 
    } /* endif (i < numalignmentzones) */
 
    /* We didn't find any alignment zones intersecting this stem, so
       proceed with normal stem alignment below. */
 
  } /* endif (!stems[stemno].vertical) */
 
  /* Align stem with pixel boundaries on device */
  stemstart = stemstart - widthdiff / 2;
  stemshift = ROUND(stemstart * unitpixels) * onepixel - stemstart;
 
  /* Adjust the boundaries of the stem */
  lbhintvalue = stemshift - widthdiff / 2; /* left  or bottom */
  rthintvalue = stemshift + widthdiff / 2; /* right or top    */
 
  if (stems[stemno].vertical) {
    stems[stemno].lbhint    = (struct segment *)Permanent(Loc(CharSpace,  lbhintvalue, 0.0));
    stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, -lbhintvalue, 0.0));
    stems[stemno].rthint    = (struct segment *)Permanent(Loc(CharSpace,  rthintvalue, 0.0));
    stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, -rthintvalue, 0.0));
  } else {
    stems[stemno].lbhint    = (struct segment *)Permanent(Loc(CharSpace, 0.0,  lbhintvalue));
    stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue));
    stems[stemno].rthint    = (struct segment *)Permanent(Loc(CharSpace, 0.0,  rthintvalue));
    stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue));
  }
}

Here is the caller graph for this function:

static void Decode ( int  Code) [static]

Definition at line 912 of file type1.c.

{
  int Code1, Code2, Code3, Code4;
 
  if (Code <= 31)                           /* Code is [0,31]    */
    DoCommand(Code);
  else if (Code <= 246)                     /* Code is [32,246]  */
    Push((DOUBLE)(Code - 139));
  else if (Code <= 250) {                   /* Code is [247,250] */
    if (!DoRead(&Code2)) goto ended;
    Push((DOUBLE)(((Code - 247) << 8) + Code2 + 108));
  }
  else if (Code <= 254) {                   /* Code is [251,254] */
    if (!DoRead(&Code2)) goto ended;
    Push((DOUBLE)( -((Code - 251) << 8) - Code2 - 108));
  }
  else {                                    /* Code is 255 */
    if (!DoRead(&Code1)) goto ended;
    if (!DoRead(&Code2)) goto ended;
    if (!DoRead(&Code3)) goto ended;
    if (!DoRead(&Code4)) goto ended;
    Push((DOUBLE)((((((Code1<<8) + Code2)<<8) + Code3)<<8) + Code4));
  }
  return;
 
ended: Error0("Decode: Premature end of Type 1 CharString");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned char Decrypt ( unsigned char  cipher) [static]

Definition at line 881 of file type1.c.

{
  unsigned char plain;
 
  plain = cipher ^ (r >> 8);
  r = (cipher + r) * C1 + C2;
  return plain;
}

Here is the caller graph for this function:

static DOUBLE Div ( ) [static]
static DOUBLE Div ( DOUBLE  num1,
DOUBLE  num2 
) [static]

Definition at line 1424 of file type1.c.

{
  IfTrace2((FontDebug), "Div %f %f\n", &num1, &num2);
  return(num1 / num2);
}
static void DoClosePath ( void  ) [static]

Definition at line 1251 of file type1.c.

{
  struct segment *CurrentPoint;
 
  IfTrace0((FontDebug), "DoClosePath\n");
  CurrentPoint = Phantom(path);
  path = ClosePath(path);
  path = Join(Snap(path), CurrentPoint);
}

Here is the caller graph for this function:

static DoCommand ( ) [static]
static void DoCommand ( int  Code) [static]

Definition at line 942 of file type1.c.

{
  switch(Code) {
    case HSTEM: /* |- y dy HSTEM |- */
      /* Vertical range of a horizontal stem zone */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      HStem(Stack[0], Stack[1]);
      ClearStack();
      break;
    case VSTEM: /* |- x dx VSTEM |- */
      /* Horizontal range of a vertical stem zone */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      VStem(Stack[0], Stack[1]);
      ClearStack();
      break;
    case VMOVETO: /* |- dy VMOVETO |- */
      /* Vertical MOVETO, equivalent to 0 dy RMOVETO */
      if (Top < 0) Error0("DoCommand: Stack low\n");
      RMoveTo(0.0, Stack[0]);
      ClearStack();
      break;
    case RLINETO: /* |- dx dy RLINETO |- */
      /* Like RLINETO in PostScript */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      RLineTo(Stack[0], Stack[1]);
      ClearStack();
      break;
    case HLINETO: /* |- dx HLINETO |- */
      /* Horizontal LINETO, equivalent to dx 0 RLINETO */
      if (Top < 0) Error0("DoCommand: Stack low\n");
      RLineTo(Stack[0], 0.0);
      ClearStack();
      break;
    case VLINETO: /* |- dy VLINETO |- */
      /* Vertical LINETO, equivalent to 0 dy RLINETO */
      if (Top < 0) Error0("DoCommand: Stack low\n");
      RLineTo(0.0, Stack[0]);
      ClearStack();
      break;
    case RRCURVETO:
      /* |- dx1 dy1 dx2 dy2 dx3 dy3 RRCURVETO |- */
      /* Relative RCURVETO, equivalent to dx1 dy1 */
      /* (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) */
      /* (dy1+dy2+dy3) RCURVETO in PostScript */
      if (Top < 5) Error0("DoCommand: Stack low\n");
      RRCurveTo(Stack[0], Stack[1], Stack[2], Stack[3],
        Stack[4], Stack[5]);
      ClearStack();
      break;
    case CLOSEPATH: /* - CLOSEPATH |- */
      /* Closes a subpath without repositioning the */
      /* current point */
      DoClosePath();
      ClearStack();
      break;
    case CALLSUBR: /* subr# CALLSUBR - */
      /* Calls a CharString subroutine with index */
      /* subr# from the Subrs array */
      if (Top < 0) Error0("DoCommand: Stack low\n");
      CallSubr((int)Stack[Top--]);
      break;
    case RETURN: /* - RETURN - */
      /* Returns from a Subrs array CharString */
      /* subroutine called with CALLSUBR */
      Return();
      break;
    case ESCAPE: /* ESCAPE to two-byte command code */
      if (!DoRead(&Code)) Error0("DoCommand: ESCAPE is last byte\n");
      Escape(Code);
      break;
    case HSBW: /* |- sbx wx HSBW |- */
      /* Set the left sidebearing point to (sbx,0), */
      /* set the character width vector to (wx,0). */
      /* Equivalent to sbx 0 wx 0 SBW.  Space */
      /* character should have sbx = 0 */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      Sbw(Stack[0], 0.0, Stack[1], 0.0);
      ClearStack();
      break;
    case ENDCHAR: /* - ENDCHAR |- */
      /* Finishes a CharString outline */
      EndChar();
      ClearStack();
      break;
    case RMOVETO: /* |- dx dy RMOVETO |- */
      /* Behaves like RMOVETO in PostScript */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      RMoveTo(Stack[0], Stack[1]);
      ClearStack();
      break;
    case HMOVETO: /* |- dx HMOVETO |- */
      /* Horizontal MOVETO. Equivalent to dx 0 RMOVETO */
      if (Top < 0) Error0("DoCommand: Stack low\n");
      RMoveTo(Stack[0], 0.0);
      ClearStack();
      break;
    case VHCURVETO: /* |- dy1 dx2 dy2 dx3 VHCURVETO |- */
      /* Vertical-Horizontal CURVETO, equivalent to */
      /* 0 dy1 dx2 dy2 dx3 0 RRCURVETO */
      if (Top < 3) Error0("DoCommand: Stack low\n");
      RRCurveTo(0.0, Stack[0], Stack[1], Stack[2],
              Stack[3], 0.0);
      ClearStack();
      break;
    case HVCURVETO: /* |- dx1 dx2 dy2 dy3 HVCURVETO |- */
      /* Horizontal-Vertical CURVETO, equivalent to */
      /* dx1 0 dx2 dy2 0 dy3 RRCURVETO */
      if (Top < 3) Error0("DoCommand: Stack low\n");
      RRCurveTo(Stack[0], 0.0, Stack[1], Stack[2], 0.0, Stack[3]);
      ClearStack();
      break;
    default: /* Unassigned command code */
      ClearStack();
      Error1("DoCommand: Unassigned code %d\n", Code);
  }
}

Here is the call graph for this function:

static int DoRead ( int CodeP) [static]

Definition at line 891 of file type1.c.

{
  if (strindex >= CharStringP->len) return(FALSE); /* end of string */
  *CodeP = Decrypt((unsigned char) CharStringP->data.stringP[strindex++]);
  return(TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void DotSection ( void  ) [static]

Definition at line 1331 of file type1.c.

{
  IfTrace0((FontDebug), "DotSection\n");
  InDotSection = !InDotSection;
}

Here is the caller graph for this function:

static void EndChar ( void  ) [static]

Definition at line 1292 of file type1.c.

{
  IfTrace0((FontDebug), "EndChar\n");
 
  /* There is no need to compute and set bounding box for
     the cache, since XIMAGER does that on the fly. */
 
  /* Perform a Closepath just in case the command was left out */
  path = ClosePath(path);
 
  /* Set character width */
  path = Join(Snap(path), Loc(CharSpace, escapementX, escapementY));
 
}

Here is the caller graph for this function:

static Escape ( ) [static]
static void Escape ( int  Code) [static]

Definition at line 1060 of file type1.c.

{
  int i, Num;
  struct segment *p;
 
  switch(Code) {
    case DOTSECTION: /* - DOTSECTION |- */
      /* Brackets an outline section for the dots in */
      /* letters such as "i", "j", and "!". */
      DotSection();
      ClearStack();
      break;
    case VSTEM3: /* |- x0 dx0 x1 dx1 x2 dx2 VSTEM3 |- */
      /* Declares the horizontal ranges of three */
      /* vertical stem zones between x0 and x0+dx0, */
      /* x1 and x1+dx1, and x2 and x2+dx2. */
      if (Top < 5) Error0("DoCommand: Stack low\n");
      if (!wsset && ProcessHints) {
        /* Shift the whole character so that the middle stem is centered. */
        p = CenterStem(Stack[2] + sidebearingX, Stack[3]);
        path = Join(path, p);
        wsset = 1;
      }
 
      VStem(Stack[0], Stack[1]);
      VStem(Stack[2], Stack[3]);
      VStem(Stack[4], Stack[5]);
      ClearStack();
      break;
    case HSTEM3: /* |- y0 dy0 y1 dy1 y2 dy2 HSTEM3 |- */
      /* Declares the vertical ranges of three hori- */
      /* zontal stem zones between y0 and y0+dy0, */
      /* y1 and y1+dy1, and y2 and y2+dy2. */
      if (Top < 5) Error0("DoCommand: Stack low\n");
      HStem(Stack[0], Stack[1]);
      HStem(Stack[2], Stack[3]);
      HStem(Stack[4], Stack[5]);
      ClearStack();
      break;
    case SEAC: /* |- asb adx ady bchar achar SEAC |- */
      /* Standard Encoding Accented Character. */
      if (Top < 4) Error0("DoCommand: Stack low\n");
      Seac(Stack[0], Stack[1], Stack[2],
        (unsigned char) Stack[3],
        (unsigned char) Stack[4]);
      ClearStack();
      break;
    case SBW: /* |- sbx sby wx wy SBW |- */
      /* Set the left sidebearing point to (sbx,sby), */
      /* set the character width vector to (wx,wy). */
      if (Top < 3) Error0("DoCommand: Stack low\n");
      Sbw(Stack[0], Stack[1], Stack[2], Stack[3]);
      ClearStack();
      break;
    case DIV: /* num1 num2 DIV quotient */
      /* Behaves like DIV in the PostScript language */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      Stack[Top-1] = Div(Stack[Top-1], Stack[Top]);
      Top--;
      break;
    case CALLOTHERSUBR:
      /* arg1 ... argn n othersubr# CALLOTHERSUBR - */
      /* Make calls on the PostScript interpreter */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      Num = Stack[Top-1];
      if (Top < Num+1) Error0("DoCommand: Stack low\n");
      for (i = 0; i < Num; i++) PSFakePush(Stack[Top - i - 2]);
      Top -= Num + 2;
      CallOtherSubr((int)Stack[Top + Num + 2]);
      break;
    case POP: /* - POP number */
      /* Removes a number from the top of the */
      /* PostScript interpreter stack and pushes it */
      /* onto the Type 1 BuildChar operand stack */
      Push(PSFakePop());
      break;
    case SETCURRENTPOINT: /* |- x y SETCURRENTPOINT |- */
      /* Sets the current point to (x,y) in absolute */
      /* character space coordinates without per- */
      /* forming a CharString MOVETO command */
      if (Top < 1) Error0("DoCommand: Stack low\n");
      SetCurrentPoint(Stack[0], Stack[1]);
      ClearStack();
      break;
    default: /* Unassigned escape code command */
      ClearStack();
      Error1("Escape: Unassigned code %d\n", Code);
  }
}

Here is the call graph for this function:

static struct segment* FindStems ( DOUBLE  x,
DOUBLE  y,
DOUBLE  dx,
DOUBLE  dy 
) [static, read]

Definition at line 652 of file type1.c.

{
  int i;
  int newvert, newhor;
  struct segment *p;
  int newhorhalf, newverthalf;
 
  if (InDotSection) return(NULL);
 
  newvert = newhor = -1;
  newhorhalf = newverthalf = -1;
 
  for (i = currstartstem; i < numstems; i++) {
    if (stems[i].vertical) { /* VSTEM hint */
      if ((x >= stems[i].x - EPS) &&
          (x <= stems[i].x+stems[i].dx + EPS)) {
        newvert = i;
        if (dy != 0.0) {
          if (dy < 0) newverthalf = LEFT;
          else        newverthalf = RIGHT;
        } else {
          if (x < stems[i].x+stems[i].dx / 2) newverthalf = LEFT;
          else                                newverthalf = RIGHT;
        }
      }
    } else {                 /* HSTEM hint */
      if ((y >= stems[i].y - EPS) &&
          (y <= stems[i].y+stems[i].dy + EPS)) {
        newhor = i;
        if (dx != 0.0) {
          if (dx < 0) newhorhalf = TOP;
          else        newhorhalf = BOTTOM;
        } else {
          if (y < stems[i].y+stems[i].dy / 2) newhorhalf = BOTTOM;
          else                                newhorhalf = TOP;
        }
      }
    }
  }
 
  p = NULL;
 
  if (newvert == -1 && oldvert == -1) ; /* Outside of any hints */
  else if (newvert == oldvert &&
    newverthalf == oldverthalf); /* No hint change */
  else if (oldvert == -1) { /* New vertical hint in effect */
    p = Applyhint(p, newvert, newverthalf);
  } else if (newvert == -1) { /* Old vertical hint no longer in effect */
    p = Applyrevhint(p, oldvert, oldverthalf);
  } else { /* New vertical hint in effect, old hint no longer in effect */
    p = Applyrevhint(p, oldvert, oldverthalf);
    p = Applyhint(p, newvert, newverthalf);
  }
 
  if (newhor == -1 && oldhor == -1) ; /* Outside of any hints */
  else if (newhor == oldhor &&
    newhorhalf == oldhorhalf) ; /* No hint change */
  else if (oldhor == -1) { /* New horizontal hint in effect */
    p = Applyhint(p, newhor, newhorhalf);
  } else if (newhor == -1) { /* Old horizontal hint no longer in effect */
    p = Applyrevhint(p, oldhor, oldhorhalf);
  }
  else { /* New horizontal hint in effect, old hint no longer in effect */
    p = Applyrevhint(p, oldhor, oldhorhalf);
    p = Applyhint(p, newhor, newhorhalf);
  }
 
  oldvert = newvert; oldverthalf = newverthalf;
  oldhor  = newhor;  oldhorhalf  = newhorhalf;
 
  return p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void FinitStems ( void  ) [static]

Definition at line 335 of file type1.c.

{
  int i;
 
  for (i = 0; i < numstems; i++) {
    Destroy(stems[i].lbhint);
    Destroy(stems[i].lbrevhint);
    Destroy(stems[i].rthint);
    Destroy(stems[i].rtrevhint);
  }
}

Here is the caller graph for this function:

static void FlxProc ( DOUBLE  c1x2,
DOUBLE  c1y2,
DOUBLE  c3x0,
DOUBLE  c3y0,
DOUBLE  c3x1,
DOUBLE  c3y1,
DOUBLE  c3x2,
DOUBLE  c3y2,
DOUBLE  c4x0,
DOUBLE  c4y0,
DOUBLE  c4x1,
DOUBLE  c4y1,
DOUBLE  c4x2,
DOUBLE  c4y2,
DOUBLE  epY,
DOUBLE  epX,
int  idmin 
) [static]

Definition at line 1511 of file type1.c.

{
  DOUBLE dmin;
  DOUBLE c1x0, c1y0, c1x1, c1y1;
  DOUBLE c2x0, c2y0, c2x1, c2y1, c2x2, c2y2;
  char yflag;
  DOUBLE x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5;
  DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */
  int flipXY;
  DOUBLE x, y;
  DOUBLE erosion = 1; /* Device parameter */
    /* Erosion may have different value specified in 'internaldict' */
  DOUBLE shrink;
  DOUBLE dX, dY;
  char erode;
  DOUBLE eShift;
  DOUBLE cx, cy;
  DOUBLE ex, ey;
 
  Destroy(path);
  path = FlxOldPath; /* Restore previous path (stored in FlxProc1) */
 
  if (ProcessHints) {
    dmin = ABS(idmin) / 100.0; /* Minimum Flex height in pixels */
 
    c2x2 = c4x2; c2y2 = c4y2; /* Point c2 = c4 */
 
    yflag = FABS(c1y2 - c3y2) > FABS(c1x2 - c3x2); /* Flex horizontal? */
 
    QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */
 
    if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001)
      flipXY = -1; /* Char on side */
    else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001)
      flipXY = 1; /* Char upright */
    else
      flipXY = 0; /* Char at angle */
 
    if (yflag) { /* Flex horizontal */
      if (flipXY == 0 || c3y2 == c4y2) { /* Char at angle or Flex height = 0 */
        PickCoords(FALSE); /* Pick original control points */
      } else {
        shrink = FABS((c1y2 - c4y2) / (c3y2 - c4y2)); /* Slope */
 
        c1x0 = c3x0; c1y0 = yshrink(c3y0);
        c1x1 = c3x1; c1y1 = yshrink(c3y1);
        c2x0 = c4x0; c2y0 = yshrink(c4y0);
        c2x1 = c4x1; c2y1 = yshrink(c4y1);
 
        dtransform(0.0, ROUND(c3y2-c1y2), &x, &y); /* Flex height in pixels */
        dY = FABS((flipXY == 1) ? y : x);
        PickCoords(dY < dmin); /* If Flex small, pick 'shrunk' control points */
 
        if (FABS(y2 - c1y2) > 0.001) { /* Flex 'non-zero'? */
          transform(c1x2, c1y2, &x, &y);
 
          if (flipXY == 1) {
            cx = x; cy = y;
          } else {
            cx = y; cy = x;
          }
 
          dtransform(0.0, ROUND(y2-c1y2), &x, &y);
          dY = (flipXY == 1) ? y : x;
          if (ROUND(dY) != 0)
            dY = ROUND(dY);
          else
            dY = (dY < 0) ? -1 : 1;
 
          erode = PaintType != 2 && erosion >= 0.5;
          if (erode)
            cy -= 0.5;
          ey = cy + dY;
          ey = CEIL(ey) - ey + FLOOR(ey);
          if (erode)
            ey += 0.5;
 
          if (flipXY == 1) {
            itransform(cx, ey, &x, &y);
          } else {
            itransform(ey, cx, &x, &y);
          }
 
          eShift = y - y2;
          y1 += eShift;
          y2 += eShift;
          y3 += eShift;
        }
      }
    } else { /* Flex vertical */
      if (flipXY == 0 || c3x2 == c4x2) { /* Char at angle or Flex height = 0 */
        PickCoords(FALSE); /* Pick original control points */
      } else {
        shrink = FABS((c1x2 - c4x2) / (c3x2 - c4x2)); /* Slope */
 
        c1x0 = xshrink(c3x0); c1y0 = c3y0;
        c1x1 = xshrink(c3x1); c1y1 = c3y1;
        c2x0 = xshrink(c4x0); c2y0 = c4y0;
        c2x1 = xshrink(c4x1); c2y1 = c4y1;
 
        dtransform(ROUND(c3x2 - c1x2), 0.0, &x, &y); /* Flex height in pixels */
        dX = FABS((flipXY == -1) ? y : x);
        PickCoords(dX < dmin); /* If Flex small, pick 'shrunk' control points */
 
        if (FABS(x2 - c1x2) > 0.001) {
          transform(c1x2, c1y2, &x, &y);
          if (flipXY == -1) {
            cx = y; cy = x;
          } else {
            cx = x; cy = y;
          }
 
          dtransform(ROUND(x2-c1x2), 0.0, &x, &y);
          dX = (flipXY == -1) ? y : x;
          if (ROUND(dX) != 0)
            dX = ROUND(dX);
          else
            dX = (dX < 0) ? -1 : 1;
 
          erode = PaintType != 2 && erosion >= 0.5;
          if (erode)
            cx -= 0.5;
          ex = cx + dX;
          ex = CEIL(ex) - ex + FLOOR(ex);
          if (erode)
            ex += 0.5;
 
          if (flipXY == -1) {
            itransform(cy, ex, &x, &y);
          } else {
            itransform(ex, cy, &x, &y);
          }
 
          eShift = x - x2;
          x1 += eShift;
          x2 += eShift;
          x3 += eShift;
        }
      }
    }
 
    if (x2 == x5 || y2 == y5) {
      lineto(x5, y5);
    } else {
      curveto(x0, y0, x1, y1, x2, y2);
      curveto(x3, y3, x4, y4, x5, y5);
    }
  } else { /* ProcessHints is off */
    PickCoords(FALSE); /* Pick original control points */
    curveto(x0, y0, x1, y1, x2, y2);
    curveto(x3, y3, x4, y4, x5, y5);
  }
 
  PSFakePush(epY);
  PSFakePush(epX);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void FlxProc1 ( void  ) [static]

Definition at line 1677 of file type1.c.

{
  struct segment *CurrentPoint;
 
  CurrentPoint = Phantom(path);
 
  FlxOldPath = path;
  path = CurrentPoint;
}

Here is the caller graph for this function:

static void FlxProc2 ( void  ) [static]

Definition at line 1690 of file type1.c.

{
  struct segment *CurrentPoint;
  DOUBLE CurrentX, CurrentY;
 
  CurrentPoint = Phantom(path);
  QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY);
  Destroy(CurrentPoint);
 
  /* Push CurrentPoint on fake PostScript stack */
  PSFakePush(CurrentX);
  PSFakePush(CurrentY);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void HintReplace ( void  ) [static]

Definition at line 1707 of file type1.c.

{
  /* Effectively retire the current stems, but keep them around for */
  /* revhint use in case we are in a stem when we replace hints. */
  currstartstem = numstems;
 
  /* 'subr#' is left on PostScript stack (for 'pop callsubr') */
}

Here is the caller graph for this function:

static HStem ( ) [static]
static void HStem ( DOUBLE  y,
DOUBLE  dy 
) [static]

Definition at line 1155 of file type1.c.

{
  IfTrace2((FontDebug), "Hstem %f %f\n", &y, &dy);
  if (ProcessHints) {
    if (numstems >= MAXSTEMS) Error0("HStem: Too many hints\n");
    if (dy < 0.0) {y += dy; dy = -dy;}
    stems[numstems].vertical = FALSE;
    stems[numstems].x = 0.0;
    stems[numstems].y = sidebearingY + y + wsoffsetY;
    stems[numstems].dx = 0.0;
    stems[numstems].dy = dy;
    ComputeStem(numstems);
    numstems++;
  }
}

Here is the call graph for this function:

static void InitStems ( void  ) [static]

Definition at line 328 of file type1.c.

Here is the caller graph for this function:

static void PopCall ( psobj **  CurrStrPP,
int CurrIndexP,
unsigned short CurrKeyP 
) [static]

Definition at line 773 of file type1.c.

{
  if (CallTop >= 0) {
    *CurrStrPP = CallStack[CallTop].currstrP; /* restore CharString pointer */
    *CurrIndexP = CallStack[CallTop].currindex; /* restore CharString index */
    *CurrKeyP = CallStack[CallTop--].currkey;   /* restore decryption key */
  }
  else Error0("PopCall: Stack empty\n");
}

Here is the caller graph for this function:

static DOUBLE PSFakePop ( void  ) [static]

Definition at line 800 of file type1.c.

{
  if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]);
  else Error0("PSFakePop : Stack empty\n");
  /*NOTREACHED*/
}

Here is the caller graph for this function:

static void PSFakePush ( DOUBLE  Num) [static]

Definition at line 792 of file type1.c.

{
  if (++PSFakeTop < MAXPSFAKESTACK) PSFakeStack[PSFakeTop] = Num;
  else Error0("PSFakePush: Stack full\n");
}

Here is the caller graph for this function:

static void Push ( DOUBLE  Num) [static]

Definition at line 751 of file type1.c.

{
  if (++Top < MAXSTACK) Stack[Top] = Num;
  else Error0("Push: Stack full\n");
}

Here is the caller graph for this function:

static void PushCall ( psobj CurrStrP,
int  CurrIndex,
unsigned short  CurrKey 
) [static]

Definition at line 763 of file type1.c.

{
  if (++CallTop < MAXCALLSTACK) {
    CallStack[CallTop].currstrP = CurrStrP;   /* save CharString pointer */
    CallStack[CallTop].currindex = CurrIndex; /* save CharString index */
    CallStack[CallTop].currkey = CurrKey;     /* save decryption key */
  }
  else Error0("PushCall: Stack full\n");
}

Here is the caller graph for this function:

static void Return ( void  ) [static]

Definition at line 1278 of file type1.c.

{
  IfTrace0((FontDebug), "Return\n");
  PopCall(&CharStringP, &strindex, &r);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static RLineTo ( ) [static]
static void RLineTo ( DOUBLE  dx,
DOUBLE  dy 
) [static]

Definition at line 1195 of file type1.c.

{
  struct segment *B;
 
  IfTrace2((FontDebug), "RLineTo %f %f\n", &dx, &dy);
 
  B = Loc(CharSpace, dx, dy);
 
  if (ProcessHints) {
    currx += dx;
    curry += dy;
    /* B = Join(B, FindStems(currx, curry)); */
    B = Join(B, FindStems(currx, curry, dx, dy));
  }
 
  path = Join(path, Line(B));
}

Here is the call graph for this function:

static RMoveTo ( ) [static]
static void RMoveTo ( DOUBLE  dx,
DOUBLE  dy 
) [static]

Definition at line 1309 of file type1.c.

{
  struct segment *B;
 
  IfTrace2((FontDebug), "RMoveTo %f %f\n", &dx, &dy);
 
  B = Loc(CharSpace, dx, dy);
 
  if (ProcessHints) {
    currx += dx;
    curry += dy;
    /* B = Join(B, FindStems(currx, curry)); */
    B = Join(B, FindStems(currx, curry, 0.0, 0.0));
  }
 
  path = Join(path, B);
}

Here is the call graph for this function:

static RRCurveTo ( ) [static]
static void RRCurveTo ( DOUBLE  dx1,
DOUBLE  dy1,
DOUBLE  dx2,
DOUBLE  dy2,
DOUBLE  dx3,
DOUBLE  dy3 
) [static]

Definition at line 1218 of file type1.c.

{
  struct segment *B, *C, *D;
 
  IfTrace4((FontDebug), "RRCurveTo %f %f %f %f ", &dx1, &dy1, &dx2, &dy2);
  IfTrace2((FontDebug), "%f %f\n", &dx3, &dy3);
 
  B = Loc(CharSpace, dx1, dy1);
  C = Loc(CharSpace, dx2, dy2);
  D = Loc(CharSpace, dx3, dy3);
 
  if (ProcessHints) {
    /* For a Bezier curve, we apply the full hint value to
       the Bezier C point (and thereby D point). */
    currx += dx1 + dx2 + dx3;
    curry += dy1 + dy2 + dy3;
    /* C = Join(C, FindStems(currx, curry)); */
    C = Join(C, FindStems(currx, curry, dx3, dy3));
  }
 
  /* Since XIMAGER is not completely relative, */
  /* we need to add up the delta values */
 
  C = Join(C, Dup(B));
  D = Join(D, Dup(C));
 
  path = Join(path, Bezier(B, C, D));
}

Here is the call graph for this function:

static Sbw ( ) [static]
static void Sbw ( DOUBLE  sbx,
DOUBLE  sby,
DOUBLE  wx,
DOUBLE  wy 
) [static]

Definition at line 1406 of file type1.c.

{
  IfTrace4((FontDebug), "SBW %f %f %f %f\n", &sbx, &sby, &wx, &wy);
 
  escapementX = wx; /* Character width vector */
  escapementY = wy;
 
  /* Sidebearing values are sbx, sby args, plus accent offset from Seac(). */
  sidebearingX = sbx + accentoffsetX;
  sidebearingY = sby + accentoffsetY;
 
  path = Join(path, Loc(CharSpace, sidebearingX, sidebearingY));
  if (ProcessHints) {currx = sidebearingX; curry = sidebearingY;}
}
static Seac ( ) [static]
static void Seac ( DOUBLE  asb,
DOUBLE  adx,
DOUBLE  ady,
unsigned char  bchar,
unsigned char  achar 
) [static]

Definition at line 1339 of file type1.c.

{
  int Code;
  struct segment *mypath;
 
  IfTrace4((FontDebug), "SEAC %f %f %f %d ", &asb, &adx, &ady, bchar);
  IfTrace1((FontDebug), "%d\n", achar);
 
  /* Move adx - asb, ady over and up from base char's sbpoint. */
  /* (We use adx - asb to counteract the accents sb shift.) */
  /* The variables accentoffsetX/Y modify sidebearingX/Y in Sbw(). */
  /* Note that these incorporate the base character's sidebearing shift by */
  /* using the current sidebearingX, Y values. */
  accentoffsetX = sidebearingX + adx - asb;
  accentoffsetY = sidebearingY + ady;
 
  /* Set path = NULL to avoid complaints from Sbw(). */
  path = NULL;
 
  /* Go find the CharString for the accent's code via an upcall */
  CharStringP = GetType1CharString(Environment, achar);
  if (CharStringP == NULL) {
     Error1("Invalid accent ('%03o) in SEAC\n", achar);
     return;
  }
  StartDecrypt();
 
  ClearStack();
  ClearPSFakeStack();
  ClearCallStack();
 
  for (;;) {
    if (!DoRead(&Code)) break;
    Decode(Code);
    if (errflag) return;
  }
  /* Copy snapped path to mypath and set path to NULL as above. */
  mypath = Snap(path);
  path = NULL;
 
  /* We must reset these to null now. */
  accentoffsetX = accentoffsetY = 0;
 
  /* go find the CharString for the base char's code via an upcall */
  CharStringP = GetType1CharString(Environment, bchar);
  StartDecrypt();
 
  ClearStack();
  ClearPSFakeStack();
  ClearCallStack();
 
  FinitStems();
  InitStems();
 
  for (;;) {
    if (!DoRead(&Code)) break;
    Decode(Code);
    if (errflag) return;
  }
  path = Join(mypath, path);
}

Here is the call graph for this function:

static SetCurrentPoint ( ) [static]
static void SetCurrentPoint ( DOUBLE  x,
DOUBLE  y 
) [static]

Definition at line 1754 of file type1.c.

{
  IfTrace2((FontDebug), "SetCurrentPoint %f %f\n", &x, &y);
 
  currx = x;
  curry = y;
}
static void StartDecrypt ( void  ) [static]

Definition at line 902 of file type1.c.

{
  int Code;
 
  r = KEY; /* Initial key (seed) for CharStrings decryption */
  for (strindex = 0; strindex < blues->lenIV;)
    if (!DoRead(&Code)) /* Read a byte and update decryption key */
      Error0("StartDecrypt: Premature end of CharString\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct xobject* Type1Char ( char *  env,
struct XYspace S,
psobj charstrP,
psobj subrsP,
psobj osubrsP,
struct blues_struct bluesP,
int modeP 
) [read]

Definition at line 1765 of file type1.c.

{
  int Code;
 
  path = NULL;
  errflag = FALSE;
 
  /* Make parameters available to all Type1 routines */
  Environment = env;
  CharSpace = S; /* used when creating path elements */
  CharStringP = charstrP;
  SubrsP = subrsP;
  OtherSubrsP = osubrsP;
  ModeP = modeP;
 
    blues = bluesP;
 
  /* compute the alignment zones */
  ComputeAlignmentZones();
 
  StartDecrypt();
 
  ClearStack();
  ClearPSFakeStack();
  ClearCallStack();
 
  InitStems();
 
  currx = curry = 0;
  escapementX = escapementY = 0;
  sidebearingX = sidebearingY = 0;
  accentoffsetX = accentoffsetY = 0;
  wsoffsetX = wsoffsetY = 0;           /* No shift to preserve whitspace. */
  wsset = 0;                           /* wsoffsetX,Y haven't been set yet. */
 
  for (;;) {
    if (!DoRead(&Code)) break;
    Decode(Code);
    if (errflag) break;
  }
 
  FinitStems();
 
 
  /* Clean up if an error has occurred */
  if (errflag) {
    if (path != NULL) {
      Destroy(path); /* Reclaim storage */
      path = NULL;   /* Indicate that character could not be built */
    }
  }
 
  return((struct xobject *) path);
}

Here is the call graph for this function:

static VStem ( ) [static]
static void VStem ( DOUBLE  x,
DOUBLE  dx 
) [static]

Definition at line 1176 of file type1.c.

{
  IfTrace2((FontDebug), "Vstem %f %f\n", &x, &dx);
  if (ProcessHints) {
    if (numstems >= MAXSTEMS) Error0("VStem: Too many hints\n");
    if (dx < 0.0) {x += dx; dx = -dx;}
    stems[numstems].vertical = TRUE;
    stems[numstems].x = sidebearingX + x + wsoffsetX;
    stems[numstems].y = 0.0;
    stems[numstems].dx = dx;
    stems[numstems].dy = 0.0;
    ComputeStem(numstems);
    numstems++;
  }
}

Here is the call graph for this function:


Variable Documentation

Definition at line 148 of file type1.c.

Definition at line 148 of file type1.c.

struct alignmentzone[MAXALIGNMENTZONES] [static]

Definition at line 240 of file type1.c.

struct blues_struct* blues [static]

Definition at line 239 of file type1.c.

struct callstackentry[MAXCALLSTACK] [static]

Definition at line 741 of file type1.c.

int CallTop [static]

Definition at line 742 of file type1.c.

struct XYspace* CharSpace [static]

Definition at line 157 of file type1.c.

psobj* CharStringP [static]

Definition at line 158 of file type1.c.

Definition at line 123 of file type1.c.

Definition at line 322 of file type1.c.

DOUBLE currx [static]

Definition at line 731 of file type1.c.

DOUBLE curry [static]

Definition at line 731 of file type1.c.

char* Environment [static]

Definition at line 156 of file type1.c.

int errflag [static]

Definition at line 151 of file type1.c.

DOUBLE escapementX [static]

Definition at line 146 of file type1.c.

DOUBLE escapementY [static]

Definition at line 146 of file type1.c.

struct segment* FlxOldPath [static]

Definition at line 234 of file type1.c.

struct XYspace* IDENTITY

Definition at line 178 of file spaces.c.

Definition at line 319 of file type1.c.

int* ModeP [static]

Definition at line 159 of file type1.c.

Definition at line 241 of file type1.c.

Definition at line 321 of file type1.c.

Definition at line 323 of file type1.c.

Definition at line 324 of file type1.c.

Definition at line 323 of file type1.c.

Definition at line 324 of file type1.c.

psobj * OtherSubrsP [static]

Definition at line 158 of file type1.c.

struct segment* path [static]

Definition at line 150 of file type1.c.

Definition at line 743 of file type1.c.

int PSFakeTop [static]

Definition at line 744 of file type1.c.

unsigned short r [static]

Definition at line 879 of file type1.c.

DOUBLE sidebearingX [static]

Definition at line 147 of file type1.c.

DOUBLE sidebearingY [static]

Definition at line 147 of file type1.c.

DOUBLE Stack[MAXSTACK] [static]

Definition at line 739 of file type1.c.

int strindex [static]

Definition at line 730 of file type1.c.

psobj * SubrsP [static]

Definition at line 158 of file type1.c.

LONG tmpi [static]

Definition at line 111 of file type1.c.

DOUBLE tmpx [static]

Definition at line 110 of file type1.c.

int Top [static]

Definition at line 740 of file type1.c.

Definition at line 325 of file type1.c.

Definition at line 325 of file type1.c.

Definition at line 326 of file type1.c.