chiark / gitweb /
Emit cntrmask operators
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 19 Nov 2024 21:53:16 +0000 (21:53 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 19 Nov 2024 23:40:00 +0000 (23:40 +0000)
bedstead.c

index 27b7d2c109171ef7bd6d4a65b0f8c574241b2b8f..faa73076319452c245c7f430b6d526c7e50a0e30 100644 (file)
@@ -3871,14 +3871,15 @@ emit_hints(int vstems[XSIZE], int ledges[XSIZE], int redges[XSIZE],
 {
        int i, start, size, cur;
        enum hint_type vhints[XSIZE], hhints[YSIZE];
-       bool printed;
+       bool printed, need_cntrmask;
 
        select_hints(YSIZE, hstems, tedges, bedges, hhints);
        cur = DESCENT * YPIX; printed = false;
        for (i = 0; i < YSIZE; i++) {
                switch (hhints[YSIZE - 1 - i]) {
-               case hint_stem:
                case hint_counter_stem:
+                       need_cntrmask = true; /* FALLTHROUGH */
+               case hint_stem:
                        start = i * YPIX_S;
                        size = YPIX_S;
                        break;
@@ -3905,8 +3906,9 @@ emit_hints(int vstems[XSIZE], int ledges[XSIZE], int redges[XSIZE],
        size = XPIX_S + weight->weight;
        for (i = 0; i < XSIZE; i++) {
                switch (vhints[i]) {
-               case hint_stem:
                case hint_counter_stem:
+                       need_cntrmask = true; /* FALLTHROUGH */
+               case hint_stem:
                        start = i * XPIX_S - weight->weight;
                        size = XPIX_S + weight->weight;
                        break;
@@ -3927,6 +3929,22 @@ emit_hints(int vstems[XSIZE], int ledges[XSIZE], int redges[XSIZE],
                printed = true;
        }
        if (printed) printf(" vstem");
+
+       if (need_cntrmask) {
+               int nhints = 0;
+               printf(" cntrmask ");
+               for (i = 0; i < YSIZE; i++)
+                       if (hhints[i]) {
+                               printf("%c", "X0100"[hhints[i]]);
+                               nhints++;
+                       }
+               for (i = 0; i < XSIZE; i++)
+                       if (vhints[i]) {
+                               printf("%c", "X0100"[vhints[i]]);
+                               nhints++;
+                       }
+               printf("0000000" + (nhints - 1) % 8);
+       }
 }
 
 /*