I am trying to display antialiased text (using the ImportString[ExportString[]] method shown here) but inside a manipulate so that the text can be changed interactively. I have found a way to do this, but problem is that the function is constantly being updated, even when the tracked symbol "i" is unchanging. A similar problem is outlined here.
Below are simplified versions of my code to:
Manipulate[
Style[i,86,Bold,GrayLevel[0.4],FontFamily->"Verdana"],
{{i,36890},0,99999,1},TrackedSymbols:>{i}
]
toCurves[a_]:=ImportString[ExportString[a,"PDF"],"PDF"][[1,1]];
toGraphics[a_,b_]:=Graphics[{a},Method->{"ShrinkWrap"->True},ImageSize->b];
Manipulate[
toGraphics[toCurves[Style[i,Bold,GrayLevel[0.4],FontFamily->"Verdana"]],{{Automatic},{64}}],
{{i,36890},0,99999,1},TrackedSymbols:>{i}
]
The first manipulate displays the text with jaggies and works as expected.
The second manipulate uses the custom functions toCurves and toGraphics and displays the text without jaggies but is constantly being updated.
The cause of the problem appears to be the ExportString function, but it could also be the ImportString function.
Edit 1:
I found a way to stop the manipulate from constantly updating using the If function:
style[a_] := Style[a, Bold, GrayLevel[0.4], FontFamily -> "Verdana"]
toCurves[a_] := ImportString[ExportString[a, "PDF"], "PDF"][[1, 1]];
toGraphics[a_] :=
Graphics[{a}, Method -> {"ShrinkWrap" -> True},
ImageSize -> {{Automatic}, {64}}];
Manipulate[
If[
i != j,
j = i; k = toGraphics[toCurves[style[i]]],
k
],
{{i, 36890}, 0, 99999, 1},
Initialization :> {j = ""},
TrackedSymbols :> {i}
]
I modified the toGraphics function and added a custom style function to reduce some of the clutter in the code. It isn't as elegant as I'd like it to be, but it works.