Login  Register

Re: Text justification issue with Overlay.drawString

Posted by Stein Rørvik on Jul 30, 2018; 12:49am
URL: http://imagej.273.s1.nabble.com/Text-justification-issue-with-Overlay-drawString-tp5020947p5021013.html

I tested this on Windows and saw the same issue.
If you try to resize the ROI by expanding it downwards, the missing text appears.
So the problem is apparently that the ROI size does not take into account that the text is multi-line.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Bill Christens-Barry
Sent: 28. juli 2018 14:40
To: [hidden email]
Subject: Re: Text justification issue with Overlay.drawString

Using ImageJ 1.52f8 on MacOS 10.12.6, I've added several lines to Stein's example code to show a different, perhaps related issue:

run("Boats (356K)");
TextStr = "This the first line of the text\nThis is line two"; xPos = getWidth/2; yPos = round(getHeight/7);

setFont("SansSerif", 28, "antialiased"); setColor("red"); setJustification("right"); Overlay.drawString(TextStr, xPos, yPos*1);
//problem: text is not right justified as expected Overlay.show;

//additional lines to illustrate a different issue run("To ROI Manager"); run("Hide Overlay"); roiManager("Select", 0); // problem: only first line of text is displayed in the image selection

Only the first line of the text that was drawn in the overlay appears in the selection now created in the image.

Bill Christens-Barry

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

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