Set Font, Bold and Italic for Pen Writing Block

Is there a way to adjust font size?

Hmm, not so far. Perhaps the thing to do is initially import the font at size 200 or something and then let the user specify how much to scale it down. I could look into that...

Thank you very much!

No, I can't quite figure it out... Besides, when I look at your code, I learn new things I can do in Snap.

OK I'll work on it...

Can you look at

and tell me what's wrong with it?

Wrong topic.

I'm replying to this.

But
Screenshot 2021-08-27 11.26.30 AM


Sorry for bad drawing, it was done with a mouse.

Oh, ok... It doesnt work though...

I know; that's why I asked @bh what was wrong with it.

[offtopic]I credited you in a NetsBlox topic called "Backpack" for your Report Block block[/offtopic]

Umm. Two things, one easy, one hard.

The easy one is that the pixel input to NEW COSTUME has to be a vector of pixels, i.e., a wh by 4 2-D array, not a w by h by 4 3-D array. You can fix that with RESHAPE.

The hard one is that (maybe I misled you about this) when using matrices to transform shapes, what you multiply by the matrix is the x,y coordinates of a point, to get the x,y coordinates of the new point under the transformation. If you had a list of the coordinates of the nontransparent points of the costume, you could get a new list of coordinates and then turn that into a new costume. I'll have to think if there's an easy, elegant way to get that from the pixel information you have.

I made the program log the font data as vectors, so sizing doesn't make it blurry.

Say I have this (3x3):
3x3D
and I have a matrix of its black pixels:


(Does the order of each pixel (as a 2 item matrix row) matter?)(no it doesn't, if you use the same ordering for reading it as for making it.)
and I want this:
trueit3x3D
(It wouldn't be this small, but still...)
I think

(slight rearrangement of pixel order)
might work, but I'm not sure.

Edit: I have to MAP it with


but once I do that, it works.

It isn't vector once it's written, so when I write it, I have to write it big enough so it can actually be read.

To skew pixel data every row must be shifted with offset based on row index.
...


Italics costume script pic (1)

Yay!!! That's awesome.

You know, the actual font file must include the desired width for each character; can you just extract that info?

That's what the transformation matrix is supposed to do. It encodes input x,y vs. output x,y coordinates.

It affects the order of the four numbers in the 2x2 transformation matrix.