chiark / gitweb /
Change XQTR_S and YQTR_S to 29
authorBen Harris <bjh21@bjh21.me.uk>
Fri, 19 Jun 2020 21:43:33 +0000 (22:43 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Fri, 19 Jun 2020 21:43:33 +0000 (22:43 +0100)
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

index 52815589f4267a4f750a51a0955a38b04e6232b5..e23ad58aea9faf2072358fbf58f233ba96d95fa0 100644 (file)
  *         # # . .    / # / .           . . # #    . \ # \
  *         # # . .    # / . .           . . # #    . . \ #
  * 
- * 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);