I need to control whether or not the font drawing gets antialiased for image overlays created by a macro and then flattened.
This seems to be controlled by the settings defined under Options - Fonts, but I can't find any way to change this from a macro. The macro recorder records nothing if I do changes here. I also cannot find anything about this in the macro functions documentation. Does anyone know a workaround? Stein -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Good day Stein,
what about: "setFont(name, size[, style]) Sets the font used by the drawString function. The first argument is the font name. It should be "SansSerif", "Serif" or "Monospaced". The second is the point size. The optional third argument is a string containing "bold" or "italic", or both. The third argument can also contain the keyword "antialiased". For examples, run the TextDemo macro." Perhaps not perfectly what you want... HTH Herbie ::::::::::::::::::::::::::::::: Am 25.10.16 um 12:47 schrieb Stein Rørvik: > I need to control whether or not the font drawing gets antialiased > for image overlays created by a macro and then flattened. This seems > to be controlled by the settings defined under Options - Fonts, but I > can't find any way to change this from a macro. The macro recorder > records nothing if I do changes here. I also cannot find anything > about this in the macro functions documentation. Does anyone know a > workaround? > > Stein > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
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. Stein -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Herbie Sent: 25. oktober 2016 13:01 To: [hidden email] Subject: Re: Controlling font aliasing for overlays Good day Stein, what about: "setFont(name, size[, style]) Sets the font used by the drawString function. The first argument is the font name. It should be "SansSerif", "Serif" or "Monospaced". The second is the point size. The optional third argument is a string containing "bold" or "italic", or both. The third argument can also contain the keyword "antialiased". For examples, run the TextDemo macro." Perhaps not perfectly what you want... HTH Herbie ::::::::::::::::::::::::::::::: Am 25.10.16 um 12:47 schrieb Stein Rørvik: > I need to control whether or not the font drawing gets antialiased for > image overlays created by a macro and then flattened. This seems to be > controlled by the settings defined under Options - Fonts, but I can't > find any way to change this from a macro. The macro recorder records > nothing if I do changes here. I also cannot find anything about this > in the macro functions documentation. Does anyone know a workaround? > > Stein > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Stein,
for whatever reason the very options setting is not stored in the ImageJ-preferences file and the setting is always reset with every start of ImageJ. If the setting were stored, you could change the entry to the preferences file... In short, I've no idea of how to change the situation, except by adapting the Java code of ImageJ. Best Herbie :::::::::::::::::::::::::::::::::::::::: Am 25.10.16 um 13:27 schrieb Stein Rørvik: > 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. > > Stein > > -----Original Message----- From: ImageJ Interest Group > [mailto:[hidden email]] On Behalf Of Herbie Sent: 25. oktober > 2016 13:01 To: [hidden email] Subject: Re: Controlling font > aliasing for overlays > > Good day Stein, > > what about: "setFont(name, size[, style]) Sets the font used by the > drawString function. The first argument is the font name. It should > be "SansSerif", "Serif" or "Monospaced". The second is the point > size. The optional third argument is a string containing "bold" or > "italic", or both. The third argument can also contain the keyword > "antialiased". For examples, run the TextDemo macro." > > Perhaps not perfectly what you want... > > HTH > > Herbie > > ::::::::::::::::::::::::::::::: Am 25.10.16 um 12:47 schrieb Stein > Rørvik: >> I need to control whether or not the font drawing gets antialiased >> for image overlays created by a macro and then flattened. This >> seems to be controlled by the settings defined under Options - >> Fonts, but I can't find any way to change this from a macro. The >> macro recorder records nothing if I do changes here. I also cannot >> find anything about this in the macro functions documentation. Does >> anyone know a workaround? >> >> Stein >> >> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Stein Rørvik
> 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 |
Free forum by Nabble | Edit this page |