From: Ben Harris Date: Sat, 16 Oct 2021 14:13:52 +0000 (+0100) Subject: Fix outline adjustment for Bedstead Bold X-Git-Tag: bedstead-002.003~9 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=4592cdfb22ff50df0bfcf719cd255d4e03af9e6c;p=bedstead.git Fix outline adjustment for Bedstead Bold A couple of special cases handle the inside corners of glyphs like "asterisk". They're very ad-hoc, but also reasonably simple so I'll forgive them. --- diff --git a/bedstead.c b/bedstead.c index 59dfd89..c2b89d4 100644 --- a/bedstead.c +++ b/bedstead.c @@ -2747,9 +2747,10 @@ emit_path() * vertical strokes. More precisely, we pretend that the weight * variation is achieved by moving the rising edges of the output * waveform of the SAA5050. This is implemented by moving all left - * edges left and right. The code below only handles cases where we - * don't run out of slack in horizontal lines, which limits weight to - * the range (-0.5 * XPIX) < weight < (0.25 * XPIX). + * edges left and right. The code below is not fully general: it can + * handle cases where the slack in horizontal lines doesn't run out, + * and one special case where it does. This means it should work + * correctly for the range (2 * XQTR_S - 1) < weight < (2 * XQTR_S). */ static void adjust_weight() @@ -2767,8 +2768,26 @@ adjust_weight() 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 (PY <= Y && Y <= NY) { moves[i].x -= W; + /* + * These two clauses deal in an ad-hoc way + * with the special cases (all four seen on + * the "asterisk" glyph) where the bevel of an + * 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; + if (PX != X) moves[i].x += W - XQTR_S; + killpoint(p->next); + } + } /* Move top inner corner points along NE/SW diagonal */ if (PY < Y && Y > NY && PX > X && X > NX) { moves[i].x -= W/2;