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.
This commit is contained in:
Ben Harris 2021-10-16 15:13:52 +01:00
parent 7bde2d18ab
commit 4592cdfb22

View File

@ -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;