Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Oct 26, 2016; 1:17am
URL: http://imagej.273.s1.nabble.com/Controlling-font-aliasing-for-overlays-tp5017471p5017484.html
> On Oct 25, 2016, at 7:27 AM, Stein Rørvik <
[hidden email]> wrote:
>
> Yes this is what I want; but I forgot to tell that the overlay font I want to turn on/off antialiasing for is one created by the Scalebar command.
>
> This illustrates what I want to do:
>
> run("AuPbSn 40 (56K)");
> setFont("SanSerif", 12, ""); //turn off antialiasing
> run("Overlay Options...", "stroke=yellow width=0 fill=none set");
> makeRectangle(50, 140, 10, 10);
> run("Scale Bar...", "width=50 height=4 font=12 color=Yellow background=None location=[At selection] overlay");
> Overlay.drawString("test", 50, 175);
> Overlay.show;
> run("Flatten");
>
> The string "test" is flattened to a font without antialiasing (as desired),
> but the scale bar font is always drawn with antialiasing. The scale bar aliasing is controlled by the setting under Options - Fonts which cannot be controlled by a macro.
In the latest ImageJ daily build (1.51h13), the “Antialiased text” option in the Edit>Options>Fonts dialog can be set using the setOption("AntialiasedText”,boolean) macro function. The following is an updated version of the test macro that uses this new function.
-wayne
run("AuPbSn 40 (56K)");
run("Overlay Options...", "stroke=yellow width=0 fill=none set");
makeRectangle(50, 140, 10, 10);
setOption("AntialiasedText", false);
run("Scale Bar...", "width=50 height=4 font=12 color=Yellow background=None location=[At selection] overlay");
setFont("SanSerif", 12, ""); //turn off antialiasing
Overlay.drawString("test", 50, 175);
Overlay.show;
run("Flatten");
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html