Put the charstring cursor in a local variable

This commit is contained in:
Ben Harris 2024-11-02 19:32:17 +00:00
parent e3eae733ee
commit 82447229df

View File

@ -3564,10 +3564,8 @@ clean_path(void)
} while (done_anything);
}
static vec cur;
static void
emit_contour(point *p0)
emit_contour(point *p0, vec *cur)
{
point *p = p0, *p1;
int stacksize = 0;
@ -3576,11 +3574,11 @@ emit_contour(point *p0)
do {
stacksize += 2;
printf(" %g %g %s\n",
(double)(p->v.x - cur.x) / XSCALE,
(double)(p->v.y - cur.y) / YSCALE,
(double)(p->v.x - cur->x) / XSCALE,
(double)(p->v.y - cur->y) / YSCALE,
p == p0 ? "rmoveto" : stacksize >= 48 ? "rlineto" : "");
stacksize %= 48;
cur = p->v;
*cur = p->v;
p1 = p->next;
p->prev = p->next = NULL;
p = p1;
@ -3593,9 +3591,8 @@ emit_path(void)
{
int i, pass;
point *p;
struct vec cur = { 0, DESCENT * YPIX };
cur.x = 0;
cur.y = DESCENT * YPIX;
/*
* On the first pass, emit open contours (if there are any).
* On the second pass, emit all remaining contours.
@ -3604,7 +3601,7 @@ emit_path(void)
for (i = 0; i < nextpoint; i++) {
p = &points[i];
if (p->next && (!p->prev || pass == 1))
emit_contour(p);
emit_contour(p, &cur);
}
}
printf("endchar\n");