Page 1 of 1

Text leading spaces

Posted: Wed Jul 03, 2024 9:09 pm
by codegen
I'm a professor in Computer Engineering, and I mostly use Moho for animations for teaching.

One common theme is a snippet of code in one part of the frame and animated object illustrating the code in the rest of the frame.
However, the snippets of code must be indented.

Code: Select all

void swap(int *a, int *b){
    int tmp = *a;
    *a = *b;
    *b = tmp;
}
However, if I put it in a single text layer, everything is left justified. I've been looking both online and in the manual, but I haven't found anything.
Is there any way to use leading spaces on multi line left justified text?
My current workaround is each line in a separate text layer in a group.
Thanks.

Re: Text leading spaces

Posted: Wed Jul 03, 2024 9:27 pm
by hayasidist
lots of options. Some involve using another program (my personal preferred route BTW).. but that rather depends on what you need to do with the text.

Even so. assuming it's all in Moho.

put it all in one layer, but make it a vector (not text) layer.
select all the points in the lines that you want to indent and use the point translate tool to move them to the right..

Image

[EDIT: image added...]

Re: Text leading spaces

Posted: Wed Jul 03, 2024 9:33 pm
by teienkawi
it wont be so clean but ive used the vertical line symbol ( shift \) at the beginning of each line so sorta framed the text. though using it for coding may be confusing ( i dont know coding at all)

Re: Text leading spaces

Posted: Wed Jul 03, 2024 11:55 pm
by codegen
Thanks to both of you. I didn't think about vectorizing the text, mostly because the only thing I do with it is fade it in and out. But that would be a reasonable approach. To use the second suggestion, I think I could put line numbers at the beginning of each line, and then the spaces would indent the code.

Thanks again.

Re: Text leading spaces

Posted: Thu Jul 04, 2024 3:46 am
by synthsin75
If you didn't want to use line numbers, "invisible" characters might work.

Image
I used Ideographic Space from: https://www.editpad.org/tool/invisible-character

Or just mask out the anchoring vertical line of characters.