The Letter S, by Donald Knuth and Francesco Torniello

In 1980, Donald Knuth wrote a paper (technical report) called 'The Letter S', in which he introduced METAFONT by showing how it could draw any letterform specified by mathematical curves, as exemplified by a geometric construction of an S by Francesco Torniello, from 1517.

In this Snap! program, I reproduce that S, using this custom block (and some line segments):

Enjoi!

Nice but you've missed a bit :slight_smile:
image

Cool! But the really great thing about Metafont is its ability to change the shape of the letter according to the size at which you want to print it. There's a beautiful illustration in the TeXbook in which he takes a five-point font doubled in size vs. the ten-point version of the font. They're hugely different. (The doubled one looks awful, as you might guess.)

Good eye, but if you check the Knuth paper, you'll see that Torniello missed a bit!

(Two bits actually, because if the square frame weren't present it would be obvious there's another gap at the top)

The point was not really to recreate Metafont, just to draw that S, which is interesting because it has history (being from 1517, which must be why Knuth chose it; but now also it has Knuth history).

It would be good, though, to globally apply scale and shift to make it nicely centered and big, with 3 parameters added to my custom blocks.

Oh I wasn't criticizing your project. Just, you cited Metafont, and I think it's cool that fonts are designed to have different shapes at different sizes.

cool, thx

Thinking more about how to apply shift/scale, is there a way to export global variables that go together with custom blocks, so the package will import them all together, and the variables will persist default values?

No, but we know we need that. The Colors and Crayons library uses the Variables library to create variables on the first call (by checking whether a variable already exists). We're going to invent a way to put variables in a library.

Meanwhile, the other thing you can do is export a sprite that has access to them.

Here's what I decided on:

There's also a 'yform' function. All coordinates are pushed through these before 'go to'

The embed in the OP reflects the update.

Sure, that's totally fine for variables with fixed atomic values. (In your procedure, there's no way for your user to change the scale and shift amounts.) In Crayons and Colors, I had lists of size 100 or more, each of which was a list of three or more atoms. It actually takes noticeable time to regenerate such lists on each procedure call.

WDYM?atomic values?i thought it meant the number of protons in an atom.

That's physics. Or chemistry. In computer science, an atomic value is anything other than a data aggregate (list, array, dictionary, whatever your language offers).

OOOOOOOOOOOOOOOOOOOOOOOOOOOOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Okay