chiark / gitweb /
Correct bold outlines
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 19 Nov 2024 23:34:47 +0000 (23:34 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 19 Nov 2024 23:40:00 +0000 (23:40 +0000)
The weight-changing code in adjust_weight() depended on the direction
that outlines were drawn in, so when I changed the direction to match
that required by CFF, it started lightening the font when it should have
been boldening it.  A lot of swapping "next" and "prev" has corrected
that.

bedstead.c

index 115c3b381c631be67f051013d66e685ad2da206c..6fc2696d7e7277cefdbb3fae3a01cd3a261483a5 100644 (file)
@@ -3968,7 +3968,7 @@ adjust_weight(void)
                PX = p->prev->v.x; PY = p->prev->v.y;
                NX = p->next->v.x; NY = p->next->v.y;
                /* Move left-edge points horizontally */
-               if (PY <= Y && Y <= NY) {
+               if (NY <= Y && Y <= PY) {
                        moves[i].x -= W;
                        /*
                         * These two clauses deal in an ad-hoc way
@@ -3977,24 +3977,24 @@ adjust_weight(void)
                         * inside corner gets completely consumed by
                         * boldening.
                         */
-                       if (W > XQTR_S && PY == Y && PX == X - XQTR_S) {
-                               moves[i].y += W - XQTR_S;
-                               if (NX != X) moves[i].x += W - XQTR_S;
-                               killpoint(p->prev);
-                       }
                        if (W > XQTR_S && NY == Y && NX == X - XQTR_S) {
-                               moves[i].y -= W - XQTR_S;
+                               moves[i].y += W - XQTR_S;
                                if (PX != X) moves[i].x += W - XQTR_S;
                                killpoint(p->next);
                        }
+                       if (W > XQTR_S && PY == Y && PX == X - XQTR_S) {
+                               moves[i].y -= W - XQTR_S;
+                               if (NX != X) moves[i].x += W - XQTR_S;
+                               killpoint(p->prev);
+                       }
                }
                /* Move top inner corner points along NE/SW diagonal */
-               if (PY < Y && Y > NY && PX > X && X > NX) {
+               if (NY < Y && Y > PY && NX > X && X > PX) {
                        moves[i].x -= W/2;
                        moves[i].y -= W/2;
                }
                /* Move bottom inner corner points along NW/SE diagonal */
-               if (PY > Y && Y < NY && PX < X && X < NX) {
+               if (NY > Y && Y < PY && NX < X && X < PX) {
                        moves[i].x -= W/2;
                        moves[i].y += W/2;
                }