Turn multiline text into a costume

This is an extension of the costume from text library reporter

untitled script pic

to allow creation of lines of text

untitled script pic (5)

It also comes with a helper C-block that will re-centre the costume into it's original position

ProjectName=CostumeFromMultilineText

Cool!

You can set pen color to get a colorful text. So the next step can be dialog box as described by bh

I made something similar but rendered as HTML with basic cursor navigation : ...snap.html#present:Username=dardoro&ProjectName=TextBox

I finally realised how to get the new costume to set it's pivot point to it's centre by changing this block

image

This removes the need for the extra re-centre wrapper

(Note -I've only modified my own multiline reporter - I've left the original library block alone)

ProjectName=CostumeFromMultilineText2

Nice !

I remix it to add justification (left, right, center)

(you already made left justification)

image

Excellent addition :slight_smile:

Made a slight mod to move the combine outside of the inner loops

ProjectName=CostumeFromMultilineTextWithJustification2

I just notificed your change x line and I've applied similar logic to do the justifies without looping and adding spaces

image

CostumeFromMultilineTextWithJustification3

[edit - changed to using 39.58/72 to improve accuracy)

I like your optimisation.

good job.

i found 7/12 here:

40/72 is more accurate ?

Each costume from letter height and width varies depending on the individual letter

But when I played around a lot (doing other stuff) I settled on the this ratio of size as being width of a space char

If you look closely on right justify - I think it it off by one pixel (comparing the o of Hello to the o of to) but what is one pixel between friends :slight_smile:

Write block uses monospace font so, for every letter
CostumeFromMultilineTextWithJustification3 script pic (5)

CostumeFromMultilineTextWithJustification3 script pic (3)

Doing that with size 72 gives 39.58 so I was quite close with my 40 estimate :slight_smile:

Changing it to 39.58 removes the off-by-one issue :slight_smile:

image

Yes, but this is only for monospace fonts.