chiark / gitweb /
Stop bold line-drawing characters overflowing character cell
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 26 Oct 2024 11:23:28 +0000 (12:23 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 21 Nov 2024 20:55:51 +0000 (20:55 +0000)
In XLFD terms, Bedstead is a "character cell" font, where every
character fits entirely within its cell (defined by advance width,
ascent, and descent).  Bedstead Bold maintained this because it
thickened into the unused column to the left of each character.
However, combining the new continuous line-drawing with emboldening led
to bold line-drawing characters that extended beyond their character
cell.  This led FontForge to make the SPACING property of the BDF file
"M" (for monospace) rather the "C".

This commit simply clips the X co-ordinate of points in a bolded
character at zero.  That's safe because line-drawing characters are
guaranteed not to be doing anything diagonal in the left-most column.
This is slightly ugly, in that the bold characters aren't quite so
algorithmically derived from the non-bold ones, but in most cases
there'll be another line-drawing character to the left anyway.

bedstead.c

index 8ab8dcc1a15b306d2066566d3c4bea1ba627619d..3a5f1a18add7cb602d7fd372378ca4db6b67ac85 100644 (file)
@@ -3462,6 +3462,8 @@ adjust_weight(void)
                assert(p->prev != NULL);
                p->v.x += moves[i].x;
                p->v.y += moves[i].y;
+               /* Make sure line-drawing characters don't overflow. */
+               if (p->v.x < 0) p->v.x = 0;
        }
 }