close("boats*"); textXpos = 300; textStr1 = "Text 1\nLeft justified"; textYpos1 = 100; textStr2 = "Text 2\nRight justified"; textYpos2 = 200; textStr3 = "Text 3\nLeft justified"; textYpos3 = 350; textStr4 = "Text 4\nRight justified"; textYpos4 = 450; run("Boats (356K)"); setFont("Serif", 36, "antialiased"); makeText(textStr1, textXpos, textYpos1); run("Properties... ", "name=test stroke=red justification=Left fill=none"); Overlay.addSelection(); //correct ROI alignment, both text and ROI is left aligned makeText(textStr2, textXpos, textYpos2); run("Properties... ", "name=test stroke=red justification=Right fill=none"); Overlay.addSelection(); //correct ROI alignment, both text and ROI is right aligned setColor("yellow"); setJustification("left"); Overlay.drawString(textStr3, textXpos, textYpos3); //text is correctly aligned setJustification("right"); Overlay.drawString(textStr4, textXpos, textYpos4); //text is aligned according to start of first character instead of the edge of the text bounding box Overlay.show; //add helper line to show the expected X alignment position makeLine(textXpos, 0, textXpos, getHeight);