Wrong text justification in ROIs

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong text justification in ROIs

Stein Rørvik
There is an issue with using Right justified text in ROIs.
This only works if the fill color is set; it does not work with a transparent fill.
This macro reproduces the issue; textStr3 is overlaid wrongly:

textXpos = 300;

textStr1 = "Text\nLeft justified";
textYpos1 = 100;

textStr2 = "Text\nLeft justified";
textYpos2 = 200;

textStr3 = "Text\nRight justified";
textYpos3 = 300;

textStr4 = "Text\nRight justified";
textYpos4 = 400;

run("Boats (356K)");
setFont("Serif", 36, "antialiased");

makeText(textStr1, textXpos, textYpos1);
run("Properties... ", "name=test stroke=red justification=Left fill=none");
Overlay.addSelection(); //correct position

makeText(textStr2, textXpos, textYpos2);
run("Properties... ", "name=test stroke=red justification=Left fill=blue");
Overlay.addSelection(); //correct position

makeText(textStr3, textXpos, textYpos3);
run("Properties... ", "name=test stroke=yellow justification=Right fill=none");
Overlay.addSelection(); //wrong position

makeText(textStr4, textXpos, textYpos4);
run("Properties... ", "name=test stroke=yellow justification=Right fill=blue");
Overlay.addSelection(); //correct position

run("Select None");
Overlay.show;
updateDisplay;

I am using daily build ImageJ 1.52e with Java 1.6 on Windows 7/64-bit.

Stein

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

Re: Wrong text justification in ROIs

Wayne Rasband-2
> On Jul 9, 2018, at 8:45 AM, Stein Rørvik <[hidden email]> wrote:
>
> There is an issue with using Right justified text in ROIs.
> This only works if the fill color is set; it does not work with a transparent fill.
> This macro reproduces the issue; textStr3 is overlaid wrongly:

This bug is fixed in the 1.52e58 daily build.

-wayne


> textXpos = 300;
>
> textStr1 = "Text\nLeft justified";
> textYpos1 = 100;
>
> textStr2 = "Text\nLeft justified";
> textYpos2 = 200;
>
> textStr3 = "Text\nRight justified";
> textYpos3 = 300;
>
> textStr4 = "Text\nRight justified";
> textYpos4 = 400;
>
> run("Boats (356K)");
> setFont("Serif", 36, "antialiased");
>
> makeText(textStr1, textXpos, textYpos1);
> run("Properties... ", "name=test stroke=red justification=Left fill=none");
> Overlay.addSelection(); //correct position
>
> makeText(textStr2, textXpos, textYpos2);
> run("Properties... ", "name=test stroke=red justification=Left fill=blue");
> Overlay.addSelection(); //correct position
>
> makeText(textStr3, textXpos, textYpos3);
> run("Properties... ", "name=test stroke=yellow justification=Right fill=none");
> Overlay.addSelection(); //wrong position
>
> makeText(textStr4, textXpos, textYpos4);
> run("Properties... ", "name=test stroke=yellow justification=Right fill=blue");
> Overlay.addSelection(); //correct position
>
> run("Select None");
> Overlay.show;
> updateDisplay;
>
> I am using daily build ImageJ 1.52e with Java 1.6 on Windows 7/64-bit.
>
> Stein

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