chiark / gitweb /
Correct ordering of stem hints
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 12 Nov 2024 10:53:15 +0000 (10:53 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 14 Nov 2024 23:31:36 +0000 (23:31 +0000)
The spec for Type 2 charstrings requires that all hstem hints must
occur before all vstem hints.

bedstead.c

index 71f77bff037b77869a9b23b79d94670ed99def00..72b2301d8940243a6332d4a4a39e936c11c3accf 100644 (file)
@@ -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");
 }
 
 /*