Set Font, Bold and Italic for Pen Writing Block

Just a block that runs the following script:

This script does work and sets the font for pen writing. I was wondering if we could get a block the does this (in the pen category of course) in maybe Snap! 7.0?

I also want this to be a primitive, or at least a library.

Not a chance -- 7.0 is late enough already. Maybe someday.

Meanwhile here's a non-JS boldface:

The 0.6 instead of 1 is just for the sake of retina (4x) displays (on which 1 generates open-face instead of boldface) but also works on non-retina.

And could you do italic by pointing in a lower direction and resetting the Y position after every letter?

That's clever, but it wouldn't be quite right, because the baseline of a rotated letter is rotated, whereas the baseline of an italic letter is still horizontal. Combining this topic with the one about matrix multiplication, if you could get the bitmap array of the glyph, you could then apply a transformation such as

1 0.3
0 1

(supposing I have rows and columns straight, which I'm not sure about) in which the y coordinate of the output equals the y coordinate of the input, but the x coordinate of the output is offset by some fraction of the y coordinate. Maybe I mean

1   0
0.3 1

This topic, in case someone didn't see it.

Seperately, how would I turn, say, matrix script pic (6) into a matrix/list of lists for matrix multiplication? I just saw

Use[scratchblocks]([pixels v]of costume(costume...)::looks)[/scratchblocks]

Now it gives a 2D list:

I might need a 3D list:
Screenshot (48)

Edit: When I try both matmults, I get these freaky letters:
Screenshot (49)

Screenshot (50)

Edit 2: Link to what I'm doing here.

That's what the RESHAPE block is for! :~)

Made a library to do this:

But then the matrix multiplication doesn't work.

That's very low resolution.

This is nice, but it has a problem about spaces in the text:

Also, it's not so good at non-monospace fonts. It would be ideal if you could capture the bounding box of each letter, and use its width for the spacing. (Well, except for italic, for which the bounding box is too big; you need the maximum of the width of each row of pixels.)

But, not to discourage you -- this is a great start!

Right, you have to treat each pixel as if it were atomic, so you just use the topmost two dimensions. A little more complicated. Alternatively, fonts don't generally have color information, so turn each pixel into a zero if all of RGB are, say, less than 10 (to account for fuzziness) and a one otherwise.

(Edit: This demonstrates the general rule that the more you understand something, the more complicated it gets.)

I'm not sure how to do that.

I'm going to bed, (after doing dishes) so I won't reply until tomorrow.


It has higher res now.

Not working, because Its all squished together because of the sizing of the letters (The letters are saved bigger for better res, and the calculations are glitchy when calculating the width) This is why there is a customizable spacing function

But the same spacing for all letters!

Yes, but

Just store the letters in a list as a costume then to write it stamp the costume.