While working on How to make the digits of π go around in a spiral like this?How to make the digits of π go around in a spiral like this? I encountered a problem that Mathematica would crash at regular intervals with an internal self-test error, either NoteFont2
or winFont
. After lots of trial and error (and restarting Mathematica dozens of times) I have managed to break it down to a minimal (not-)working example:
Graphics[
MapIndexed[
Style[
Text[#],
FontSize -> 20.1*0.999^(#2[[1]])
] &,
RandomInteger[9, 4000]
]
]
My theory is that Mathematica crashes once it had to use too many different font sizes in the same session. This is because you can also provoke the crash by reducing the 4000
to a smaller number and running the code multiple times with different values for 20.1
, whereas if you run it over and over for 1000
samples say but without changing the 20.1
, the error will not occur. Interestingly, when you use 20
instead of 20.1
, 4000
samples won't suffice for a crash (but increasing the 4000
will).
I'm fairly confident this is a bug, and I doubt much can be done about it except waiting for the devs to fix it. But my question is, how can I work around this? I'd love to provide a complete answer for the linked question, but it will need many different font sizes to fill in the spiral completely. Can I accomplish that without provoking this crash? I tried using ScalingTransform
instead of Style[..., FontSize->...]
but that doesn't seem to affect the size of the characters at all (but only their position instead).