From 1f2ec13d07b87baaa17f0e4431ba2492bf1c9d66 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Fri, 19 Jun 2020 22:43:33 +0100 Subject: [PATCH] Change XQTR_S and YQTR_S to 29 The consequence of this is to narrow the diagonal strokes. They go from being 6% wider than horizontal and vertical strokes to being 0.4% wider. I like the consistency, but it also has a practical advantage: at round pixel sizes the daigonal edges no longer pass through pixel centres. This means that we're no longer at the mercy of rasterizer tie-breaking rules so (for instance) Ghostscripts rasterizations are symmetric now. Since the shape of diagonal lines on a real SAA5050 is determined by both edges of a clock whose duty cycle is only specified as being between 0.4 and 0.6, I claim this is still within the tolerances of the original. --- bedstead.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bedstead.c b/bedstead.c index 5281558..e23ad58 100644 --- a/bedstead.c +++ b/bedstead.c @@ -59,11 +59,12 @@ * # # . . / # / . . . # # . \ # \ * # # . . # / . . . . # # . . \ # * - * The position of the lines is such that on a long diagonal line, the - * amount of filled space is the same as in the rounded bitmap. There - * are a few additional complications, in that the trimming of filled - * pixels can leave odd gaps where a diagonal stem joins another one, - * so the code detects this and doesn't trim in these cases: + * The position of the lines is such that the diagonal stroke is the + * same width as a horizontal or vertical stroke (assuming square + * pixels). There are a few additional complications, in that the + * trimming of filled pixels can leave odd gaps where a diagonal stem + * joins another one, so the code detects this and doesn't trim in + * these cases: * * . # # -> . . # # # # -> . . / # # # -> . . / # # # * # . . . . # # # # . / # / # # . / # # # # @@ -216,8 +217,9 @@ struct weight const *weight = &weights[0]; #define YSCALE ((double)YPIX_S / (double)YPIX) /* Position of diagonal lines within pixels */ -#define XQTR_S (XPIX_S/4) -#define YQTR_S (YPIX_S/4) +/* 29 is approximately 100 * (1-1/sqrt(2)) */ +#define XQTR_S 29 +#define YQTR_S 29 static void dochar(char const data[YSIZE], unsigned flags); static void dochar_plotter(char const data[YSIZE], unsigned flags); -- 2.30.2