Posted by
Wayne Rasband-2 on
Oct 02, 2018; 1:27am
URL: http://imagej.273.s1.nabble.com/Overlay-drawString-has-wrong-vertical-position-with-Left-justification-tp5021257p5021262.html
> On Sep 28, 2018, at 3:50 AM, Stein Rørvik <
[hidden email]> wrote:
>
> When combining setJustification("Right") or ("Left") and Overlay.drawString(...
> the vertical justification is too high when the horizontal justification is "Left".
> They should have been the same. setJustification("Right") gives a correct result.
This bug is fixed in the latest ImageJ daily build (1.52h18). The problem with saving and reopening images with overlays containing right-justified text is also fixed.
-wayne
>
> Try this macro:
> --------
>
> run("Close All");
> xSize = 200;
> ySize = 200;
> newImage("Untitled", "8-bit black", xSize, ySize, 1);
> setLocation(100, 100);
> setFont("SanSerif", 12);
> setLineWidth(1);
> xPos = xSize/2;
> yPos = ySize/2;
>
> setColor("Red");
> Overlay.drawLine(xPos, 0, xPos, ySize);
> Overlay.drawLine(0, yPos, xSize, yPos);
> Overlay.show;
>
> setColor("Yellow");
> setJustification("Left");
> Overlay.drawString("Left adjusted", xPos, yPos);
> setJustification("Right");
> Overlay.drawString("Right adjusted", xPos, yPos);
> Overlay.show;
>
> run("Duplicate...", " ");
> run("Set... ", "zoom=200");
> setLocation(350, 100);
>
> run("Duplicate...", " ");
> run("Set... ", "zoom=400");
> setLocation(800, 100);
>
> //the Right aligned text is drawn correctly
>
> //when zooming in, the Left adjusted text moves upwards relative to the previous position
> //when zooming in, the Right adjusted text stays in the same position as the flattened version
>
> --------
>
> Also, sometimes run("Set... ", "zoom=400") does not display correctly, you must zoom back to 100% and rezoom to update the image.
>
> I am using daily build ImageJ 1.52h with Java 1.6 on Windows 7/64-bit.
>
>
> Stein
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html