Can a newline character be used in a text overlay?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can a newline character be used in a text overlay?

Neil Fazel
Is there a way to insert a new line in a text overlay? For example:

Overlay.drawString("Al\n75um", x, y);

I'm doing this on Mac and I find that newline characters are ignored.

Thanks,
Neil

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Can a newline character be used in a text overlay?

Neil Fazel
Update: makeString() handles the newline character.

Neil

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Can a newline character be used in a text overlay?

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Neil Fazel
On Jun 30, 2014, at 11:46 AM, Neil Fazel wrote:

> Is there a way to insert a new line in a text overlay? For example:
>
> Overlay.drawString("Al\n75um", x, y);
>
> I'm doing this on Mac and I find that newline characters are ignored.

The Overlay.drawString() macro function in the latest ImageJ daily build (1.49d5) no longer ignores newline characters. Or work around the problem by using makeText() and run("Add Selection..."), as in this example:

 newImage("Untitled", "8-bit black", 500, 500, 1);
 setForegroundColor(255, 255, 0);
 setFont("SansSerif", 28, " antialiased");
 text = "These three lines of\ntext have been added\nto an overlay.";
 makeText(text, 100, 100)
 run("Add Selection...");
 run("Select None");

-wayne
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html