Posted by
Stein Rørvik on
Oct 02, 2018; 7:36am
URL: http://imagej.273.s1.nabble.com/Overlay-drawString-has-wrong-vertical-position-with-Left-justification-tp5021257p5021263.html
Thanks, I have tested and found both fixes to work well.
The text is now drawn a little higher with setJustification("Right") than previously; the new placement is more correct. The lower outer boundary of the text now matches the requested vertical position.
Stein
-----Original Message-----
From: ImageJ Interest Group <
[hidden email]> On Behalf Of Wayne Rasband
Sent: 02. oktober 2018 03:27
To:
[hidden email]
Subject: Re: Overlay.drawString has wrong vertical position with Left justification
> 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--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html