chiark / gitweb /
More-or-less functional edge hints
authorBen Harris <bjh21@bjh21.me.uk>
Sun, 17 Nov 2024 14:03:47 +0000 (14:03 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sun, 17 Nov 2024 14:03:47 +0000 (14:03 +0000)
This gets me to the milestone where the new version isn't uniformly
worse than the old one when rendered by FreeType at 10.5 ppem (the
worst size I've found).

The big problem I still have is that letters with three horizontal
stems (like 'B') get their middle stem rounded down in this version
and up in 002.009.  I think this is because FontForge generates and
edge hint and not a stem hint at the bottom of the character, which
also makes bottom stems rather fuzzy.  This version gives sharper
stems, but the characters all end up looking top-heavy.

bedstead.c

index 459ec2cc9aea3a51f3883a880fc41f94e710decb..1595431ee640bb025d13af8c7716d3823cb9af51 100644 (file)
@@ -3870,6 +3870,14 @@ emit_hints(int vstems[XSIZE], int ledges[XSIZE], int redges[XSIZE],
                        start = i * YPIX_S;
                        size = YPIX_S;
                        break;
+               case hint_aedge: /* Top edge. */
+                       start = (i + 1) * YPIX_S;
+                       size = -20;
+                       break;
+               case hint_zedge: /* Bottom edge. */
+                       start = i * YPIX_S + 21;
+                       size = -21;
+                       break;
                default: continue;
                }
                printf(" %g %g",
@@ -3889,6 +3897,14 @@ emit_hints(int vstems[XSIZE], int ledges[XSIZE], int redges[XSIZE],
                        start = i * XPIX_S - weight->weight;
                        size = XPIX_S + weight->weight;
                        break;
+               case hint_aedge: /* Left edge. */
+                       start = i * YPIX_S + 21;
+                       size = -21;
+                       break;
+               case hint_zedge: /* Right edge. */
+                       start = (i + 1) * YPIX_S;
+                       size = -20;
+                       break;
                default: continue;
                }
                printf(" %g %g",