From: Ben Harris Date: Tue, 12 Nov 2024 10:53:15 +0000 (+0000) Subject: Correct ordering of stem hints X-Git-Tag: bedstead-3.246~36 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=62ba3a3307ff8fd42a4a6c0440621193cdbd78d4;p=bedstead.git Correct ordering of stem hints The spec for Type 2 charstrings requires that all hstem hints must occur before all vstem hints. --- 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"); } /*