From 62ba3a3307ff8fd42a4a6c0440621193cdbd78d4 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 12 Nov 2024 10:53:15 +0000 Subject: [PATCH] Correct ordering of stem hints The spec for Type 2 charstrings requires that all hstem hints must occur before all vstem hints. --- bedstead.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bedstead.c b/bedstead.c index 71f77bf..72b2301 100644 --- a/bedstead.c +++ b/bedstead.c @@ -3813,21 +3813,6 @@ emit_hints(int vstems[XSIZE], int hstems[YSIZE]) int i, start, size, cur; bool printed; - cur = 0; printed = false; - size = XPIX_S + weight->weight; - for (i = 0; i < XSIZE; i++) { - if (vstems[i] > 0) { - start = i * XPIX_S - weight->weight; - printf(" %g %g", - (double)((start - cur) / XSCALE), - (double)(size / XSCALE)); - cur = start + size; - i++; /* Avoid overlapping stems. */ - printed = true; - } - } - if (printed) printf(" vstem"); - cur = DESCENT * YPIX; printed = false; size = YPIX_S; for (i = YSIZE - 1; i >= 0; i--) { @@ -3842,6 +3827,21 @@ emit_hints(int vstems[XSIZE], int hstems[YSIZE]) } } if (printed) printf(" hstem"); + + cur = 0; printed = false; + size = XPIX_S + weight->weight; + for (i = 0; i < XSIZE; i++) { + if (vstems[i] > 0) { + start = i * XPIX_S - weight->weight; + printf(" %g %g", + (double)((start - cur) / XSCALE), + (double)(size / XSCALE)); + cur = start + size; + i++; /* Avoid overlapping stems. */ + printed = true; + } + } + if (printed) printf(" vstem"); } /* -- 2.30.2