summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Type1/Makefile.am1
-rw-r--r--src/Type1/arith.c276
-rw-r--r--src/Type1/arith.h6
-rw-r--r--src/Type1/digit.h2
-rw-r--r--src/Type1/fontfcn.c11
-rw-r--r--src/Type1/fontfcn.h2
-rw-r--r--src/Type1/lines.c69
-rw-r--r--src/Type1/lines.h2
-rw-r--r--src/Type1/objects.c267
-rw-r--r--src/Type1/objects.h39
-rw-r--r--src/Type1/paths.c660
-rw-r--r--src/Type1/paths.h34
-rw-r--r--src/Type1/regions.c423
-rw-r--r--src/Type1/regions.h26
-rw-r--r--src/Type1/scanfont.c2
-rw-r--r--src/Type1/spaces.c221
-rw-r--r--src/Type1/spaces.h21
-rw-r--r--src/Type1/t1malloc.c4
-rw-r--r--src/Type1/t1stub.c56
19 files changed, 232 insertions, 1890 deletions
diff --git a/src/Type1/Makefile.am b/src/Type1/Makefile.am
index 9adaa0e..0a2a607 100644
--- a/src/Type1/Makefile.am
+++ b/src/Type1/Makefile.am
@@ -39,7 +39,6 @@ libtype1_la_SOURCES = \
t1malloc.c \
t1snap.c \
t1stdio.h \
- t1stub.c \
t1unicode.c \
t1unicode.h \
token.c \
diff --git a/src/Type1/arith.c b/src/Type1/arith.c
index 9611543..92a372a 100644
--- a/src/Type1/arith.c
+++ b/src/Type1/arith.c
@@ -113,7 +113,7 @@ SIGNBITON tests the high order bit of a long 'w':
The two multiplicands must be positive.
*/
-void
+static void
DLmult(doublelong *product, unsigned long u, unsigned long v)
{
#ifdef LONG64
@@ -157,197 +157,6 @@ DLmult(doublelong *product, unsigned long u, unsigned long v)
}
/*
-:h2.DLdiv() - Divide Two Longs by One Long, Yielding Two Longs
-
-Both the dividend and the divisor must be positive.
-*/
-
-void
-DLdiv(doublelong *quotient, /* also where dividend is, originally */
- unsigned long divisor)
-{
-#ifdef LONG64
-/* printf("DLdiv(%lx %lx)\n", quotient, divisor); */
- *quotient /= divisor;
-/* printf("DLdiv returns %lx\n", *quotient); */
-#else
- register unsigned long u1u2 = quotient->high;
- register unsigned long u3u4 = quotient->low;
- register long u3; /* single digit of dividend */
- register int v1,v2; /* divisor in registers */
- register long t; /* signed copy of u1u2 */
- register int qhat; /* guess at the quotient digit */
- register unsigned long q3q4; /* low two digits of quotient */
- register int shift; /* holds the shift value for normalizing */
- register int j; /* loop variable */
-
-/* printf("DLdiv(%x %x, %x)\n", quotient->high, quotient->low, divisor); */
- /*
- * Knuth's algorithm works if the dividend is smaller than the
- * divisor. We can get to that state quickly:
- */
- if (u1u2 >= divisor) {
- quotient->high = u1u2 / divisor;
- u1u2 %= divisor;
- }
- else
- quotient->high = 0;
-
- if (divisor <= MAXSHORT) {
-
- /*
- * This is the case where the divisor is contained in one
- * 'short'. It is worthwhile making this fast:
- */
- u1u2 = ASSEMBLE(u1u2, HIGHDIGIT(u3u4));
- q3q4 = u1u2 / divisor;
- u1u2 %= divisor;
- u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3u4));
- quotient->low = ASSEMBLE(q3q4, u1u2 / divisor);
- return;
- }
-
-
- /*
- * At this point the divisor is a true 'long' so we must use
- * Knuth's algorithm.
- *
- * Step D1: Normalize divisor and dividend (this makes our 'qhat'
- * guesses more accurate):
- */
- for (shift=0; !SIGNBITON(divisor); shift++, divisor <<= 1) { ; }
- shift--;
- divisor >>= 1;
-
- if ((u1u2 >> (LONGSIZE - shift)) != 0 && shift != 0)
- Abort("DLdiv: dividend too large");
- u1u2 = (u1u2 << shift) + ((shift == 0) ? 0 : u3u4 >> (LONGSIZE - shift));
- u3u4 <<= shift;
-
- /*
- * Step D2: Begin Loop through digits, dividing u1,u2,u3 by v1,v2,
- * then shifting U left by 1 digit:
- */
- v1 = HIGHDIGIT(divisor);
- v2 = LOWDIGIT(divisor);
- q3q4 = 0;
- u3 = HIGHDIGIT(u3u4);
-
- for (j=0; j < 2; j++) {
-
- /*
- * Step D3: make a guess (qhat) at the next quotient denominator:
- */
- qhat = (HIGHDIGIT(u1u2) == v1) ? MAXSHORT : u1u2 / v1;
- /*
- * At this point Knuth would have us further refine our
- * guess, since we know qhat is too big if
- *
- * v2 * qhat > ASSEMBLE(u1u2 % v, u3)
- *
- * That would make sense if u1u2 % v was easy to find, as it
- * would be in assembly language. I ignore this step, and
- * repeat step D6 if qhat is too big.
- */
-
- /*
- * Step D4: Multiply v1,v2 times qhat and subtract it from
- * u1,u2,u3:
- */
- u3 -= qhat * v2;
- /*
- * The high digit of u3 now contains the "borrow" for the
- * rest of the substraction from u1,u2.
- * Sometimes we can lose the sign bit with the above.
- * If so, we have to force the high digit negative:
- */
- t = HIGHDIGIT(u3);
- if (t > 0)
- t |= -1 << SHORTSIZE;
- t += u1u2 - qhat * v1;
-/* printf("..>divide step qhat=%x t=%x u3=%x u1u2=%x v1=%x v2=%x\n",
- qhat, t, u3, u1u2, v1, v2); */
- while (t < 0) { /* Test is Step D5. */
-
- /*
- * D6: Oops, qhat was too big. Add back in v1,v2 and
- * decrease qhat by 1:
- */
- u3 = LOWDIGIT(u3) + v2;
- t += HIGHDIGIT(u3) + v1;
- qhat--;
-/* printf("..>>qhat correction t=%x u3=%x qhat=%x\n", t, u3, qhat); */
- }
- /*
- * Step D7: shift U left one digit and loop:
- */
- u1u2 = t;
- if (HIGHDIGIT(u1u2) != 0)
- Abort("divide algorithm error");
- u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3));
- u3 = LOWDIGIT(u3u4);
- q3q4 = ASSEMBLE(q3q4, qhat);
- }
- quotient->low = q3q4;
-/* printf("DLdiv returns %x %x\n", quotient->high, quotient->low); */
-#endif /* !LONG64 */
- return;
-}
-
-/*
-:h3.DLadd() - Add Two Double Longs
-
-In this case, the doublelongs may be signed. The algorithm takes the
-piecewise sum of the high and low longs, with the possibility that the
-high should be incremented if there is a carry out of the low. How to
-tell if there is a carry? Alex Harbury suggested that if the sum of
-the lows is less than the max of the lows, there must have been a
-carry. Conversely, if there was a carry, the sum of the lows must be
-less than the max of the lows. So, the test is "if and only if".
-*/
-
-void
-DLadd(doublelong *u, /* u = u + v */
- doublelong *v)
-{
-#ifdef LONG64
-/* printf("DLadd(%lx %lx)\n", *u, *v); */
- *u = *u + *v;
-/* printf("DLadd returns %lx\n", *u); */
-#else
- register unsigned long lowmax = MAX(u->low, v->low);
-
-/* printf("DLadd(%x %x, %x %x)\n", u->high, u->low, v->high, v->low); */
- u->high += v->high;
- u->low += v->low;
- if (lowmax > u->low)
- u->high++;
-#endif
-}
-/*
-:h3.DLsub() - Subtract Two Double Longs
-
-Testing for a borrow is even easier. If the v.low is greater than
-u.low, there must be a borrow.
-*/
-
-void
-DLsub(doublelong *u, /* u = u - v */
- doublelong *v)
-{
-#ifdef LONG64
-/* printf("DLsub(%lx %lx)\n", *u, *v); */
- *u = *u - *v;
-/* printf("DLsub returns %lx\n", *u); */
-#else
-/* printf("DLsub(%x %x, %x %x)\n", u->high, u->low, v->high, v->low);*/
- u->high -= v->high;
- if (v->low > u->low)
- u->high--;
- u->low -= v->low;
-#endif
-}
-/*
:h3.DLrightshift() - Macro to Shift Double Long Right by N
*/
@@ -401,86 +210,3 @@ FPmult(fractpel u, fractpel v)
return ((negative) ? -ret : ret);
#endif
}
-
-/*
-:h3.FPdiv() - Divide Two Fractional Pel Values
-
-These values may be signed. The function returns the quotient.
-*/
-
-fractpel
-FPdiv(fractpel dividend, fractpel divisor)
-{
- doublelong w; /* result will be built here */
- int negative = FALSE; /* flag for sign bit */
-#ifdef LONG64
- register fractpel ret;
-#endif
-
- if (dividend < 0) {
- dividend = -dividend;
- negative = TRUE;
- }
- if (divisor < 0) {
- divisor = -divisor;
- negative = !negative;
- }
-#ifndef LONG64
- w.low = dividend << FRACTBITS;
- w.high = dividend >> (LONGSIZE - FRACTBITS);
- DLdiv(&w, divisor);
- if (w.high != 0 || SIGNBITON(w.low)) {
- w.low = TOFRACTPEL(MAXSHORT);
- }
- return( (negative) ? -w.low : w.low);
-#else
- w = ((long)dividend) << FRACTBITS;
- DLdiv(&w, divisor);
- if (w & 0xffffffff80000000L ) {
- ret = TOFRACTPEL(MAXSHORT);
- }
- else
- ret = (fractpel)w;
- return( (negative) ? -ret : ret);
-#endif
-}
-
-/*
-:h3.FPstarslash() - Multiply then Divide
-
-Borrowing a chapter from the language Forth, it is useful to define
-an operator that first multiplies by one constant then divides by
-another, keeping the intermediate result in extended precision.
-*/
-
-fractpel
-FPstarslash(fractpel a, /* result = a * b / c */
- fractpel b,
- fractpel c)
-{
- doublelong w; /* result will be built here */
- int negative = FALSE;
-#ifdef LONG64
- register fractpel ret;
-#endif
-
- if (a < 0) { a = -a; negative = TRUE; }
- if (b < 0) { b = -b; negative = !negative; }
- if (c < 0) { c = -c; negative = !negative; }
-
- DLmult(&w, a, b);
- DLdiv(&w, c);
-#ifndef LONG64
- if (w.high != 0 || SIGNBITON(w.low)) {
- w.low = TOFRACTPEL(MAXSHORT);
- }
- return((negative) ? -w.low : w.low);
-#else
- if (w & 0xffffffff80000000L ) {
- ret = TOFRACTPEL(MAXSHORT);
- }
- else
- ret = (fractpel)w;
- return( (negative) ? -ret : ret);
-#endif
-}
diff --git a/src/Type1/arith.h b/src/Type1/arith.h
index 6c810b9..73b84a7 100644
--- a/src/Type1/arith.h
+++ b/src/Type1/arith.h
@@ -66,12 +66,6 @@ typedef struct {
}
#endif
-extern void DLmult ( doublelong *product, unsigned long u, unsigned long v );
-extern void DLdiv ( doublelong *quotient, unsigned long divisor );
-extern void DLadd ( doublelong *u, doublelong *v );
-extern void DLsub ( doublelong *u, doublelong *v );
extern fractpel FPmult ( fractpel u, fractpel v );
-extern fractpel FPdiv ( fractpel dividend, fractpel divisor );
-extern fractpel FPstarslash ( fractpel a, fractpel b, fractpel c );
/*END SHARED*/
diff --git a/src/Type1/digit.h b/src/Type1/digit.h
index c693809..44e418c 100644
--- a/src/Type1/digit.h
+++ b/src/Type1/digit.h
@@ -42,7 +42,7 @@
* values as part of numbers of radix 2-36.
*
*/
-unsigned char digit_value[256] = {
+static const unsigned char digit_value[256] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
diff --git a/src/Type1/fontfcn.c b/src/Type1/fontfcn.c
index 5149561..ba5db0e 100644
--- a/src/Type1/fontfcn.c
+++ b/src/Type1/fontfcn.c
@@ -56,11 +56,10 @@ extern struct segment *Type1Char ( char *env, XYspace S,
/***================================================================***/
/* GLOBALS */
/***================================================================***/
-char CurFontName[120];
-char *CurFontEnv;
-char *vm_base = NULL;
+static char CurFontName[120];
+static char *vm_base = NULL;
psfont *FontP = NULL;
-psfont TheCurrentFont;
+static psfont TheCurrentFont;
/***================================================================***/
/* SearchDict - look for name */
@@ -88,7 +87,7 @@ SearchDictName(psdict *dictP, psobj *keyP)
return(0);
}
-boolean
+static boolean
initFont(int cnt)
{
@@ -122,7 +121,7 @@ resetFont(char *env)
}
-int
+static int
readFont(char *env)
{
int rcode;
diff --git a/src/Type1/fontfcn.h b/src/Type1/fontfcn.h
index 33e9dc8..023302f 100644
--- a/src/Type1/fontfcn.h
+++ b/src/Type1/fontfcn.h
@@ -107,8 +107,6 @@ extern int scan_font ( psfont *FontP );
#define EXPANSIONFACTOR 16
extern int SearchDictName ( psdict *dictP, psobj *keyP );
-extern boolean initFont ( int cnt );
-extern int readFont ( char *env );
extern struct xobject *fontfcnB ( struct XYspace *S, unsigned char *code,
int *lenP, int *mode );
extern Bool fontfcnA ( char *env, int *mode );
diff --git a/src/Type1/lines.c b/src/Type1/lines.c
index 835afc6..72fb79f 100644
--- a/src/Type1/lines.c
+++ b/src/Type1/lines.c
@@ -70,37 +70,6 @@ None.
*/
/*
-:h2.StepLine() - Produces Run Ends for a Line After Checks
-
-The main work is done by Bresenham(); here we just perform checks and
-get the line so that its Y direction is always increasing:
-*/
-
-void StepLine(R, x1, y1, x2, y2)
- register struct region *R; /* region being built */
- register fractpel x1,y1; /* starting point */
- register fractpel x2,y2; /* ending point */
-{
- register fractpel dy;
-
- dy = y2 - y1;
-
-/*
-We execute the "GOING_TO" macro to call back the REGIONS module, if
-necessary (like if the Y direction of the edge has changed):
-*/
- GOING_TO(R, x1, y1, x2, y2, dy);
-
- if (dy == 0)
- return;
-
- if (dy < 0)
- Bresenham(R->edge, x2, y2, x1, y1);
- else
- Bresenham(R->edge, x1, y1, x2, y2);
- return;
-}
-/*
:h3.Bresenham() - Actually Produces Run Ends
This routine runs a Bresenham line-stepping
@@ -124,10 +93,8 @@ TruncFP() truncates down by 'b' bits:
#define TruncFP(xy,b) ((xy)>>(b))
-void Bresenham(edgeP,x1,y1,x2,y2)
- register pel *edgeP; /* pointer to top of list (y == 0) */
- register fractpel x1,y1; /* starting point on line */
- register fractpel x2,y2; /* ending point on the line (down) */
+static void
+Bresenham(pel *edgeP, fractpel x1, fractpel y1, fractpel x2, fractpel y2)
{
register long dx,dy; /* change in x and y, in my own precision */
register long x,y; /* integer pel starting point */
@@ -187,3 +154,35 @@ Find the starting x and y integer pel coordinates:
}
}
}
+
+/*
+:h2.StepLine() - Produces Run Ends for a Line After Checks
+
+The main work is done by Bresenham(); here we just perform checks and
+get the line so that its Y direction is always increasing:
+*/
+
+void StepLine(R, x1, y1, x2, y2)
+ register struct region *R; /* region being built */
+ register fractpel x1,y1; /* starting point */
+ register fractpel x2,y2; /* ending point */
+{
+ register fractpel dy;
+
+ dy = y2 - y1;
+
+/*
+We execute the "GOING_TO" macro to call back the REGIONS module, if
+necessary (like if the Y direction of the edge has changed):
+*/
+ GOING_TO(R, x1, y1, x2, y2, dy);
+
+ if (dy == 0)
+ return;
+
+ if (dy < 0)
+ Bresenham(R->edge, x2, y2, x1, y1);
+ else
+ Bresenham(R->edge, x1, y1, x2, y2);
+ return;
+}
diff --git a/src/Type1/lines.h b/src/Type1/lines.h
index f8ffd3a..4efe5a6 100644
--- a/src/Type1/lines.h
+++ b/src/Type1/lines.h
@@ -31,9 +31,7 @@
/*SHARED*/
#define StepLine(R,x1,y1,x2,y2) t1_StepLine(R,x1,y1,x2,y2)
-#define Bresenham(e,x1,y1,x2,y2) t1_Bresenham(e,x1,y1,x2,y2)
extern void t1_StepLine ( struct region *R, fractpel x1, fractpel y1, fractpel x2, fractpel y2 );
-extern void t1_Bresenham ( pel *edgeP, fractpel x1, fractpel y1, fractpel x2, fractpel y2 );
/*END SHARED*/
diff --git a/src/Type1/objects.c b/src/Type1/objects.c
index c86587d..7a49bcb 100644
--- a/src/Type1/objects.c
+++ b/src/Type1/objects.c
@@ -86,7 +86,8 @@ a macro for "strcpy" that diverts it to "my_strcpy".
#include "strokes.h"
#include "cluts.h"
-
+static char LineIOTrace INITIALIZED(TRUE);
+static char MustCrash INITIALIZED(TRUE);
static char *TypeFmt(int type);
/*
@@ -366,6 +367,59 @@ Free(pointer objPtr)
xiFree((long *)obj);
}
+
+/*
+:h3.Copy() - Make a New Copy of an Object
+
+This is the generic Copy() where the object type is unknown. There
+are specific Copyxxx functions for known object types.
+
+Copy will create a NEW temporary object, and WILL NOT simply bump the
+reference count.
+
+Sometimes duplicating an object is just as simple as Allocating with it
+as a template. But other objects are complicated linked lists. So, we
+let each module provide us a routine (or macro) that duplicates the
+objects it knows about.
+*/
+
+static struct xobject *
+t1_Copy(pointer objPtr)
+{
+ register struct xobject *obj
+ = (struct xobject *)objPtr; /* object to be Copy'ed */
+ if (obj == NULL)
+ return(NULL);
+
+ if (ISPATHTYPE(obj->type))
+ obj = (struct xobject *) CopyPath((struct segment *)obj);
+ else
+ switch (obj->type) {
+ case SPACETYPE:
+ obj = (struct xobject *)
+ CopySpace((struct XYspace *)obj);
+ break;
+ case FONTTYPE:
+ obj = (struct xobject *) CopyFont(obj); break;
+ case REGIONTYPE:
+ obj = (struct xobject *)
+ CopyRegion((struct region *)obj);
+ break;
+ case PICTURETYPE:
+ obj = (struct xobject *) CopyPicture(obj); break;
+ case LINESTYLETYPE:
+ obj = (struct xobject *) CopyLineStyle(obj); break;
+ case STROKEPATHTYPE:
+ obj = (struct xobject *) CopyStrokePath(obj); break;
+ case CLUTTYPE:
+ obj = (struct xobject *) CopyCLUT(obj); break;
+ default:
+ return(ArgErr("Copy: invalid object", obj, NULL));
+ }
+
+ return(obj);
+}
+
/*
:h3.Permanent() - Makes an Object Permanent
@@ -513,58 +567,6 @@ t1_Dup(pointer objPtr)
}
/*
-:h3.Copy() - Make a New Copy of an Object
-
-This is the generic Copy() where the object type is unknown. There
-are specific Copyxxx functions for known object types.
-
-Copy will create a NEW temporary object, and WILL NOT simply bump the
-reference count.
-
-Sometimes duplicating an object is just as simple as Allocating with it
-as a template. But other objects are complicated linked lists. So, we
-let each module provide us a routine (or macro) that duplicates the
-objects it knows about.
-*/
-
-struct xobject *
-t1_Copy(pointer objPtr)
-{
- register struct xobject *obj
- = (struct xobject *)objPtr; /* object to be Copy'ed */
- if (obj == NULL)
- return(NULL);
-
- if (ISPATHTYPE(obj->type))
- obj = (struct xobject *) CopyPath((struct segment *)obj);
- else
- switch (obj->type) {
- case SPACETYPE:
- obj = (struct xobject *)
- CopySpace((struct XYspace *)obj);
- break;
- case FONTTYPE:
- obj = (struct xobject *) CopyFont(obj); break;
- case REGIONTYPE:
- obj = (struct xobject *)
- CopyRegion((struct region *)obj);
- break;
- case PICTURETYPE:
- obj = (struct xobject *) CopyPicture(obj); break;
- case LINESTYLETYPE:
- obj = (struct xobject *) CopyLineStyle(obj); break;
- case STROKEPATHTYPE:
- obj = (struct xobject *) CopyStrokePath(obj); break;
- case CLUTTYPE:
- obj = (struct xobject *) CopyCLUT(obj); break;
- default:
- return(ArgErr("Copy: invalid object", obj, NULL));
- }
-
- return(obj);
-}
-
-/*
:h3.Destroy() - Destroys an Object
This can get complicated. Just like with Copy(), we let the experts
@@ -769,128 +771,6 @@ have to handle that with #defines too.
static char *ErrorMessage = NULL;
/*
-:h3.Pragmatics() - Set/Reset Debug Flags
-
-We provide a controlled way for the TYPE1IMAGER user to set and reset
-our debugging and tracing:
-*/
-void
-Pragmatics(char *username, /* name of the flag */
- int value) /* value to set it to */
-{
- register char *p; /* temporary loop variable */
-#define NAMESIZE 40
- char name[NAMESIZE]; /* buffer to store my copy of 'username' */
-
- if (strlen(username) >= (unsigned)NAMESIZE)
- Abort("Pragmatics name too large");
- strcpy(name, username);
- for (p = name; *p != '\0'; p++)
- *p = toupper(*p);
-
- if (!strcmp(name, "ALL"))
- MustTraceCalls = InternalTrace = /* MustCrash = */
- LineIOTrace = value;
-
- else if (!strcmp(name, "LINEIOTRACE"))
- LineIOTrace = value;
-
- else if (!strcmp(name, "TRACECALLS"))
- MustTraceCalls = value;
-
- else if (!strcmp(name, "CHECKARGS"))
- MustCheckArgs = value;
-
- else if (!strcmp(name, "PROCESSHINTS"))
- ProcessHints = value;
-
- else if (!strcmp(name, "SAVEFONTPATHS"))
- SaveFontPaths = value;
-
- else if (!strcmp(name, "CRASTERCOMPRESSIONTYPE"))
- CRASTERCompressionType = value;
-
- else if (!strcmp(name, "CRASHONUSERERROR"))
- MustCrash = value;
-
- else if (!strcmp(name, "DEBUG"))
- StrokeDebug = SpaceDebug = PathDebug = ConicDebug = LineDebug =
- RegionDebug = MemoryDebug = FontDebug =
- HintDebug = ImageDebug = OffPageDebug = value;
-
- else if (!strcmp(name, "CONICDEBUG"))
- ConicDebug = value;
-
- else if (!strcmp(name, "LINEDEBUG"))
- LineDebug = value;
-
- else if (!strcmp(name, "REGIONDEBUG"))
- RegionDebug = value;
-
- else if (!strcmp(name, "PATHDEBUG"))
- PathDebug = value;
-
- else if (!strcmp(name, "SPACEDEBUG"))
- SpaceDebug = value;
-
- else if (!strcmp(name, "STROKEDEBUG"))
- StrokeDebug = value;
-
- else if (!strcmp(name, "MEMORYDEBUG"))
- MemoryDebug = value;
-
- else if (!strcmp(name, "FONTDEBUG"))
- FontDebug = value;
-
- else if (!strcmp(name, "HINTDEBUG"))
- HintDebug = value;
-
- else if (!strcmp(name, "IMAGEDEBUG"))
- ImageDebug = value;
-
- else if (!strcmp(name, "OFFPAGEDEBUG"))
- OffPageDebug = value;
-
-#ifdef MC68000
-/*
-The following pragmatics flag turns on or off instruction histograming
-for performance analysis. It is only defined in the Delta card
-environment.
-*/
- else if (!strcmp(name, "PROFILE")) {
- if (value)
- StartProfile();
- else
- StopProfile();
- }
-#endif
- else if (!strcmp(name, "FLUSHCACHE")) {
-#ifdef notdef
- while (GimeSpace()) { ; }
-#endif
- }
-
- else if (!strcmp(name, "CACHEDCHARS"))
- CachedChars = (value <= 0) ? 1 : value;
-
- else if (!strcmp(name, "CACHEDFONTS"))
- CachedFonts = (value <= 0) ? 1 : value;
-
- else if (!strcmp(name, "CACHEBLIMIT"))
- CacheBLimit = value;
-
- else if (!strcmp(name, "CONTINUITY"))
- Continuity = value;
-
-
- else {
- printf("Pragmatics flag = '%s'\n", name);
- ArgErr("Pragmatics: flag not known", NULL, NULL);
- }
- return;
-}
-
-/*
:h3.Consume() - Consume a List of Arguments
This general purpose routine is provided in the case where the object
@@ -1033,22 +913,6 @@ Defined in objects.h to be FatalError(), the server's abort routine.
*/
/*
-:h3.REAL Miscellaneous Stuff
-
-:h4.ErrorMsg() - Return the User an Error Message
-*/
-
-char *
-ErrorMsg(void)
-{
- register char *r;
-
- r = ErrorMessage;
- ErrorMessage = NULL;
- return(r);
-}
-
-/*
:h4.InitImager() - Initialize TYPE1IMAGER
We check that a short is 16 bits and a long 32 bits; we have made
@@ -1078,24 +942,3 @@ In some environments, constants and/or exception handling need to be
*/
LibInit();
}
-/*
-:h4.TermImager() - Terminate TYPE1IMAGER
-
-This only makes sense in a server environment; true TYPE1IMAGER needs do
-nothing.
-*/
-void
-TermImager(void)
-{
- return;
-}
-#ifdef notused
-/*
-:h4.reportusage() - A Stub to Get a Clean Link with Portable PMP
-*/
-void
-reportusage(void)
-{
- return;
-}
-#endif
diff --git a/src/Type1/objects.h b/src/Type1/objects.h
index 7289a17..ea48148 100644
--- a/src/Type1/objects.h
+++ b/src/Type1/objects.h
@@ -65,12 +65,6 @@ extern struct xobject *t1_Dup ( pointer obj );
extern void t1_InitImager ( void ); /* initialize TYPE1IMAGER */
-extern void t1_TermImager ( void ); /* terminate TYPE1IMAGER */
-/* set debug flags, etc. */
-extern void t1_Pragmatics ( char *username, int value );
-
-/* return last TYPE1IMAGER error message */
-extern char *t1_ErrorMsg ( void );
/*END SHARED*/
/*SHARED*/
@@ -119,10 +113,6 @@ extern struct xobject *t1_TypeErr ( char *name, pointer obj,
/* consume a variable number of arguments */
extern void t1_Consume ( int n, ... );
-
-/* make a new copy, not reference bump PNM */
-extern struct xobject *t1_Copy ( pointer obj );
-
/*END SHARED*/
/*SHARED*/
@@ -281,33 +271,10 @@ struct xobject {
#endif
-extern char MustCheckArgs INITIALIZED(TRUE);
-extern char MustTraceCalls INITIALIZED(FALSE);
-extern char MustCrash INITIALIZED(TRUE);
-extern char InternalTrace INITIALIZED(TRUE);
-extern char LineIOTrace INITIALIZED(TRUE);
-
extern char ProcessHints INITIALIZED(TRUE);
-extern char SaveFontPaths INITIALIZED(TRUE);
-
-extern short CRASTERCompressionType INITIALIZED(1);
-
-extern char ConicDebug INITIALIZED(0);
-extern char LineDebug INITIALIZED(0);
extern char RegionDebug INITIALIZED(0);
-extern char PathDebug INITIALIZED(0);
-extern char FontDebug INITIALIZED(0);
-extern char SpaceDebug INITIALIZED(0);
-extern char StrokeDebug INITIALIZED(0);
-extern char MemoryDebug INITIALIZED(0);
-extern char HintDebug INITIALIZED(0);
-extern char ImageDebug INITIALIZED(0);
-extern char OffPageDebug INITIALIZED(0);
-
-extern short CachedChars INITIALIZED(0x7FFF);
-extern short CachedFonts INITIALIZED(0x7FFF);
-extern int CacheBLimit INITIALIZED(12500);
+
extern char Continuity INITIALIZED(2);
#ifdef extern
@@ -318,13 +285,9 @@ extern char Continuity INITIALIZED(2);
We define other routines formatting parameters
*/
#define DumpArea(area) t1_DumpArea(area)
-#define DumpText(text) t1_DumpText(text)
#define DumpPath(path) t1_DumpPath(path)
#define DumpSpace(space) t1_DumpSpace(space)
#define DumpEdges(e) t1_DumpEdges(e)
#define FormatFP(s,p) t1_FormatFP(s,p)
-/* dump a textpath structure */
-extern void t1_DumpText(void);
-
/*END SHARED*/
diff --git a/src/Type1/paths.c b/src/Type1/paths.c
index 4fbb1b4..b8b1364 100644
--- a/src/Type1/paths.c
+++ b/src/Type1/paths.c
@@ -246,28 +246,6 @@ ILoc(struct XYspace *S, /* coordinate space to interpret X,Y */
}
/*
-:h3.SubLoc() - Vector Subtraction of Two Locition Objects
-
-This user operator subtracts two location objects, yielding a new
-location object that is the result.
-
-The symmetrical function AddLoc() is totally redundent with Join(),
-so it is not provided.
-*/
-
-struct segment *
-SubLoc(struct segment *p1, struct segment *p2)
-{
- ARGCHECK(!ISLOCATION(p1), "SubLoc: bad first arg", p1, NULL, (0), struct segment *);
- ARGCHECK(!ISLOCATION(p2), "SubLoc: bad second arg", p2, NULL, (0), struct segment *);
- p1 = UniquePath(p1);
- p1->dest.x -= p2->dest.x;
- p1->dest.y -= p2->dest.y;
- ConsumePath(p2);
- return(p1);
-}
-
-/*
:h2.Straight Line Segments
:h3.PathSegment() - Create a Generic Path Segment
@@ -361,56 +339,6 @@ Bezier(struct segment *B, /* second control point */
return(r);
}
-/*
-:h2.Font "Hint" Segments
-
-:h3.Hint() - A Font 'Hint' Segment
-
-This is temporary code while we experiment with hints.
-*/
-
-/*SHARED LINE(S) ORIGINATED HERE*/
-struct hintsegment *
-Hint(struct XYspace *S, float ref, float width,
- char orientation, char hinttype, char adjusttype, char direction,
- int label)
-{
-/* added reference field of 1 to hintsegment template below 3-26-91 PNM */
- static struct hintsegment template = { HINTTYPE, 0, 1, sizeof(struct hintsegment), 0,
- NULL, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 },
- ' ', ' ', ' ', ' ', 0};
-
- register struct hintsegment *r;
-
- r = (struct hintsegment *)Allocate(sizeof(struct hintsegment), &template, 0);
-
- r->orientation = orientation;
- if (width == 0.0) width = 1.0;
-
- if (orientation == 'h') {
- (*S->convert)(&r->ref, S, 0.0, ref);
- (*S->convert)(&r->width, S, 0.0, width);
- }
- else if (orientation == 'v') {
- (*S->convert)(&r->ref, S, ref, 0.0);
- (*S->convert)(&r->width, S, width, 0.0);
- }
- else
- return((struct hintsegment *)ArgErr("Hint: orient not 'h' or 'v'", NULL, NULL));
- if (r->width.x < 0) r->width.x = - r->width.x;
- if (r->width.y < 0) r->width.y = - r->width.y;
- r->hinttype = hinttype;
- r->adjusttype = adjusttype;
- r->direction = direction;
- r->label = label;
- r->last = (struct segment *) r;
- ConsumeSpace(S);
- return(r);
-}
-
-/*
-*/
-
/*SHARED LINE(S) ORIGINATED HERE*/
/*
@@ -665,256 +593,6 @@ At each break, we insert a close segment.
}
return(p0);
}
-/*
-*/
-/*
-:h2.Reversing the Direction of a Path
-
-This turned out to be more difficult than I thought at first. The
-trickiness was due to the fact that closed paths must remain closed,
-etc.
-
-We need three subroutines:
-*/
-
-/* break a path at any point */
-static struct segment *SplitPath ( struct segment *anchor,
- struct segment *before );
-/* breaks a path after first sub-path */
-static struct segment *DropSubPath ( struct segment *p0 );
-/* reverses a single sub-path */
-static struct segment *ReverseSubPath ( struct segment *p );
-
-/*
-:h3.Reverse() - User Operator to Reverse a Path
-
-This operator reverses the entire path.
-*/
-
-struct segment *
-Reverse(struct segment *p) /* full path to reverse */
-{
- register struct segment *r; /* output path built here */
- register struct segment *nextp; /* contains next sub-path */
-
- if (p == NULL)
- return(NULL);
-
- ARGCHECK(!ISPATHANCHOR(p), "Reverse: invalid path", p, NULL, (0), struct segment *);
-
- if (p->type == TEXTTYPE)
- p = CoerceText(p);
- p = UniquePath(p);
-
- r = NULL;
-
- do {
- nextp = DropSubPath(p);
- p = ReverseSubPath(p);
- r = Join(p, r);
- p = nextp;
-
- } while (p != NULL);
-
- return(r);
-}
-
-/*
-:h4.ReverseSubPath() - Subroutine to Reverse a Single Sub-Path
-*/
-
-static struct segment *
-ReverseSubPath(struct segment *p) /* input path */
-{
- register struct segment *r; /* reversed path will be created here */
- register struct segment *nextp; /* temporary variable used in loop */
- register int wasclosed; /* flag, path was closed */
-
- if (p == NULL)
- return(NULL);
-
- wasclosed = ISCLOSED(p->flag);
- r = NULL;
-
- do {
-/*
-First we reverse the direction of this segment and clean up its flags:
-*/
- p->dest.x = - p->dest.x; p->dest.y = - p->dest.y;
- p->flag &= ~(ISCLOSED(ON) | LASTCLOSED(ON));
-
- switch (p->type) {
-
- case LINETYPE:
- case MOVETYPE:
- break;
-
- case CONICTYPE:
- {
-/*
-The logic of this is that the new M point (stored relative to the new
-beginning) is (M - C). However, C ("dest") has already been reversed
-So, we add "dest" instead of subtracting it:
-*/
- register struct conicsegment *cp = (struct conicsegment *) p;
-
- cp->M.x += cp->dest.x; cp->M.y += cp->dest.y;
- }
- break;
-
- case BEZIERTYPE:
- {
- register struct beziersegment *bp = (struct beziersegment *) p;
-
- bp->B.x += bp->dest.x; bp->B.y += bp->dest.y;
- bp->C.x += bp->dest.x; bp->C.y += bp->dest.y;
- }
- break;
-
- case HINTTYPE:
- {
- register struct hintsegment *hp = (struct hintsegment *) p;
-
- hp->ref.x = -hp->ref.x; hp->ref.y = -hp->ref.y;
- }
- break;
-
- default:
- Abort("Reverse: bad path segment");
- }
-/*
-We need to reverse the order of segments too, so we break this segment
-off of the input path, and tack it on the front of the growing path
-in 'r':
-*/
- nextp = p->link;
- p->link = NULL;
- p->last = p;
- if (r != NULL)
- CONCAT(p,r); /* leaves result in 'p'... not what we want */
- r = p;
- p = nextp; /* advance to next segment in input path */
-
- } while (p != NULL);
-
- if (wasclosed)
- r = ClosePath(r);
-
- return(r);
-}
-
-/*
-:h4.DropSubPath() - Drops the First Sub-Path Off a Path
-
-This subroutine returns the remaining sub-path(s). While doing so, it
-breaks the input path after the first sub-path so that a pointer to
-the original path now contains the first sub-path only.
-*/
-
-static struct segment *
-DropSubPath(struct segment *p0) /* original path */
-{
- register struct segment *p; /* returned remainder here */
-
- for (p = p0; p->link != NULL; p = p->link) {
- if (p->link->type == MOVETYPE)
- break;
- }
-
- return(SplitPath(p0, p));
-}
-
-static struct segment *
-SplitPath(struct segment *anchor, struct segment *before)
-{
- register struct segment *r;
-
- if (before == anchor->last)
- return(NULL);
-
- r = before->link;
- r->last = anchor->last;
- anchor->last = before;
- before->link = NULL;
-
- return(r);
-}
-
-static void
-UnClose(struct segment *p0)
-{
- register struct segment *p;
-
- for (p=p0; p->link->link != NULL; p=p->link) { ; }
-
- if (!LASTCLOSED(p->link->flag))
- Abort("UnClose: no LASTCLOSED");
-
- Free(SplitPath(p0, p));
- p0->flag &= ~ISCLOSED(ON);
-}
-
-/*
-:h3.ReverseSubPaths() - Reverse the Direction of Sub-paths Within a Path
-
-This user operator reverses the sub-paths in a path, but leaves the
-'move' segments unchanged. It builds on top of the subroutines
-already established.
-*/
-
-struct segment *
-ReverseSubPaths(struct segment *p) /* input path */
-{
- register struct segment *r; /* reversed path will be created here */
- register struct segment *nextp; /* temporary variable used in loop */
- int wasclosed; /* flag; subpath was closed */
- register struct segment *nomove; /* the part of sub-path without move segment */
- struct fractpoint delta;
-
- if (p == NULL)
- return(NULL);
-
- ARGCHECK(!ISPATHANCHOR(p), "ReverseSubPaths: invalid path", p, NULL, (0), struct segment *);
-
- if (p->type == TEXTTYPE)
- p = CoerceText(p);
- if (p->type != MOVETYPE)
- p = JoinSegment(NULL, MOVETYPE, 0, 0, p);
-
- p = UniquePath(p);
-
- r = NULL;
-
- for (; p != NULL;) {
- nextp = DropSubPath(p);
- wasclosed = ISCLOSED(p->flag);
- if (wasclosed)
- UnClose(p);
-
- nomove = SplitPath(p, p);
- r = Join(r, p);
-
- PathDelta(nomove, &delta);
-
- nomove = ReverseSubPath(nomove);
- p->dest.x += delta.x;
- p->dest.y += delta.y;
- if (nextp != NULL) {
- nextp->dest.x += delta.x;
- nextp->dest.y += delta.y;
- }
- if (wasclosed) {
- nomove = ClosePath(nomove);
- nextp->dest.x -= delta.x;
- nextp->dest.y -= delta.y;
- }
- r = Join(r, nomove);
- p = nextp;
-
- }
-
- return(r);
-}
/*
:h2.Transforming and Putting Handles on Paths
@@ -1048,26 +726,6 @@ PathDelta(struct segment *p, /* input path */
}
/*
-:h3.BoundingBox() - Produce a Bounding Box Path
-
-This function is called by image code, when we know the size of the
-image in pels, and need to get a bounding box path that surrounds it.
-The starting/ending handle is in the lower right hand corner.
-*/
-struct segment *
-BoundingBox(pel h, pel w) /* size of box */
-{
- register struct segment *path;
-
- path = PathSegment(LINETYPE, -TOFRACTPEL(w), 0);
- path = JoinSegment(NULL, LINETYPE, 0, -TOFRACTPEL(h), path);
- path = JoinSegment(NULL, LINETYPE, TOFRACTPEL(w), 0, path);
- path = ClosePath(path);
-
- return(path);
-}
-
-/*
:h2.Querying Locations and Paths
:h3.QueryLoc() - Return the X,Y of a Locition
@@ -1088,321 +746,3 @@ QueryLoc(struct segment *P, /* location to query, not consumed */
}
UnConvert(S, &P->dest, xP, yP);
}
-/*
-:h3.QueryPath() - Find Out the Type of Segment at the Head of a Path
-
-This is a very simple routine that looks at the first segment of a
-path and tells the caller what it is, as well as returning the control
-point(s) of the path segment. Different path segments have different
-number of control points. If the caller knows that the segment is
-a move segment, for example, he only needs to pass pointers to return
-one control point.
-*/
-
-void
-QueryPath(struct segment *path, /* path to check */
- int *typeP, /* return the type of path here */
- struct segment **Bp, /* return location of first point */
- struct segment **Cp, /* return location of second point */
- struct segment **Dp, /* return location of third point */
- double *fP) /* return Conic sharpness */
-{
- register int coerced = FALSE; /* did I coerce a text path? */
-
- if (path == NULL) {
- *typeP = -1;
- return;
- }
- if (!ISPATHANCHOR(path)) {
- ArgErr("QueryPath: arg not a valid path", path, NULL);
- }
- if (path->type == TEXTTYPE) {
- path = CoerceText(path);
- coerced = TRUE;
- }
-
- switch (path->type) {
-
- case MOVETYPE:
- *typeP = 0;
- *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y);
- break;
-
- case LINETYPE:
- *typeP = (LASTCLOSED(path->flag)) ? 4 : 1;
- *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y);
- break;
-
- case CONICTYPE:
- {
- register struct conicsegment *cp = (struct conicsegment *) path;
-
- *typeP = 2;
- *Bp = PathSegment(MOVETYPE, cp->M.x, cp->M.y);
- *Cp = PathSegment(MOVETYPE, cp->dest.x, cp->dest.y);
- *fP = cp->roundness;
- }
- break;
-
- case BEZIERTYPE:
- {
- register struct beziersegment *bp = (struct beziersegment *) path;
-
- *typeP = 3;
- *Bp = PathSegment(MOVETYPE, bp->B.x, bp->B.y);
- *Cp = PathSegment(MOVETYPE, bp->C.x, bp->C.y);
- *Dp = PathSegment(MOVETYPE, bp->dest.x, bp->dest.y);
- }
- break;
-
- case HINTTYPE:
- *typeP = 5;
- break;
-
- default:
- Abort("QueryPath: unknown segment");
- }
- if (coerced)
- KillPath(path);
-}
-/*
-:h3.QueryBounds() - Return the Bounding Box of a Path
-
-Returns the bounding box by setting the user's variables.
-*/
-
-void
-QueryBounds(struct segment *p0, /* object to check for bound */
- struct XYspace *S, /* coordinate space of returned values */
- double *xminP, /* lower left hand corner (set by routine) */
- double *yminP,
- double *xmaxP, /* upper right hand corner (set by routine) */
- double *ymaxP)
-{
- register struct segment *path; /* loop variable for path segments */
- register fractpel lastx,lasty; /* loop variables: previous endingpoint */
- register fractpel x,y; /* loop variables: current ending point */
- struct fractpoint min; /* registers to keep lower left hand corner */
- struct fractpoint max; /* registers to keep upper right hand corner */
- int coerced = FALSE; /* we have coerced the path from another object */
- double x1,y1,x2,y2,x3,y3,x4,y4; /* corners of rectangle in space X */
-
- if (S->type != SPACETYPE) {
- ArgErr("QueryBounds: bad XYspace", S, NULL);
- return;
- }
-
- min.x = min.y = max.x = max.y = 0;
- if (p0 != NULL) {
- if (!ISPATHANCHOR(p0)) {
- switch(p0->type) {
- case STROKEPATHTYPE:
- /* replaced DupStrokePath() with Dup() 3-26-91 PNM */
- p0 = (struct segment *) DoStroke(Dup(p0));
- /* no break here, we have a region in p0 */
- case REGIONTYPE:
- p0 = RegionBounds((struct region *)p0);
- break;
-
- case PICTURETYPE:
- p0 = PictureBounds(p0);
- break;
-
- default:
- ArgErr("QueryBounds: bad object", p0, NULL);
- return;
- }
- coerced = TRUE;
- }
- if (p0->type == TEXTTYPE) {
- /* replaced CopyPath() with Dup() 3-26-91 PNM */
- p0 = (struct segment *)CoerceText(Dup(p0)); /* there are faster ways */
- coerced = TRUE;
- }
- if (p0->type == MOVETYPE) {
- min.x = max.x = p0->dest.x;
- min.y = max.y = p0->dest.y;
- }
- }
- lastx = lasty = 0;
-
- for (path = p0; path != NULL; path = path->link) {
-
- x = lastx + path->dest.x;
- y = lasty + path->dest.y;
-
- switch (path->type) {
-
- case LINETYPE:
- break;
-
- case CONICTYPE:
- {
- register struct conicsegment *cp = (struct conicsegment *) path;
- register fractpel Mx = lastx + cp->M.x;
- register fractpel My = lasty + cp->M.y;
- register fractpel deltax = 0.5 * cp->roundness * cp->dest.x;
- register fractpel deltay = 0.5 * cp->roundness * cp->dest.y;
- register fractpel Px = Mx - deltax;
- register fractpel Py = My - deltay;
- register fractpel Qx = Mx + deltax;
- register fractpel Qy = My + deltay;
-
-
- if (Mx < min.x) min.x = Mx;
- else if (Mx > max.x) max.x = Mx;
- if (My < min.y) min.y = My;
- else if (My > max.y) max.y = My;
-
- if (Px < min.x) min.x = Px;
- else if (Px > max.x) max.x = Px;
- if (Py < min.y) min.y = Py;
- else if (Py > max.y) max.y = Py;
-
- if (Qx < min.x) min.x = Qx;
- else if (Qx > max.x) max.x = Qx;
- if (Qy < min.y) min.y = Qy;
- else if (Qy > max.y) max.y = Qy;
- }
- break;
-
-
- case MOVETYPE:
- /*
- * We can't risk adding trailing Moves to the
- * bounding box:
- */
- if (path->link == NULL)
- goto done; /* God forgive me */
- break;
-
- case BEZIERTYPE:
- {
- register struct beziersegment *bp = (struct beziersegment *) path;
- register fractpel Bx = lastx + bp->B.x;
- register fractpel By = lasty + bp->B.y;
- register fractpel Cx = lastx + bp->C.x;
- register fractpel Cy = lasty + bp->C.y;
-
- if (Bx < min.x) min.x = Bx;
- else if (Bx > max.x) max.x = Bx;
- if (By < min.y) min.y = By;
- else if (By > max.y) max.y = By;
-
- if (Cx < min.x) min.x = Cx;
- else if (Cx > max.x) max.x = Cx;
- if (Cy < min.y) min.y = Cy;
- else if (Cy > max.y) max.y = Cy;
- }
- break;
-
- case HINTTYPE:
- break;
- default:
- Abort("QueryBounds: unknown type");
- }
-
- if (x < min.x) min.x = x;
- else if (x > max.x) max.x = x;
- if (y < min.y) min.y = y;
- else if (y > max.y) max.y = y;
-
- lastx = x; lasty = y;
- }
-done:
- UnConvert(S, &min, &x1, &y1);
- UnConvert(S, &max, &x4, &y4);
- x = min.x; min.x = max.x; max.x = x;
- UnConvert(S, &min, &x2, &y2);
- UnConvert(S, &max, &x3, &y3);
-
- *xminP = *xmaxP = x1;
- if (x2 < *xminP) *xminP = x2;
- else if (x2 > *xmaxP) *xmaxP = x2;
- if (x3 < *xminP) *xminP = x3;
- else if (x3 > *xmaxP) *xmaxP = x3;
- if (x4 < *xminP) *xminP = x4;
- else if (x4 > *xmaxP) *xmaxP = x4;
-
- *yminP = *ymaxP = y1;
- if (y2 < *yminP) *yminP = y2;
- else if (y2 > *ymaxP) *ymaxP = y2;
- if (y3 < *yminP) *yminP = y3;
- else if (y3 > *ymaxP) *ymaxP = y3;
- if (y4 < *yminP) *yminP = y4;
- else if (y4 > *ymaxP) *ymaxP = y4;
-
- if (coerced)
- Destroy(p0);
-}
-/*
-:h3.BoxPath()
-*/
-struct segment *
-BoxPath(struct XYspace *S, int h, int w)
-{
- struct segment *path;
-
- path = Join( Line(ILoc(S, w, 0)), Line(ILoc(S, 0, h)) );
- path = JoinSegment(path, LINETYPE, -path->dest.x, -path->dest.y, NULL);
- return(ClosePath(path));
-}
-
-/*
-:h3.DropSegment() - Drop the First Segment in a Path
-
-This routine takes the path and returns a new path that is one segment
-shorter. It can be used in conjunction with QueryPath(), for example,
-to ask about an entire path.
-*/
-
-struct segment *
-DropSegment(struct segment *path)
-{
- if (path != NULL && path->type == STROKEPATHTYPE)
- path = CoercePath(path);
- ARGCHECK((path == NULL || !ISPATHANCHOR(path)),
- "DropSegment: arg not a non-null path", path, path, (0), struct segment *);
- if (path->type == TEXTTYPE)
- path = CoerceText(path);
- path = UniquePath(path);
-
- POP(path);
- return(path);
-}
-/*
-:h3.HeadSegment() - Return the First Segment in a Path
-
-This routine takes the path and returns a new path consists of the
-first segment only.
-*/
-
-struct segment *
-HeadSegment(struct segment *path) /* input path */
-{
- if (path == NULL)
- return(NULL);
- if (path->type == STROKEPATHTYPE)
- path = CoercePath(path);
- ARGCHECK(!ISPATHANCHOR(path), "HeadSegment: arg not a path", path, path, (0), struct segment *);
- if (path->type == TEXTTYPE)
- path = CoerceText(path);
- path = UniquePath(path);
-
- if (path->link != NULL)
- KillPath(path->link);
- path->link = NULL;
- path->last = path;
- return(path);
-}
-
-/*
-:h2.Path Debug Routines
-
-:h3.DumpPath() - Display a Path on the Trace File
-*/
-
-void
-DumpPath(struct segment *p)
-{
-}
diff --git a/src/Type1/paths.h b/src/Type1/paths.h
index b61275b..3803c53 100644
--- a/src/Type1/paths.h
+++ b/src/Type1/paths.h
@@ -73,33 +73,9 @@ struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle */
/* Bezier third order curve path segment */
extern struct beziersegment *t1_Bezier ( struct segment *B, struct segment *C,
struct segment *D );
-/* produce a font 'hint' path segment */
-extern struct hintsegment *t1_Hint ( struct XYspace *S, float ref, float width,
- char orientation, char hinttype,
- char adjusttype, char direction,
- int label );
-/* reverse the complete order of paths */
-extern struct segment *t1_Reverse ( struct segment *p );
-/* reverse only sub-paths; moves unchanged */
-extern struct segment *t1_ReverseSubPaths ( struct segment *p );
-/* subtract two location objects */
-extern struct segment *t1_SubLoc ( struct segment *p1, struct segment *p2 );
-/* Drop the first segment in a path */
-extern struct segment *t1_DropSegment ( struct segment *path );
-/* return the first segment in a path */
-extern struct segment *t1_HeadSegment ( struct segment *path );
/* Query location; return its (x,y) */
extern void t1_QueryLoc ( struct segment *P, struct XYspace *S, double *xP,
double *yP );
-/* Query segment at head of a path */
-extern void t1_QueryPath ( struct segment *path, int *typeP,
- struct segment **Bp, struct segment **Cp,
- struct segment **Dp, double *fP );
-/* Query the bounding box of a path */
-extern void t1_QueryBounds ( struct segment *p0, struct XYspace *S,
- double *xminP, double *yminP,
- double *xmaxP, double *ymaxP );
-
/*END SHARED*/
/*SHARED*/
@@ -111,7 +87,6 @@ extern void t1_QueryBounds ( struct segment *p0, struct XYspace *S,
#define PathSegment(t,x,y) t1_PathSegment(t,(fractpel)x,(fractpel)y)
#define JoinSegment(b,t,x,y,a) t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a)
#define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy)
-#define BoxPath(S,h,w) t1_BoxPath(S,h,w)
/* duplicate a path */
extern struct segment *t1_CopyPath ( struct segment *p0 );
@@ -121,17 +96,10 @@ extern void t1_KillPath ( struct segment *p );
extern struct segment *t1_PathXform ( struct segment *p0, struct XYspace *S );
/* calculate the ending point of a path */
extern void t1_PathDelta ( struct segment *p, struct fractpoint *pt );
-/* */
-extern struct segment *t1_BoundingBox ( pel h, pel w );
/* produce a MOVE or LINE segment */
extern struct segment *t1_PathSegment ( int type, fractpel x, fractpel y );
/* join a MOVE or LINE segment to a path */
extern struct segment *t1_JoinSegment ( struct segment *before, int type, fractpel x, fractpel y, struct segment *after );
-#if 0
-double t1_Hypoteneuse(); /* returns the length of a line */
-#endif
-/* returns a rectangular path */
-extern struct segment *t1_BoxPath ( struct XYspace *S, int h, int w );
/*END SHARED*/
/*SHARED*/
@@ -235,5 +203,3 @@ is also used by the STROKES module.)
p2->last = NULL; } /* only first segment has non-NULL "last" */
/*END SHARED*/
-/* dump a path list */
-extern void t1_DumpPath ( struct segment *p );
diff --git a/src/Type1/regions.c b/src/Type1/regions.c
index f8875da..a086821 100644
--- a/src/Type1/regions.c
+++ b/src/Type1/regions.c
@@ -138,20 +138,6 @@ set. The flag is used to optimize some paths.
*/
/*SHARED LINE(S) ORIGINATED HERE*/
-/*
-:h4."TT_INFINITY" - A Constant Region Structure of Infinite Extent
-
-Infinity is the complement of a null area:
-Note - removed the refcount = 1 init, replaced with references = 2 3-26-91 PNM
-*/
-static struct region _infinity = { REGIONTYPE,
- ISCOMPLEMENT(ON)+ISINFINITE(ON)+ISPERMANENT(ON)+ISIMMORTAL(ON), 2,
- {0, 0}, {0, 0},
- 0, 0, 0, 0,
- NULL, NULL,
- 0, 0, 0, 0, 0, NULL, NULL,
- NULL, 0, NULL, NULL };
-struct region *TT_INFINITY = &_infinity;
/*
:h4."EmptyRegion" - A Region Structure with Zero Area
@@ -162,7 +148,7 @@ Note - replaced refcount = 1 init with references = 2 3-26-91 PNM
*/
/*SHARED LINE(S) ORIGINATED HERE*/
-struct region EmptyRegion = { REGIONTYPE,
+static struct region EmptyRegion = { REGIONTYPE,
ISPERMANENT(ON)+ISIMMORTAL(ON), 2,
{0, 0}, {0, 0},
MAXPEL, MAXPEL, MINPEL, MINPEL,
@@ -753,52 +739,7 @@ chain:
R->lastedge = R->firstedge = NULL;
}
}
-/*
-:h3 id=newfill.newfilledge() - Called When We Have a New Edge While Filling
-
-This is the prototypical "newedge" function passed to "Rasterize" and
-stored in "newedgefcn" in the region being built.
-
-If the edge is non-null, we sort it onto the list of edges we are
-building at "anchor".
-
-This function also has to keep the bounding box of the region
-up to date.
-*/
-
-static void
-newfilledge(struct region *R, /* region being built */
- fractpel xmin, fractpel xmax, /* X range of this edge */
- fractpel ymin, fractpel ymax, /* Y range of this edge */
- int isdown) /* flag: TRUE means edge goes down, else up */
-{
-
- register pel pelxmin,pelymin,pelxmax,pelymax; /* pel versions of bounds */
- register struct edgelist *edge; /* newly created edge */
-
- pelymin = NEARESTPEL(ymin);
- pelymax = NEARESTPEL(ymax);
- if (pelymin == pelymax)
- return;
-
- pelxmin = NEARESTPEL(xmin);
- pelxmax = NEARESTPEL(xmax);
-
- if (pelxmin < R->xmin) R->xmin = pelxmin;
- if (pelxmax > R->xmax) R->xmax = pelxmax;
- if (pelymin < R->ymin) R->ymin = pelymin;
- if (pelymax > R->ymax) R->ymax = pelymax;
-
- edge = NewEdge(pelxmin, pelxmax, pelymin, pelymax, &R->edge[pelymin], isdown);
- edge->subpath = R->lastedge;
- R->lastedge = edge;
- if (R->firstedge == NULL)
- R->firstedge = edge;
-
- R->anchor = SortSwath(R->anchor, edge, swathxsort);
-
-}
-
+
/*
:h2.Sorting Edges
@@ -823,7 +764,7 @@ exactly where the bottom part belongs.
#define TOP(e) ((e)->ymin) /* the top of an edge (for readability */
#define BOTTOM(e) ((e)->ymax) /* the bottom of an edge (for readability */
-struct edgelist *
+static struct edgelist *
SortSwath(struct edgelist *anchor, /* list being built */
struct edgelist *edge, /* incoming edge or pair of edges */
SwathFunc swathfcn) /* horizontal sorter */
@@ -915,6 +856,52 @@ contains all the edges before. Whew! A simple matter now of adding
}
/*
+:h3 id=newfill.newfilledge() - Called When We Have a New Edge While Filling
+
+This is the prototypical "newedge" function passed to "Rasterize" and
+stored in "newedgefcn" in the region being built.
+
+If the edge is non-null, we sort it onto the list of edges we are
+building at "anchor".
+
+This function also has to keep the bounding box of the region
+up to date.
+*/
+
+static void
+newfilledge(struct region *R, /* region being built */
+ fractpel xmin, fractpel xmax, /* X range of this edge */
+ fractpel ymin, fractpel ymax, /* Y range of this edge */
+ int isdown) /* flag: TRUE means edge goes down, else up */
+{
+
+ register pel pelxmin,pelymin,pelxmax,pelymax; /* pel versions of bounds */
+ register struct edgelist *edge; /* newly created edge */
+
+ pelymin = NEARESTPEL(ymin);
+ pelymax = NEARESTPEL(ymax);
+ if (pelymin == pelymax)
+ return;
+
+ pelxmin = NEARESTPEL(xmin);
+ pelxmax = NEARESTPEL(xmax);
+
+ if (pelxmin < R->xmin) R->xmin = pelxmin;
+ if (pelxmax > R->xmax) R->xmax = pelxmax;
+ if (pelymin < R->ymin) R->ymin = pelymin;
+ if (pelymax > R->ymax) R->ymax = pelymax;
+
+ edge = NewEdge(pelxmin, pelxmax, pelymin, pelymax, &R->edge[pelymin], isdown);
+ edge->subpath = R->lastedge;
+ R->lastedge = edge;
+ if (R->firstedge == NULL)
+ R->firstedge = edge;
+
+ R->anchor = SortSwath(R->anchor, edge, swathxsort);
+
+}
+
+/*
:h3.splitedge() - Split an Edge or Swath in Two at a Given Y Value
This function returns the edge or swath beginning at the Y value, and
@@ -1088,7 +1075,7 @@ fun comes in they overlap the existing edges. Then some edges
will disappear.
*/
-struct edgelist *
+static struct edgelist *
SwathUnion(struct edgelist *before0, /* edge before the swath */
struct edgelist *edge) /* list of two edges to be unioned */
{
@@ -1284,28 +1271,6 @@ crosses(int h, pel *left, pel *right)
return(h);
}
/*
-:h3.cedgemin() - Stores the Mininum of an Edge and an X Value
-*/
-
-static void
-cedgemin(int h, pel *e1, pel x)
-{
- for (; --h >= 0; e1++)
- if (*e1 > x)
- *e1 = x;
-}
-/*
-:h3.cedgemax() - Stores the Maximum of an Edge and an X Value
-*/
-
-static void
-cedgemax(int h, pel *e1, pel x)
-{
- for (; --h >= 0; e1++)
- if (*e1 < x)
- *e1 = x;
-}
-/*
:h3.edgemin() - Stores the Mininum of Two Edges in First Edge
*/
@@ -1327,124 +1292,6 @@ edgemax(int h, pel *e1, pel *e2)
if (*e1 < *e2)
*e1 = *e2;
}
-
-/*
-:h2.Changing the Representation of Regions
-
-For convenience and/or performance, we sometimes like to change the way
-regions are represented. This does not change the object itself, just
-the representation, so these transformations can be made on a permanent
-region.
-
-*/
-
-void
-MoveEdges(struct region *R, /* region to modify */
- fractpel dx, fractpel dy) /* delta X and Y to move edge list by */
-{
- register struct edgelist *edge; /* for looping through edges */
-
- R->origin.x += dx;
- R->origin.y += dy;
- R->ending.x += dx;
- R->ending.y += dy;
- if (R->thresholded != NULL) {
- R->thresholded->origin.x -= dx;
- R->thresholded->origin.y -= dy;
- }
-/*
-From now on we will deal with dx and dy as integer pel values:
-*/
- dx = NEARESTPEL(dx);
- dy = NEARESTPEL(dy);
- if (dx == 0 && dy == 0)
- return;
-
- R->xmin += dx;
- R->xmax += dx;
- R->ymin += dy;
- R->ymax += dy;
-
- for (edge = R->anchor; VALIDEDGE(edge); edge = edge->link) {
- edge->ymin += dy;
- edge->ymax += dy;
- if (dx != 0) {
- register int h; /* loop index; height of edge */
- register pel *Xp; /* loop pointer to X values */
-
- edge->xmin += dx;
- edge->xmax += dx;
- for (Xp = edge->xvalues, h = edge->ymax - edge->ymin;
- --h >= 0; )
- *Xp++ += dx;
- }
- }
-}
-
-/*
-:h3.UnJumble() - Sort a Region Top to Bottom
-
-It is an open question whether it pays in general to do this.
-*/
-
-void
-UnJumble(struct region *region) /* region to sort */
-{
- register struct edgelist *anchor; /* new lists built here */
- register struct edgelist *edge; /* edge pointer for loop */
- register struct edgelist *next; /* ditto */
-
- anchor = NULL;
-
- for (edge=region->anchor; VALIDEDGE(edge); edge=next) {
- if (edge->link == NULL)
- Abort("UnJumble: unpaired edge?");
- next = edge->link->link;
- edge->link->link = NULL;
- anchor = SortSwath(anchor, edge, t1_SwathUnion);
- }
-
- if (edge != NULL)
- vertjoin(anchor, edge);
-
- region->anchor = anchor;
- region->flag &= ~ISJUMBLED(ON);
-}
-
-/*
-*/
-#ifdef notused
-static void
-OptimizeRegion(struct region *R) /* region to optimize */
-{
- register pel *xP; /* pel pointer for inner loop */
- register int x; /* holds X value */
- register int xmin,xmax; /* holds X range */
- register int h; /* loop counter */
- register struct edgelist *e; /* edgelist pointer for loop */
-
- R->flag |= ISRECTANGULAR(ON);
-
- for (e = R->anchor; VALIDEDGE(e); e=e->link) {
- xmin = MAXPEL;
- xmax = MINPEL;
- for (h = e->ymax - e->ymin, xP = e->xvalues; --h >= 0;) {
- x = *xP++;
- if (x < xmin) xmin = x;
- if (x > xmax) xmax = x;
- }
- if (xmin != xmax || (xmin != R->xmin && xmax != R->xmax))
- R->flag &= ~ISRECTANGULAR(ON);
- if (xmin < e->xmin || xmax > e->xmax)
- Abort("Tighten: existing edge bound was bad");
- if (xmin < R->xmin || xmax > R->xmax)
- Abort("Tighten: existing region bound was bad");
- e->xmin = xmin;
- e->xmax = xmax;
- }
- R->flag |= ISOPTIMIZED(ON);
-}
-#endif
/*
:h2.Miscelaneous Routines
@@ -1479,173 +1326,3 @@ MoreWorkArea(struct region *R, /* region we are generating */
}
ChangeDirection(CD_CONTINUE, R, x1, y1, y2 - y1);
}
-
-/*
-:h3.BoxClip() - Clip a Region to a Rectangle
-
-BoxClip also duplicates the region if it is permanent. Note the
-clipping box is specified in REGION coordinates, that is, in
-coordinates relative to the region (0,0) point
-*/
-
-struct region *
-BoxClip(struct region *R, /* region to clip */
- pel xmin, pel ymin, /* upper left hand corner of rectangle */
- pel xmax, pel ymax) /* lower right hand corner */
-{
- struct edgelist anchor; /* pretend edgelist to facilitate discards */
- register struct edgelist *e,*laste;
-
- R = UniqueRegion(R);
-
- if (xmin > R->xmin) {
- R->xmin = xmin;
- }
- if (xmax < R->xmax) {
- R->xmax = xmax;
- }
-
- if (ymin > R->ymin) {
- R->ymin = ymin;
- }
- if (ymax < R->ymax) {
- R->ymax = ymax;
- }
-
-
- laste = &anchor;
- anchor.link = R->anchor;
-
- for (e = R->anchor; VALIDEDGE(e); e = e->link) {
- if (TOP(e) < ymin) {
- e->xvalues += ymin - e->ymin;
- e->ymin = ymin;
- }
- if (BOTTOM(e) > ymax)
- e->ymax = ymax;
- if (TOP(e) >= BOTTOM(e)) {
- discard(laste, e->link->link);
- e = laste;
- continue;
- }
- if (e->xmin < xmin) {
- cedgemax(BOTTOM(e) - TOP(e), e->xvalues, xmin);
- e->xmin = xmin;
- e->xmax = MAX(e->xmax, xmin);
- }
- if (e->xmax > xmax) {
- cedgemin(BOTTOM(e) - TOP(e), e->xvalues, xmax);
- e->xmin = MIN(e->xmin, xmax);
- e->xmax = xmax;
- }
- laste = e;
- }
-
- R->anchor = anchor.link;
-
- return(R);
-}
-
-#ifdef notdef
-/*
-:h3.CoerceRegion() - Force a TextPath Structure to Become a Region
-
-We also save the newly created region in the textpath structure, if the
-structure was permanent. Then we don't have to do this again. Why not
-save it all the time? Well, we certainly could, but I suspect it
-wouldn't pay. We would have to make this region permanent (because we
-couldn't have it be consumed) and this would probably require
-unnecessary CopyRegions in most cases.
-*/
-
-struct region *
-CoerceRegion(struct textpath *tp) /* input TEXTTYPE */
-{
- struct segment *path; /* temporary character path */
- struct region *R; /* returned region */
-
-
- R = Interior(path, EVENODDRULE);
- return(R);
-}
-#endif
-
-/*
-:h3.RegionBounds() - Returns Bounding Box of a Region
-*/
-
-struct segment *
-RegionBounds(struct region *R)
-{
- register struct segment *path; /* returned path */
-
- path = BoxPath(IDENTITY, R->ymax - R->ymin, R->xmax - R->xmin);
- path = Join(PathSegment(MOVETYPE, R->origin.x + TOFRACTPEL(R->xmin),
- R->origin.y + TOFRACTPEL(R->ymin) ),
- path);
- return(path);
-}
-
-/*
-:h2.Formatting/Dump Routines for Debug
-
-:h3.DumpArea() - Display a Region
-*/
-void
-DumpArea(struct region *area)
-{
- DumpEdges(area->anchor);
-}
-
-#define INSWATH(p, y0, y1) (p != NULL && p->ymin == y0 && p->ymax == y1)
-/*
-:h3.DumpEdges() - Display Run End Lists (Edge Lists)
-*/
-
-/*
-:h3.edgecheck() - For Debug, Verify that an Edge Obeys the Rules
-*/
-
-/*ARGSUSED*/
-static void
-edgecheck(struct edgelist *edge, int oldmin, int oldmax)
-{
- if (edge->type != EDGETYPE)
- Abort("EDGE ERROR: non EDGETYPE in list");
-/*
-The following check is not valid if the region is jumbled so I took it
-out:
-*/
-/* if (edge->ymin < oldmax && edge->ymin != oldmin)
- Abort("EDGE ERROR: overlapping swaths"); */
-}
-
-void
-DumpEdges(struct edgelist *edges)
-{
- register struct edgelist *p,*p2;
- register pel ymin = MINPEL;
- register pel ymax = MINPEL;
-
- if (edges == NULL) {
- return;
- }
- if (RegionDebug <= 1) {
- for (p=edges; p != NULL; p = p->link) {
- edgecheck(p, ymin, ymax);
- ymin = p->ymin; ymax = p->ymax;
- }
- }
- else {
-
- for (p2=edges; p2 != NULL; ) {
-
- edgecheck(p2, ymin, ymax);
- ymin = p2->ymin;
- ymax = p2->ymax;
-
- while (INSWATH(p2, ymin, ymax))
- p2 = p2->link;
- }
- }
-}
diff --git a/src/Type1/regions.h b/src/Type1/regions.h
index 96ad1a5..d869cf7 100644
--- a/src/Type1/regions.h
+++ b/src/Type1/regions.h
@@ -79,27 +79,6 @@ extern void t1_MoreWorkArea ( struct region *R, fractpel x1, fractpel y1,
extern struct region *t1_CopyRegion ( struct region *area );
/* destroy a region */
extern void t1_KillRegion ( struct region *area );
-/* clip a region to a rectangle */
-extern struct region *t1_BoxClip ( struct region *R, pel xmin, pel ymin,
- pel xmax, pel ymax );
-/* sort edges onto growing edge list */
-extern struct edgelist *t1_SortSwath ( struct edgelist *anchor,
- struct edgelist *edge,
- SwathFunc swathfcn );
-/* 'union' two edges into a swath */
-extern struct edgelist *t1_SwathUnion ( struct edgelist *before0,
- struct edgelist *edge );
-/* returns bounding box of a region */
-extern struct segment *t1_RegionBounds ( struct region *R );
-#ifdef notdef
-/* force text to become a true region */
-struct region *t1_CoerceRegion(struct textpath *tp);
-#endif
-/* moves the edge values in a region */
-extern void t1_MoveEdges ( struct region *R, fractpel dx, fractpel dy );
-/* sort the edges and reset the jumbled flag */
-extern void t1_UnJumble ( struct region *region );
-
/*END SHARED*/
/*SHARED*/
@@ -243,8 +222,3 @@ Interior() rule enumerations:
#define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */
/*END SHARED*/
-
-/* dump a region structure */
-extern void t1_DumpArea ( struct region *area );
-/* dump a region's edge list */
-extern void t1_DumpEdges ( struct edgelist *edges );
diff --git a/src/Type1/scanfont.c b/src/Type1/scanfont.c
index 9a09848..8cad57f 100644
--- a/src/Type1/scanfont.c
+++ b/src/Type1/scanfont.c
@@ -422,7 +422,7 @@ static EncodingTable ISO8859Enc[] = {
};
static psobj *StdEncArrayP = NULL;
-psobj *ISOLatin1EncArrayP = NULL;
+static psobj *ISOLatin1EncArrayP = NULL;
static psobj *
MakeEncodingArrayP(EncodingTable *encodingTable)
diff --git a/src/Type1/spaces.c b/src/Type1/spaces.c
index 55cc96f..1f5a321 100644
--- a/src/Type1/spaces.c
+++ b/src/Type1/spaces.c
@@ -66,6 +66,60 @@ static void FindIfcn ( double cx, double cy,
iconvertFunc *fcnP );
/*
+:h3.MatrixMultiply() - Implements Multiplication of Two Matrices
+
+Implements matrix multiplication, A * B = C.
+
+To remind myself, matrix multiplication goes rows of A times columns
+of B.
+The output matrix may be the same as one of the input matrices.
+*/
+static void
+MatrixMultiply(double A[2][2], double B[2][2], /* input matrices */
+ double C[2][2]) /* output matrix */
+{
+ register double txx,txy,tyx,tyy;
+
+ txx = A[0][0] * B[0][0] + A[0][1] * B[1][0];
+ txy = A[1][0] * B[0][0] + A[1][1] * B[1][0];
+ tyx = A[0][0] * B[0][1] + A[0][1] * B[1][1];
+ tyy = A[1][0] * B[0][1] + A[1][1] * B[1][1];
+
+ C[0][0] = txx;
+ C[1][0] = txy;
+ C[0][1] = tyx;
+ C[1][1] = tyy;
+}
+
+/*
+:h3.MatrixInvert() - Invert a Matrix
+
+My reference for matrix inversion was :hp1/Elementary Linear Algebra/
+by Paul C. Shields, Worth Publishers, Inc., 1968.
+*/
+static void
+MatrixInvert(double M[2][2], /* input matrix */
+ double Mprime[2][2]) /* output inverted matrix */
+{
+ register double D; /* determinant of matrix M */
+ register double txx,txy,tyx,tyy;
+
+ txx = M[0][0];
+ txy = M[1][0];
+ tyx = M[0][1];
+ tyy = M[1][1];
+
+ D = M[1][1] * M[0][0] - M[1][0] * M[0][1];
+ if (D == 0.0)
+ Abort("MatrixInvert: can't");
+
+ Mprime[0][0] = tyy / D;
+ Mprime[1][0] = -txy / D;
+ Mprime[0][1] = -tyx / D;
+ Mprime[1][1] = txx / D;
+}
+
+/*
:h3.Entry Points Provided to the TYPE1IMAGER User
*/
@@ -544,6 +598,32 @@ FillOutFcns(struct XYspace *S) /* functions will be set in this structure */
if (S->ixconvert == NULL || S->iyconvert == NULL)
S->iconvert = ForceFloat;
}
+
+/*
+:h3.PseudoSpace() - Build a Coordinate Space from a Matrix
+
+Since we have built all this optimized code that, given an (x,y) and
+a coordinate space, yield transformed (x,y), it seems a shame not to
+use the same logic when we need to multiply an (x,y) by an arbitrary
+matrix that is not (initially) part of a coordinate space. This
+subroutine takes the arbitrary matrix and builds a coordinate
+space, with all its nifty function pointers.
+*/
+
+static void
+PseudoSpace(struct XYspace *S, /* coordinate space structure to fill out */
+ double M[2][2]) /* matrix that will become 'tofract.normal' */
+{
+ S->type = SPACETYPE;
+ S->flag = ISPERMANENT(ON) + ISIMMORTAL(ON);
+ S->references = 2; /* 3-26-91 added PNM */
+ S->tofract.normal[0][0] = M[0][0];
+ S->tofract.normal[1][0] = M[1][0];
+ S->tofract.normal[0][1] = M[0][1];
+ S->tofract.normal[1][1] = M[1][1];
+
+ FillOutFcns(S);
+}
/*
:h4.FindFfcn() - Subroutine of FillOutFcns() to Fill Out Floating Functions
@@ -678,7 +758,7 @@ get the same result if we did S, then R, then T on the space and mapping
an unmodified font through that space.
*/
-struct xobject *
+static struct xobject *
t1_Xform(struct xobject *obj, /* object to transform */
double M[2][2]) /* transformation matrix */
{
@@ -759,24 +839,6 @@ t1_Transform(struct xobject *obj,
ConsiderContext(obj, M);
return(Xform(obj, M));
}
-/*
-:h3.Scale() - Special Case of Transform()
-
-This is a user operator.
-*/
-
-struct xobject *
-t1_Scale(struct xobject *obj, /* object to scale */
- double sx, double sy) /* scale factors in x and y */
-{
- double M[2][2];
-
- M[0][0] = sx;
- M[1][1] = sy;
- M[1][0] = M[0][1] = 0.0;
- ConsiderContext(obj, M);
- return(Xform(obj, M));
-}
/*
:h3 id=rotate.Rotate() - Special Case of Transform()
@@ -799,31 +861,6 @@ xiRotate(struct xobject *obj, /* object to be transformed */
}
#endif
-/*
-:h3.PseudoSpace() - Build a Coordinate Space from a Matrix
-
-Since we have built all this optimized code that, given an (x,y) and
-a coordinate space, yield transformed (x,y), it seems a shame not to
-use the same logic when we need to multiply an (x,y) by an arbitrary
-matrix that is not (initially) part of a coordinate space. This
-subroutine takes the arbitrary matrix and builds a coordinate
-space, with all its nifty function pointers.
-*/
-
-void
-PseudoSpace(struct XYspace *S, /* coordinate space structure to fill out */
- double M[2][2]) /* matrix that will become 'tofract.normal' */
-{
- S->type = SPACETYPE;
- S->flag = ISPERMANENT(ON) + ISIMMORTAL(ON);
- S->references = 2; /* 3-26-91 added PNM */
- S->tofract.normal[0][0] = M[0][0];
- S->tofract.normal[1][0] = M[1][0];
- S->tofract.normal[0][1] = M[0][1];
- S->tofract.normal[1][1] = M[1][1];
-
- FillOutFcns(S);
-}
/*
:h2 id=matrixa.Matrix Arithmetic
@@ -847,58 +884,6 @@ transposed, equally often in the literature.
*/
/*
-:h3.MatrixMultiply() - Implements Multiplication of Two Matrices
-
-Implements matrix multiplication, A * B = C.
-
-To remind myself, matrix multiplication goes rows of A times columns
-of B.
-The output matrix may be the same as one of the input matrices.
-*/
-void
-MatrixMultiply(double A[2][2], double B[2][2], /* input matrices */
- double C[2][2]) /* output matrix */
-{
- register double txx,txy,tyx,tyy;
-
- txx = A[0][0] * B[0][0] + A[0][1] * B[1][0];
- txy = A[1][0] * B[0][0] + A[1][1] * B[1][0];
- tyx = A[0][0] * B[0][1] + A[0][1] * B[1][1];
- tyy = A[1][0] * B[0][1] + A[1][1] * B[1][1];
-
- C[0][0] = txx;
- C[1][0] = txy;
- C[0][1] = tyx;
- C[1][1] = tyy;
-}
-/*
-:h3.MatrixInvert() - Invert a Matrix
-
-My reference for matrix inversion was :hp1/Elementary Linear Algebra/
-by Paul C. Shields, Worth Publishers, Inc., 1968.
-*/
-void
-MatrixInvert(double M[2][2], /* input matrix */
- double Mprime[2][2]) /* output inverted matrix */
-{
- register double D; /* determinant of matrix M */
- register double txx,txy,tyx,tyy;
-
- txx = M[0][0];
- txy = M[1][0];
- tyx = M[0][1];
- tyy = M[1][1];
-
- D = M[1][1] * M[0][0] - M[1][0] * M[0][1];
- if (D == 0.0)
- Abort("MatrixInvert: can't");
-
- Mprime[0][0] = tyy / D;
- Mprime[1][0] = -txy / D;
- Mprime[0][1] = -tyx / D;
- Mprime[1][1] = txx / D;
-}
-/*
:h2.Initialization, Queries, and Debug
*/
/*
@@ -908,7 +893,7 @@ For compatibility, we initialize a coordinate space called USER which
maps 72nds of an inch to pels on the default device.
*/
-struct XYspace *USER = &identity;
+static struct XYspace *USER = &identity;
void
InitSpaces(void)
@@ -954,45 +939,3 @@ QuerySpace(struct XYspace *S, /* space asked about */
*cyxP = M[0][1];
*cyyP = M[1][1];
}
-
-/*
-:h3.FormatFP() - Format a Fixed Point Pel
-
-We format the pel as "dddd.XXXX", where XX's are hexidecimal digits,
-and the dd's are decimal digits. This might be a little confusing
-mixing hexidecimal and decimal like that, but it is convenient
-to use for debug.
-
-We make sure we have N (FRACTBITS/4) digits past the decimal point.
-*/
-#define FRACTMASK ((1<<FRACTBITS)-1) /* mask for fractional part */
-
-void
-FormatFP(char *string, /* output string */
- fractpel fpel) /* fractional pel input */
-{
- char temp[8];
- register char *s;
- register char *sign;
-
- if (fpel < 0) {
- sign = "-";
- fpel = -fpel;
- }
- else
- sign = "";
-
- sprintf(temp, "000%lx", fpel & FRACTMASK);
- s = temp + strlen(temp) - (FRACTBITS/4);
-
- sprintf(string, "%s%d.%sx", sign, (int)(fpel >> FRACTBITS), s);
-}
-
-/*
-:h3.DumpSpace() - Display a Coordinate Space
-*/
-/*ARGSUSED*/
-void
-DumpSpace(struct XYspace *S)
-{
-}
diff --git a/src/Type1/spaces.h b/src/Type1/spaces.h
index ef78f2f..88d1b15 100644
--- a/src/Type1/spaces.h
+++ b/src/Type1/spaces.h
@@ -48,14 +48,6 @@ extern struct XYspace *Context(pointer device, double units);
/* transform an object */
extern struct xobject *t1_Transform ( struct xobject *obj, double cxx,
double cyx, double cxy, double cyy );
-#if 0
-struct xobject *t1_Rotate(); /* rotate an object */
-#endif
-/* scale an object */
-extern struct xobject *t1_Scale ( struct xobject *obj, double sx, double sy );
-#if 0
-struct xobject *t1_Warp(); /* transform like delta of two spaces */
-#endif
/* returns coordinate space matrix */
extern void t1_QuerySpace ( struct XYspace *S, double *cxxP, double *cyxP,
double *cxyP, double *cyyP );
@@ -145,17 +137,9 @@ struct XYspace {
extern void t1_InitSpaces ( void );
/* duplicate a coordinate space */
extern struct XYspace *t1_CopySpace ( struct XYspace *S );
-/* transform object by matrix */
-extern struct xobject *t1_Xform ( struct xobject *obj, double M[2][2] );
/* return user coordinates from device coordinates */
extern void t1_UnConvert ( struct XYspace *S, struct fractpoint *pt,
double *xp, double *yp );
-/* multiply two matrices */
-extern void t1_MMultiply ( double A[2][2], double B[2][2], double C[2][2] );
-/* invert a matrix */
-extern void t1_MInvert ( double M[2][2], double Mprime[2][2] );
-/* force a coordinate space from a matrix */
-extern void t1_PseudoSpace ( struct XYspace *S, double M[2][2] );
/* return the "context" represented by a matrix */
int t1_FindContext(double M[2][2]);
@@ -165,8 +149,3 @@ int t1_FindContext(double M[2][2]);
#define NULLCONTEXT 0
/*END SHARED*/
-
-/* dump a coordinate space structure */
-extern void t1_DumpSpace ( struct XYspace *S );
-/* dump a format a "fractpel" coordinate */
-extern void t1_FormatFP ( char *string, fractpel fpel );
diff --git a/src/Type1/t1malloc.c b/src/Type1/t1malloc.c
index 20d4212..df863a2 100644
--- a/src/Type1/t1malloc.c
+++ b/src/Type1/t1malloc.c
@@ -171,8 +171,8 @@ asked for.
:h3.Some Flags for Debug
*/
-long AvailableWords = 0; /* number of words available in memory */
-char mallocdebug = 0; /* a flag that enables some chatty printf's */
+static long AvailableWords = 0; /* number of words available in memory */
+static char mallocdebug = 0; /* a flag that enables some chatty printf's */
/*
:h3.Prototypes of static functions
diff --git a/src/Type1/t1stub.c b/src/Type1/t1stub.c
deleted file mode 100644
index 2fb1d79..0000000
--- a/src/Type1/t1stub.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $Xorg: t1stub.c,v 1.3 2000/08/17 19:46:34 cpqbld Exp $ */
-/* Copyright International Business Machines,Corp. 1991
- * All Rights Reserved
- *
- * License to use, copy, modify, and distribute this software
- * and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice
- * appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation,
- * and that the name of IBM not be used in advertising or
- * publicity pertaining to distribution of the software without
- * specific, written prior permission.
- *
- * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
- * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
- * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
- * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
- * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
- * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
- * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
- * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
- * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/font/Type1/t1stub.c,v 1.8 2001/01/17 19:43:24 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef FONTMODULE
-#include "Xdefs.h" /* Bool declaration */
-#include "Xmd.h" /* INT32 declaration */
-#include "os.h"
-#include "xf86_ansic.h"
-#else
-#include <stdio.h>
-#endif
-#include "objects.h" /* get #define for Abort() */
-
-static void
-xiStub(void)
-{
- printf("xiStub called\n");
- Abort("xiStub called");
-}
-
-void
-t1_DumpText(void)
-{
- xiStub();
-}